0

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

JakubTracz
  • 27
  • 2
  • 8

2 Answers2

2

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%';"
Yu Zhou
  • 11,532
  • 1
  • 8
  • 22
  • 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 Jul 06 '20 at 18:33
  • Ok, I've just used Send Keys. I hope it's a good way to do so. – JakubTracz Jul 06 '20 at 18:45
  • 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. – Yu Zhou Jul 07 '20 at 06:37
0

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
YasserKhalil
  • 9,138
  • 7
  • 36
  • 95