Selenium WebDriver Cheat Sheet – Advanced Topic- Firefox Profiling

Cheat Sheets are the most effective way to teach things to others. There is an acute shortage of Selenium WebDriver Cheat Sheets. So we have decided to create one yourself for you guys. This cheat sheet for selenium WebDriver provides all the important and commonly used methods, operations and commands for your easy daily access.

Code Example:

package firefoxprofile;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.firefox.FirefoxProfile;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.openqa.selenium.remote.RemoteWebDriver;
import com.gargoylesoftware.htmlunit.javascript.host.file.File;
public class firefoxprofile
{
public static void main(String[] args)
{
//Load firefox from non default location
System.setProperty(“webdriver.firefox.bin”, “mentioned path here”);
FirefoxProfile fp = new FirefoxProfile();
/*
* //load firefox with addons if you want with
*
* File file = new File(“path/to/extension.xpi”);
* fp.addExtension(file);
*
*/
//For other setting of browser profile
DesiredCapabilities dc = new DesiredCapabilities();
dc.setCapability(FirefoxDriver.PROFILE, fp);
WebDriver driver = new RemoteWebDriver(dc);
driver.close();
}
}

Similar Posts

Leave a Reply

Your email address will not be published. Required fields are marked *