代码之家  ›  专栏  ›  技术社区  ›  Michael

查找WebDriver使用的代理服务器

  •  0
  • Michael  · 技术社区  · 6 年前

    我使用代理运行Selenium WebDriver。

    chrome_options.add_argument('--proxy-server="'94.242.58.108:1448'"
    driver = Chrome(chrome_options=chrome_options)
    

    驱动程序知道它正在使用哪个代理服务器。 你能告诉我怎么找到用过的代理服务器吗?

    我在另一个函数中需要这个信息。

    1 回复  |  直到 6 年前
        1
  •  1
  •   murali selenium    6 年前

    参见Java文档 http://seleniumhq.github.io/selenium/docs/api/java/org/openqa/selenium/Proxy.html 我们有gethttpproxy()来检索代理。

    Proxy p=new Proxy(); // used at the start to set proxy and pass to chrome options and driver
    
    System.out.println(p.getHttpProxy()); // to get proxy when required.