How to overcome the IE Zoom Problem when launching it from VBA using Selenium? I have found only some code for other languages, but could not find anything for VBA. Thank you in advance
2 Answers
You can't use Selenium IEDriver if you don't set IE zoom level to 100%. One of the required configuration of using Selenium IEDriver is that:
The browser zoom level must be set to 100% so that the native mouse events can be set to the correct coordinates.
Only with the zoom level set to 100% then we can launch IE from VBA using Selenium.
Reference link: How to ignore zoom setting
Edit:
If you have opened IE through Selenium VBA then you could use the following code to zoom in the webpage:
driver.ExecuteScript "document.body.style.zoom='200%';"
3 Comments
JakubTracz
I've managed to open the IE - thank you. Now I would need something to ignore the zoom level as everything is super small. How can I zoom the page back and keep Selenium work (or will it brake?). The linked question is about the error itself which is no longer a problem for me. Thank you in advance.
JakubTracz
Ok, I've just used Send Keys. I hope it's a good way to do so.
Yu Zhou
From your last comment, it seems that you have fixed the issue. Based on your explanation in the comment, I also updated my answer. Please check it.
Try such code
Sub Test()
Dim bot As New IEDriver
With bot
.Get "https://www.google.co.uk"
.Window.Maximize
Stop
.Quit
End With
End Sub
3 Comments
YasserKhalil
Did you install selenium properly? Review this LINK
JakubTracz
The linked question is about Chrome - for me it's working with Chrome, so not quite sure.
YasserKhalil
The code is working for me. I have windows 10 64 Bit and Internet Explorer 11 and Office 365 32 Bit .. Make sure the IE is installed correctly.