How to handle authentication popup with Selenium WebDriver using Java

前端 未结 7 1939
伪装坚强ぢ
伪装坚强ぢ 2020-11-22 05:36

I\'m trying to handle authentication popup using the code below:

FirefoxProfile profile = new FirefoxProfile();
profile.setPreference(\"network.http.phishy-u         


        
7条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-11-22 06:04

    If you have to deal with NTLM proxy authentication a good alternative is to use a configure a local proxy using CNTLM.

    The credentials and domain are configured in /etc/cntlm.conf.

    Afterwards you can just use you own proxy that handles all the NTLM stuff.

    DesiredCapabilities capabilities = DesiredCapabilities.chrome();
    
    Proxy proxy = new Proxy();
    proxy.setHttpProxy("localhost:3128");
    capabilities.setCapability(CapabilityType.PROXY, proxy);
    
    driver = new ChromeDriver(capabilities);
    

提交回复
热议问题