Closed yaju closed 2 years ago
Ok I'll look into adding Edge IE mode. Thank you.
One thing that I noticed immediately is that the command "Shutdown" does not consistently shutdown the IE driver on my machine/setup.
For example, after adding the ignoreZoomSetting browser option that you shared above, then running the following test sub, the command window sometimes closes on its own, and other times I have to close it manually. That behavior will have to be debugged and fixed before this can be implemented successfully.
Sub test()
Dim driver As New WebDriver
driver.AppWinStyle = vbNormalFocus
driver.StartIE
driver.OpenBrowser
driver.CloseBrowser
driver.Shutdown
End Sub
Further info... I can get the above subroutine "test" to work consistently if I set the capabilities IE option "initialBrowserUrl" to a correct url like "https://www.google.com/". I cannot explain why that solves (or hides?) the problem, but it seems to work on my computer.
It may be a problem close to the following site https://github.com/SeleniumHQ/selenium/issues/10545
Will it be ShutDown normally if I add NavigateTo?
Sub test()
Dim driver As New WebDriver
driver.AppWinStyle = vbNormalFocus
driver.StartIE
driver.OpenBrowser
driver.NavigateTo "https://www.google.com/"
driver.CloseBrowser
driver.Shutdown
End Sub
Setting "initialBrowserUrl" does not solve problem - it's so intermittent that it's difficult to tell what is helping or not.
I isolated the problem to executing the "CMD_QUIT" command in CloseBrowser method. The http send request often hangs using the IEDriverServer on my system.
I will try a different computer/setup next...
Tested on a Windows 11 machine (previous was Windows 10), and experienced same intermittent problem with CloseBrowser. The test sub worked about 10 times in a row and then started hanging....
@yaju - what OS and Office version are you using? Thx!
My PC environment
Windows 10 Pro 21H1 Excel for Microsoft 365(32bit) I moved it 10 times in a row. The 10th time, it hung in CloseBrowser.
Another case. Fixed 64bit detect in capabilities.cls.
capabilities.cls
InitializeFor
Case "internet explorer"
InStr(Application.OperatingSystem, "64-bit")
↓
InStr(GetObject("winmgmts:Win32_OperatingSystem=@").OSArchitecture, "64")
@yaju, this problem may be same as this reported issue.
I'll see if I can come up with a temp work-around to recover gracefully from the "hang".
Would you mind providing a usage-case for needing to run Edge in IE mode?
Thanks for your help!
Would you mind providing a usage-case for needing to run Edge in IE mode?
A small RAP that runs regularly once a day
@yaju what is a RAP and why can't it be performed with Edge or Chrome? Why is IE mode in Edge important? Thx!
RAP Typographical error RAP->RPA Tool
There are in-house groupware that are not yet compatible with Edge. For example, some sites are using Active X or are not displayed correctly in Edge.
Got it - thanks for the explanation!
Soon I'll create a develop version branch that will accommodate IE mode...
@yaju, can you tell me why you changed the 64-bit detect method for OS?
InitializeFor
Case "internet explorer"
InStr(Application.OperatingSystem, "64-bit")
↓
InStr(GetObject("winmgmts:Win32_OperatingSystem=@").OSArchitecture, "64")
Windows 10 Pro 21H1(64bit) Excel for Microsoft 365(32bit)
"Application.OperatingSystem" is installed to get Office bits. return 32-bit. But I need is to get Windows OS bit.
Ok @yaju, does this work for you?
Case "internet explorer"
If InStr(GetObject("winmgmts:Win32_OperatingSystem=@").OSArchitecture, "64") Then
browserOptions.Add "ie.edgepath", Environ("ProgramFiles(x86)") & "\Microsoft\Edge\Application\msedge.exe"
Else
browserOptions.Add "ie.edgepath", Environ("ProgramFiles") & "\Microsoft\Edge\Application\msedge.exe"
End If
I'm close to publishing a limited but functional version with IE mode support. I just need to finish documenting the limitations.
@GCuser99
does this work for you?
Test OK
@yaju, with regard to IE mode support, I have created a new discussion here and so will close this issue out. Thanks for your help in getting started!
PS: While your solution above is a good one, I ended up using the native method GetDriverStatus to extract windows and driver architecture (bit-ness). :-)
Reference site http://blog.livedoor.jp/tarboh_w-inko/archives/37451016.html Below the blog post is a link to the modified book. seleniumvba_v1.2_EdgeIEMode.xlsm
Below are additional fixes
Capabilities.cls
If you do not set the IgnoreZoomLevel property to true, you will get an exception message.
The reason for this exception error is that IE does not match the coordinate position when clicking unless Zoom is set to 100%. However, in IE mode, setting the IgnoreZoomLevel property to true ignores the exception and Zoom is displayed at 100%.
TinySelenium issue https://github.com/uezo/TinySeleniumVBA/issues/70