Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to setup IE webdriver on a remote box

I have all my tests run in a ubuntu box. The tests are written in PHP. They work all fine with the firefox driver and chrome driver. I'm using a standalone selenium server(selenium-server-standalone-2.25.0.jar) which runs in the same box. Lately I need to write test against the IE platforms. I've tried a few things but up to this point I'm still not sure what's the correct way to set the IE driver for my particular scenario.

I've tried to install IE with mono in the same ubuntu box but I got lots of problems during installation, and after I got rid of those problems and made it so that I could run IE from my command line, it still didn't work for my tests.

I read through this particular documentation here: http://code.google.com/p/selenium/wiki/InternetExplorerDriver and followed through on a windows box, until I saw this:

The HTTP server started by the IEDriverServer.exe sets an access control list to only accept connections from the local machine, and disallows incoming connections from remote machines. At present, this cannot be changed without modifying the source code to the IEDriverServer.exe. To run the Internet Explorer driver on a remote machine, use the Java standalone remote server in connection with your language binding's equivalent of RemoteWebDriver.

so I downloaded selenium-server-standalone-2.25.0.jar to the windows machine and started it; my IEDriverServer.exe was put into C:\windows\system32\ which is in my PATH. Then I changed the code in my ubuntu box to point to the selenium server running on the windows box. But still no luck.

I googled a bit, and there are cases people successfully got it running. But they seems to be using a java binding or c# binding which I suppose they are developing on a local box. I haven't found a working case that's like mine that's:

a ubuntu box where PHP based tests run connection to a remote selenium server running on windows. a windows box with a selenium standalone server running and with IEDriverServer.exe in PATH

Thanks.

like image 614
Shawn Avatar asked Sep 12 '12 02:09

Shawn


People also ask

How do I run Selenium remotely?

When the Selenium server and hub are connected and running, you can write a test case using RemoteWebDriver. To run a remote WebDriver client, first, connect to RemoteWebDriver. Point the URL to the address of the server running the tests. Also, set up the desired capabilities to customize the client.

What is remote selenium WebDriver?

Selenium Remote Webdriver: It is an class that is used to execute the browser automation and to execute assessments in a distributed environment or on a remote computing device. In other words, It is a class that implements the WebDriver interface and this action is performed on the remote server.


1 Answers

I had a similar problem - working on Linux and wanting to run my WD tests against IE 11 - and got it to work. The main difference between me and the OP is that my tests are written in Java.

My goal was like this:

  • My workstation: Ubuntu 14.04, tests written in Java.
  • Windows machine: some VM with IE 11.
  • I want to run my tests against IE running on the Windows box, from the Ubuntu workstation (so that I don't need to install my whole dev environment on the Windows machine).

What I did:

  1. Got Win 7 & IE 11 VirtualBox VM, downloaded from Microsoft (here), powered it on.
  2. Downloaded to the Windows box: (a) Java JRE, (b) Selenium Standalone Server jar (NOT "The Internet Explorer Driver Server" also mentioned on that page), (c) Internet Explorer Driver.
  3. Set up Host Only Network between my workstation and the Windows box. Here's a nice description of the process. Despite the VM in the blog post being Linux, it works pretty much the same for a Windows VM (use "ipconfig" from Command prompt instead of "ifconfig" to find out your IP).
  4. On Windows box, configured things mentioned on the official Internet Explorer Driver page, in the section Required Configuration. In case they change the link, I'm pasting them here:
  • The IEDriverServer executable must be downloaded and placed in your PATH.
  • On IE 7 or higher on Windows Vista or Windows 7, you must set the Protected Mode settings for each zone to be the same value. The value can be on or off, as long as it is the same for every zone. To set the Protected Mode settings, choose "Internet Options..." from the Tools menu, and click on the Security tab. For each zone, there will be a check box at the bottom of the tab labeled "Enable Protected Mode".
  • Additionally, "Enhanced Protected Mode" must be disabled for IE 10 and higher. This option is found in the Advanced tab of the Internet Options dialog.
  • The browser zoom level must be set to 100% so that the native mouse events can be set to the correct coordinates.
  • For IE 11 only, you will need to set a registry entry on the target computer so that the driver can maintain a connection to the instance of Internet Explorer it creates. For 32-bit Windows installations, the key you must examine in the registry editor is HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BFCACHE. For 64-bit Windows installations, the key is HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BFCACHE. Please note that the FEATURE_BFCACHE subkey may or may not be present, and should be created if it is not present. Important: Inside this key, create a DWORD value named iexplore.exe with the value of 0.

Note I didn't need to put IEDriverServer.exe's location in the PATH, and couldn't find "Enhanced Protected Mode" in my IE 11 settings (so didn't do that).

  1. On Windows box, started from Command prompt (they must both be running; I figured it out from the posts on this issue):
    • java -jar selenium-server-standalone-2.53.1.jar
    • IEDriverServer.exe
  2. Edited the set up section of my tests to use RemoteWebDriver, like so (192.168.56.101 was the Host Only Network IP of the Windows box):

    DesiredCapabilities capability = DesiredCapabilities.internetExplorer();
    driver = new RemoteWebDriver(new URL("http://192.168.56.101:4444/wd/hub"),
        capability);
    
  3. Ran the tests from my Ubuntu workstation as normal: mvn test myproject

And it worked! :)

like image 177
Jan Żankowski Avatar answered Sep 23 '22 14:09

Jan Żankowski