如何避免用户名和在Selenium webdriver,chrome中密码警报提示(同时验证代理)

时间:2017-09-25 08:47:14

标签: selenium selenium-webdriver selenium-chromedriver

如何避免用户名和& Selenium webdriver中的密码提示提示(在验证代理时),chrome?

        System.setProperty("webdriver.chrome.driver","C:/Selenium/Chrome/chromedriver.exe");
        DesiredCapabilities capabilities = DesiredCapabilities.chrome(); 
        Proxy proxy = new Proxy(); 
        proxy.setHttpProxy("xx.xx.xxx.xx:yyyy"); 
        proxy.setSslProxy("xx.xx.xxx.xx:yyy"); 
        proxy.setSocksUsername("abcd");
        proxy.setSocksPassword("efgh");
        capabilities.setCapability("proxy", proxy);
        ChromeOptions options = new ChromeOptions(); 
        options.addArguments("start-maximized"); 
        capabilities.setCapability(ChromeOptions.CAPABILITY, options); 

        WebDriver driver = new ChromeDriver(capabilities);

        driver.get("https://abcd:efgh@whatismyipaddress.com/");

1 个答案:

答案 0 :(得分:1)

试试这个,

System.setProperty("webdriver.chrome.driver", "G:/Chrome/chromedriver.exe");
WebDriver driver = new FirefoxDriver();
driver.manage().window().maximize();
driver.get("http://abcd:efgh@whatismyipaddress.com/");