Webdriver and proxy server for firefox

后端 未结 13 2389
清歌不尽
清歌不尽 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-11-30 23:57

    I just had fun with this issue for a couple of days and it was hard for me to find an answer for HTTPS, so here's my take, for Java:

        FirefoxProfile profile = new FirefoxProfile();
        profile.setPreference("network.proxy.type", 1);
        profile.setPreference("network.proxy.http", "proxy.domain.example.com");
        profile.setPreference("network.proxy.http_port", 8080);
        profile.setPreference("network.proxy.ssl", "proxy.domain.example.com");
        profile.setPreference("network.proxy.ssl_port", 8080);
        driver = new FirefoxDriver(profile);
    

    Gotchas here: enter just the domain and not http://proxy.domain.example.com, the property name is .ssl and not .https

    I'm now having even more fun trying to get it to accept my self signed certificates...

提交回复
热议问题