florentbr / SeleniumBasic

A Selenium based browser automation framework for VB.Net, VBA and VBScript
BSD 3-Clause "New" or "Revised" License
421 stars 197 forks source link

How to code MS Edge IE Mode on VBA using SeleniumBasic #229

Open jadeoliver opened 2 years ago

jadeoliver commented 2 years ago

I am using Selenium Basic to automate MS Edge.

I would like to be able to open a url on MS Edge using IE Mode. 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.

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.

nazneenprojects commented 2 years ago

Hello ,

You need to use this Selenium Basic with VB script to add the URL into IE mode settings & then in new tab again open that URL. It shall open in IE Mode inside edge browser.

In order to complete first section refer below script -

Set driver = CreateObject("Selenium.EdgeDriver") driver.Get "edge://settings/defaultBrowser" driver.Window.Maximize driver.FindElementByXPath( <>).Click driver.FindElementByXPath(<>).SendKeys ("URL goes here") driver.FindElementByXPath(<>).Click

jadeoliver commented 2 years ago

Thanks for the tip and sample above, but how do I open a new tab with selenium basic? I tried driver.window.switchtonextwindow but that doesn't work.

rufogil commented 2 years ago

Hello there, This opens a new tab in Edge using VBA and Selenium Basic.

driver.ExecuteScript "window.open('');" ' Opens a NEW TAB in Edge driver.SwitchToNextWindow driver.Get ("https://google.com")

jadeoliver commented 2 years ago

Yep, I know how to do that. What this coding doesn't do is to open the website in IE Mode.