IP address for locahost

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

IP address for locahost

Elaine Leese
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

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/6503b9ec-9968-40cb-b058-c14e3f9bab3ao%40googlegroups.com.
Reply | Threaded
Open this post in threaded view
|

Re: IP address for locahost

Gaurav Pandey
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());

}



On Friday, July 3, 2020 at 5:56:54 PM UTC+5:30, Elaine Leese wrote:
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

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/775a58aa-58ce-40e5-8ee8-327cd87614f6o%40googlegroups.com.