0

I have a perl based selenium script with the following statement :

$sel = Test::WWW::Selenium->new( host => "localhost", 
                            port => 4444, 
                            browser => "*chrome", 
                            browser_url => "https://$ARGV[0]/" );

This throws up the Firefox browser. I want that when the Firefox browser is thrown up it is configured to use my proxy namely 127.0.0.1:8080 where I have a proxy service already started. How can I accomplish this without making any changes to the above shown code?

user2318314
  • 113
  • 2
  • 12
  • You get Firefox when you ask Selenium for "*chrome"? Odd. Also note that "throw up" means "to puke". Use "starts" instead. – Aaron Digulla Nov 13 '13 at 10:31

1 Answers1

0

For Firefox, you need to create a profile for Selenium. Start Firefox with -ProfileManager -no-remote to be able to select this profile. Configure it accordingly.

When starting Firefox with the Selenium webdriver, you can then specify the profile to use with webdriver.firefox.profile

I couldn't find a solution to achieve the same with the Perl API. You might have to hack the sources to be able to specify the profile. Just add -P plus the name of the profile to the command line options of the browser process.

Alternatively, you can insert a script in the path variable before you run the tests. For example, on Unix:

#!/bin/bash

/usr/bin/firefox -P selenium

Save this in, say, $HOME/selenium/bin/firefox, make this new file executable and:

export PATH="$HOME/selenium/bin/firefox;$PATH"

The tests will not think that the script is the firefox executable and run that. The script will then run Firefox with the correct parameters.

Community
  • 1
  • 1
Aaron Digulla
  • 321,842
  • 108
  • 597
  • 820