Imagine that you wanted to have your site as the startup page for Firefox. To do this we will need to update the browser.startup.homepage preference. Follow these steps:
Let's start by creating the FirefoxProfile object:FirefoxProfile profile = new FirefoxProfile();
Now we will set the preference:profile.setPreference("browser.startup.homepage","https://www.wisdomjobs.com");
To get the profile to be used, we need to pass it in to the driver. To do this, we need to do the following:driver = new FirefoxDriver(profile);
Run your test. The final code should look like the following:
What just happened?
We have just seen that we can manipulate Firefox settings before the browser is loaded. This can be useful if you need to get extra information out of the browser or if we have a few things that need tweaking.
If you had installed Firefox in a different place, you would have had to instantiate the FirefoxBinary class with details of it:
FirefoxBinary binary = new FirefoxBinary("/path/to/binary");
driver = new FirefoxDriver(binary);
If you need to update both the Firefox Profile and the Firefox Binary, you can simply pass both of them through the constructor as follows:
As you can see, it's fairly simple to load Firefox if it isn't installed in the usual place.
Installing a Firefox add-on
One of the most useful features of Firefox is the ability to install add-ons to enhance the user experience. This enhanced experience can mean that web applications act differently when the add-on is installed.
Let's have a look at how we can install an add-on into our profile before we start the browser.
Selenium Related Interview Questions
|SILK TEST Interview Questions||QTP Interview Questions|
|JMeter Interview Questions||Automation Testing Interview Questions|
|Software testing Interview Questions||JUnit Interview Questions|
|TestNG Interview Questions||SAP Testing Interview Questions|
|Selenium WebDriver Interview Questions||Selenium IDE Interview Questions|
|QUnit Testing Interview Questions||Performance Testing Interview Questions|
|Hadoop Testing Interview Questions|
All rights reserved © 2020 Wisdom IT Services India Pvt. Ltd
Wisdomjobs.com is one of the best job search sites in India.