6

I am working on a project where I need to use a proxy. I am using the Chrome browser and when I run my script it forces me to enter the username and password of the proxy.

I have tried passing the username and password with the URL itself, but it is not working.

Here is the code:

Proxy p = new Proxy(); p.setHttpProxy("in-pr.oxylabs.io:20000"); p.setSslProxy("in-pr.oxylabs.io:20000"); System.setProperty("webdriver.chrome.driver","D:\\Love_Testing\\Senium_Naveen\\chrome Driver\\chromedriver_win32\\chromedriver.exe"); ChromeOptions options = new ChromeOptions(); // options.addArguments("--incognito"); DesiredCapabilities dc = DesiredCapabilities.chrome(); dc.setCapability(ChromeOptions.CAPABILITY,options); dc.setCapability("proxy",p); WebDriver driver = new ChromeDriver(dc); driver.get("https://www.google.com"); 
32
  • do you want to disable the proxy on chrome browser ?and not to get any popup for asking the username and password ?CommentedAug 15, 2018 at 8:33
  • I want to enter the username and password in that popup
    – Love
    CommentedAug 15, 2018 at 8:35
  • are you getting any error ?CommentedAug 15, 2018 at 8:37
  • Not any error, I tried passing the username and password with url itself but it is not working @RamanaMuttana
    – Love
    CommentedAug 15, 2018 at 8:38
  • 2
    It is still showing authentication
    – Love
    CommentedAug 16, 2018 at 12:50

1 Answer 1

2

There's a small Chrome plugin that you can build manually from this answer.
To apply the plugin, in a java context:

ChromeOptions chromeOptions = new ChromeOptions(); chromeOptions.addExtensions(new File("proxy.zip")); driver = new ChromeDriver(chromeOptions); 

    Start asking to get answers

    Find the answer to your question by asking.

    Ask question

    Explore related questions

    See similar questions with these tags.