I am using Watir-webdriver and have both IE 32 bit and IE 64 bit on my test machine. When I create a browser instance using
browser = Watir::Browser.new :ie
It opens IE 64 bit by default (which is in itself interesting as it is not the default browsers). I would like to be able to specify which version of IE (32 bit or 64 bit) I am targeting programmatically. Is this possible, and if so how can it be done.
Background
Selenium-webdriver, which is what Watir-webdriver is using, determines the version to use by:
“The driver supports running 32-bit and 64-bit versions of the browser. The choice of how to determine which “bit-ness” to use in launching the browser depends on which version of the IEDriverServer.exe is launched. If the 32-bit version of IEDriverServer.exe is launched, the 32-bit version of IE will be launched. Similarly, if the 64-bit version of IEDriverServer.exe is launched, the 64-bit version of IE will be launched.” – http://code.google.com/p/selenium/wiki/InternetExplorerDriver
Presumably you have the 64bit version installed.
Solution
Selenium-webdriver is hardcoded to the file IEDriverServer.exe. The quickest solution might be to override this. Try the following:
This is a pretty quick hack. I am sure is a more elegant solution.
Update – Add a bit option
So that you can more nicely determine which browser to use, you can add a ‘bit option’ when creating an IE window. This is nicer than above, though still hacky (ie global variable).