IP address for locahost

26 views
Skip to first unread message

Elaine Leese

unread,
Jul 3, 2020, 8:26:54 AM7/3/20
to Selenium Users
I am running the latest version of Selenium and geckodriver.exe. I require using different proxies to test functionality and I would also like to be able to use no proxy at times. I thought this aspect would be simple, so what settings can I use to implement no proxy within this context? For example:

FirefoxOptions firefoxOptions = new FirefoxOptions();
FirefoxProfile firefoxProfile = new FirefoxProfile();

firefoxProfile.setPreference("network.proxy.type", 1);
firefoxProfile.setPreference("network.proxy.http", proxy);
firefoxProfile.setPreference("network.proxy.http_port", port);
firefoxProfile.setPreference("network.proxy.ssl", proxy);
firefoxProfile.setPreference("network.proxy.ssl_port", port);

I have tried assigning String proxy as "localhost", "127.0.0.1", "0,0,0,0" with ports "3128", "8080", etc... I know it sounds like a contradiction, but what proxy settings do I use to have no proxy?

Thank you in advance

Gaurav Pandey

unread,
Jul 6, 2020, 1:19:39 PM7/6/20
to Selenium Users
You might want to consider using Method overloading 

one with firefox options
and the other without firefox options - please see sample code below - 

public static WebDriver createFireFoxDriver(FirefoxOptions options) {

System.setProperty("webdriver.gecko.driver"GECKO_DRIVER_PATH);

return new FirefoxDriver(options);

}


public static WebDriver createFireFoxDriver() {

return createFireFoxDriver(new FirefoxOptions());

Reply all
Reply to author
Forward
0 new messages