Issue
How can I use Selenium with Java with a custom Firefox Profile?
Solution
Here is my configuration:
Firefox version: 12
Selenium version: 2.25
Language: Java
Platform: MacOS
- Open Terminal
- type:
/Applications/Firefox.app/Contents/MacOS/firefox-bin -p
( change the path as necessary ) - Create a new profile, save it in a directory as you wish..
- Start firefox with this profile, add any add-ons, modifications as you wish.
- In Selenium, use:
FirefoxBinary binary = new FirefoxBinary();
File firefoxProfileFolder = new File("/Users/xxx/work/xxx/selenium/src/test/resources/firefoxprofile");
FirefoxProfile profile = new FirefoxProfile(firefoxProfileFolder);
profile.setAcceptUntrustedCertificates(true);
webDriver = new FirefoxDriver(binary, profile);
Again here change the absolute path as required. Add add-ons like autoAuth to pass the HTML Authorization windows in Firefox to this profile..
Answered By - Koray Tugay
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.