0

I have a website that I want to test through automation. My client wants to test the website using a proxy of another country as we can testing manual using Browserc Extension. How we can perform it in selenium using java. Below is the code I tried but how can I check this is the same country that proxy I used.

`

    Proxy proxy= new Proxy();
    proxy.setHttpProxy("localhost:8888");
    DesiredCapabilities cap = new DesiredCapabilities();
    cap.setCapability(CapabilityType.PROXY,  proxy);
    System.setProperty("webdriver.gecko.driver", "G:\\Selenium\\Driver\\geckodriver.exe");
    WebDriver driver = new FirefoxDriver();
    driver.get("https://vapesuite.co.uk/#/");`
Zaman10
  • 81
  • 6

2 Answers2

1

I think the issue is with your code and proxy and it is not working properly.

I have tried the free proxy and it was working fine for me, please see the attached screenshot.

Code Used:

    FirefoxOptions options = new FirefoxOptions();
    FirefoxProfile profile = new FirefoxProfile();

    profile.setPreference("network.proxy.type", 1);
    profile.setPreference("network.proxy.http", "116.80.41.12");
    profile.setPreference("network.proxy.http_port", 80);
    profile.setPreference("network.proxy.ssl", "116.80.41.12");
    profile.setPreference("network.proxy.ssl_port", 80);

    options.setProfile(profile);

    WebDriver driver = new FirefoxDriver(options);
    driver.get("https://vapesuite.co.uk/#/");

https://free-proxy-list.net/ enter image description here

enter image description here

https://mylocation.org/ enter image description here

Abhishek Dhoundiyal
  • 1,359
  • 1
  • 12
  • 19
0

if you are using maven this should work for you : https://maven.apache.org/guides/mini/guide-proxies.html