在 VBA Excel 中使用谷歌地球上的硒的 shadowRoot 元素

问题描述

我正在使用 Selenium 库从 Google 地球网页上的 Excel VBA 自动打开 KML 文件

当我使用以下几行时 -

Bot.FindElementByCss("earth-app").shadowRoot.FindElementById("toolbar").shadowRoot.FindElementById("projects").Click

它不起作用,说 - 对象不支持属性方法

  1. 我也试过 -

    Bot.ExecuteScript (" return document.querySelector('earth-app') .querySelector('地球工具栏#工具栏') .shadowRoot.querySelector('earth-gm2-icon-button#projects').点击;")

没有错误,但无法正常工作。

这是项目的 XPath 按钮。 /html/body/earth-app//paper-drawer-panel/div/earth-toolbar//earth-gm2-icon-button[5]

"//" 是一个 shadowRoot。

参考这个问题- Google Earth scraping using python selenium

用于通过项目图标导入的 findElement* 的 Id、Name、CssSelector 或 XPath 是什么?

附言- 请不要删除此问题。

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)