Proxy Setting and Selenium RC problem Explained with Solution

The following is a result of trials and research I conducted to make my selenium RC JAVA scripts run under firefox 3 and IE 7. Here's an explanation of the problem and a proposed solution that worked for me:

  • By default, whenever we playback a selenium RC script, a proxy profile is automatically created. This profile overwrites the current browser proxy settings to generic values. Which may not necessarily match our browser settings.
  • A unique proxy profile is automatically generated for each session. You can find the profile saved in a *.pak file under the following directory:
    C:\Users\username\AppData\Local\Temp\customProfileDir######

    where ###### is numeric value and username is your windows user.

  • A typical proxy *.pak file will look like this with the generic values:
    function FindProxyForURL(url, host) {

    return 'PROXY localhost:4444; DIRECT';
    }
  • When you run the script and open the browser window, the proxy settings for the browser will be set to null. That’s why the script crashes and the browser is unable to reach any page. So we need to modify the proxy settings before the browser is fired.
  • To solve this, you can provide additional switches to the “-jar selenium-server.jar” command that will modify the proxy settings of the browser session that is about to fire. The following is an example:
    java -Dhttp.proxyHost=isa-mis-02 -Dhttp.proxyPort=8080 -jar selenium-server.jar –avoidProxy

I hope this helps

1 comments:

  1. packey said...

    I recently came accross your blog and have been reading along. I thought I would leave my first comment. I dont know what to say except that I have enjoyed reading. Nice blog. I will keep visiting this blog very often.


    Betty

    http://laptopprocessor.info