Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Selenium server not starting for custom firefox profile

I'm trying to start the selenium server by passing custom firefox profile to the DefaultSelenium constructor. It opens the browser with specified URL.

DefaultSelenium selenium = new DefaultSelenium("localhost", 4444, "*custom \"C:/Program Files/Mozilla Firefox/firefox.exe\"",ReadConFile.readcoFile("serverName"));
    selenium.start();

the log is

16:39:19.246 INFO - Allocated session 4eb63d37a4ba4d2fb4e351f8f59e3ea6 for https://<myURL>, launching...

then it stays like that and server doesn't start.

however, this works fine if I don't use custom profile.

DefaultSelenium selenium = new DefaultSelenium("localhost", 4444, "*chrome",ReadConFile.readcoFile("serverName"));
selenium.start();

I need the launch custom profile as I've saved some site certificates necessary for https. Also, I'm executing this from eclipse.

I think my server isn't configured to launch custom profile. Please help me with this.

like image 640
9ikhan Avatar asked Mar 30 '11 11:03

9ikhan


2 Answers

The start command is not really starting your selenium server per se, it's connecting your selenium object to an already running server with the browser of your choice.

To actually start the selenium [Jetty Web] server that sends / receives commands to your application under test via your specified browser, use a batch file and the switch rs79 is referring to. The contents of your batch file should include his line:

java -jar selenium-server-standalone-2.0a5.jar -firefoxProfileTemplate C:\custom-firefox-profile

Now you have a true selenium server running on your dev machine (localhost) with the default "4444" port. This will specify that any Firefox browser testing will use this profile.

Now your DefaultSelenium constructor, assignment, and other calls can look like this:

DefaultSelenium selenium = new DefaultSelenium("localhost", 4444, "*firefox","http://www.server.com");
selenium.start()
selenium.open("myApp/")

Firefox will start using the custom profile specified in the batch file that starts the Selenium server, with your desired base URL, and then navigate into your desired application [URL]. If you are beginning your test from "http://www.server.com/" and not "http://www.server.com/myApp", you can omit the last open line.

like image 156
NathanChristie Avatar answered Nov 03 '22 22:11

NathanChristie


When you invoke the Selenium RC server, specify the path using the additional -firefoxProfileTemplate clause. For example -

java -jar selenium-server-standalone-2.0a5.jar -firefoxProfileTemplate C:\custom-firefox-profile

This will enable you to use all the bindings you have saved within the custom profile.

like image 35
rs79 Avatar answered Nov 03 '22 20:11

rs79