Last active
October 16, 2019 12:31
-
-
Save 4M01/9b60a5f852fabdc5f65c9496e6eccf03 to your computer and use it in GitHub Desktop.
Open Firefox Browser in Incognito Mode using Selenium WebDriver
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import org.openqa.selenium.WebDriver; | |
import org.openqa.selenium.firefox.FirefoxDriver; | |
import org.openqa.selenium.firefox.FirefoxProfile; | |
/** | |
* Created by Amol Chavan on 9/19/2016. | |
*/ | |
public class PrivateBrowsing { | |
public static void main(String args[]){ | |
createInstance(); | |
} | |
public static WebDriver createInstance(){ | |
FirefoxProfile firefoxProfile = new FirefoxProfile(); | |
firefoxProfile.setPreference("browser.private.browsing.autostart",true); | |
WebDriver driver = new FirefoxDriver(firefoxProfile); | |
driver.get("http://www.google.com"); | |
return driver; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment