Running Selenium RC with *custom browser

I tried using Selenium some time ago and got stuck when trying to run the RC. I was running my tests just fine manually in the browser but I wanted some automation. Now, two years after that first encounter, I’m trying to use Selenium again to test my javascript code.

The RC proves difficult again. When using the *firefox option I was receiving this error

java.lang.RuntimeException: Firefox refused shutdown while preparing a profile

When using *iexplore I would start getting all the confirmation dialogs that you get when you first use Internet Explorer (and any browser for that matter).

Selenium’s idea of creating a new profile to run the tests was causing all my problems.

If you use the *custom option instead and specify the path to the browser; Selenium will run with the current user’s profile. That sounds like a solution except that you also loose the automatic configuration of the proxy in the browser which must be exactly why Selenium creates the new profile.

So if you want to use *custom to avoid all the profile creation errors; you must configure the proxy settings in the browser manually.

Selenium actually creates a pac file to save the proxy settings when you run it using *iexplore or *firefox so I copy that file, put it somewhere safe and point my browser proxy settings to it.

The pac file looks like this:

function FindProxyForURL(url, host) {
 	    if(shExpMatch(url, '*/selenium-server/*')) {
 	        return 'PROXY localhost:4444; DIRECT';

Now I can finally start taking advantage of Selenium RC.


2 thoughts on “Running Selenium RC with *custom browser

  1. I tried the above solution but when I run a getnewbroswerserssionId Slenium automatically repoints the browsers proxy to the newly created .pac file…

    How do i over come that ???

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s