Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

InternetExplorerDriver Zoom Level Error

Tags:

I'm trying to run tests against IE8 but I've encountered a strange issue:

  1. When creating the webdriver instance (driver = Selenium::WebDriver.for :ie), IE starts up and an exception is thrown by WebDriver:

    "Unexpected error launching Internet Explorer. Browser zoom level was set to 0%"

  2. IE seems to show a failure to connect to the IE Driver Server but if I refresh the browser manually, it connects just fine.

    I have checked online and only two other people seem to have reported this. One possible solution was to ensure that all zones have the same "protected mode" settings, which they do.

    My environment is Windows 7 and IE8 with IE Driver Server v2.25.3 and I'm using the Ruby bindings.

Any ideas?

like image 251
Mark Micallef Avatar asked Aug 20 '12 09:08

Mark Micallef


People also ask

How do I change the zoom level in IE 11 using selenium?

In this article, I will show you two methods on how to Zoom In and Zoom Out in Selenium WebDriver. Manually, we have to press CTRL+ADD to do Zoom In and we have to press CTRL+SUBTRACT to do zoom out.

How do I change my browser zoom to 100 in IE?

In Internet Explorer, on the View menu, point to Zoom, and then select a different level. If you have a mouse with a wheel, hold down the Ctrl key, and then scroll the wheel to zoom in or out. If you click the Change Zoom Level ( ) button, it cycles through 100%, 125%, and 150%.


1 Answers

According to the answer given by Jim Evans (one of Selenium developers) in this thread at WebDriver User Group the code below should fix your problem.

DesiredCapabilities caps = DesiredCapabilities.internetExplorer();
caps.setCapability("ignoreZoomSetting", true);
driver = new InternetExplorerDriver(caps);
like image 183
JacekM Avatar answered Oct 03 '22 06:10

JacekM