Webdriver and proxy server for firefox

后端 未结 13 2364
清歌不尽
清歌不尽 2020-11-30 23:49

are there any ways to set firefox\'s proxy settings? I found here information about FoxyProxy but when Selenium works, plugins are unactivated in window.

13条回答
  •  误落风尘
    2020-12-01 00:04

    Just to add to the above given solutions.,

    Adding the list of possibilities (integer values) for the "network.proxy.type".

    0 - Direct connection (or) no proxy. 
    
    1 - Manual proxy configuration
    
    2 - Proxy auto-configuration (PAC).
    
    4 - Auto-detect proxy settings.
    
    5 - Use system proxy settings. 
    

    So, Based on our requirement, the "network.proxy.type" value should be set as mentioned below.

    FirefoxProfile profile = new FirefoxProfile();
    profile.setPreference("network.proxy.type", 1);
    WebDriver driver = new FirefoxDriver(profile);
    

提交回复
热议问题