简体   繁体   English

如何使用 SeleniumBasic 在 VBA 上编写 MS Edge IE 模式

[英]How to code MS Edge IE Mode on VBA using SeleniumBasic

I am using Selenium Basic to automate MS Edge.我正在使用 Selenium Basic 来自动化 MS Edge。

I would like to be able to open a url on MS Edge using IE Mode.我希望能够使用 IE 模式在 MS Edge 上打开一个 url。 I found that there is an IEDriverServer.exe that we can use to run urls on MS Edge IE Mode but there is no example how to use it on VBA.我发现有一个 IEDriverServer.exe,我们可以使用它在 MS Edge IE 模式上运行 url,但没有如何在 VBA 上使用它的示例。

Can someone help me how to properly put it in my code?有人可以帮助我如何正确地将它放入我的代码中吗?

Dim driver As New WebDriver
Set driver = New EdgeDriver

driver.Get ("https://google.com")

driver.Refresh

Thanks.谢谢。

Please refer to https://github.com/florentbr/SeleniumBasic/releases/tag/v2.0.9.0请参考https://github.com/florentbr/SeleniumBasic/releases/tag/v2.0.9.0

Once you install Selenium Basic exe on your machine, you will get lot of ready examples with vbscript at installation location.在您的机器上安装 Selenium Basic exe 后,您将在安装位置获得许多带有 vbscript 的现成示例。

Also make sure to download latest edge driver and put in installation location by renaming as previous.还要确保下载最新的边缘驱动程序并通过重命名将其放入安装位置。

Sample code示例代码

Set driver = CreateObject("Selenium.EdgeDriver")
driver.Get "edge://settings/defaultBrowser"
driver.Window.Maximize
driver.FindElementByXPath(....<add xpath here>...)
' add required UI component action & xpath for the same.
driver.Quit

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM