<i id='1uQ3m'><tr id='1uQ3m'><dt id='1uQ3m'><q id='1uQ3m'><span id='1uQ3m'><b id='1uQ3m'><form id='1uQ3m'><ins id='1uQ3m'></ins><ul id='1uQ3m'></ul><sub id='1uQ3m'></sub></form><legend id='1uQ3m'></legend><bdo id='1uQ3m'><pre id='1uQ3m'><center id='1uQ3m'></center></pre></bdo></b><th id='1uQ3m'></th></span></q></dt></tr></i><div id='1uQ3m'><tfoot id='1uQ3m'></tfoot><dl id='1uQ3m'><fieldset id='1uQ3m'></fieldset></dl></div>

<small id='1uQ3m'></small><noframes id='1uQ3m'>

    <bdo id='1uQ3m'></bdo><ul id='1uQ3m'></ul>
  • <tfoot id='1uQ3m'></tfoot>

      1. <legend id='1uQ3m'><style id='1uQ3m'><dir id='1uQ3m'><q id='1uQ3m'></q></dir></style></legend>

        如何在 python webdriver 中为 chrome 设置代理?

        How do I set proxy for chrome in python webdriver?(如何在 python webdriver 中为 chrome 设置代理?)
      2. <small id='zmcMg'></small><noframes id='zmcMg'>

          <bdo id='zmcMg'></bdo><ul id='zmcMg'></ul>

              <tbody id='zmcMg'></tbody>

            • <tfoot id='zmcMg'></tfoot><legend id='zmcMg'><style id='zmcMg'><dir id='zmcMg'><q id='zmcMg'></q></dir></style></legend>

              • <i id='zmcMg'><tr id='zmcMg'><dt id='zmcMg'><q id='zmcMg'><span id='zmcMg'><b id='zmcMg'><form id='zmcMg'><ins id='zmcMg'></ins><ul id='zmcMg'></ul><sub id='zmcMg'></sub></form><legend id='zmcMg'></legend><bdo id='zmcMg'><pre id='zmcMg'><center id='zmcMg'></center></pre></bdo></b><th id='zmcMg'></th></span></q></dt></tr></i><div id='zmcMg'><tfoot id='zmcMg'></tfoot><dl id='zmcMg'><fieldset id='zmcMg'></fieldset></dl></div>
                  本文介绍了如何在 python webdriver 中为 chrome 设置代理?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我正在使用此代码:

                  profile = webdriver.FirefoxProfile()
                  profile.set_preference("network.proxy.type", 1)
                  profile.set_preference("network.proxy.http", "proxy.server.address")
                  profile.set_preference("network.proxy.http_port", "port_number")
                  profile.update_preferences()
                  driver = webdriver.Firefox(firefox_profile=profile)
                  

                  在 python webdriver 中为 FF 设置代理.这适用于FF.如何在 Chrome 中设置这样的代理?我发现这个 exmaple 但不是很有帮助.当我运行脚本时没有任何反应(Chrome 浏览器未启动).

                  to set proxy for FF in python webdriver. This works for FF. How to set proxy like this in Chrome? I found this exmaple but is not very helpful. When I run the script nothing happens (Chrome browser is not started).

                  推荐答案

                  from selenium import webdriver
                  
                  PROXY = "23.23.23.23:3128" # IP:PORT or HOST:PORT
                  
                  chrome_options = webdriver.ChromeOptions()
                  chrome_options.add_argument('--proxy-server=%s' % PROXY)
                  
                  chrome = webdriver.Chrome(options=chrome_options)
                  chrome.get("http://whatismyipaddress.com")
                  

                  这篇关于如何在 python webdriver 中为 chrome 设置代理?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  env: python: No such file or directory(env: python: 没有这样的文件或目录)
                  How to evaluate environment variables into a string in Python?(如何在 Python 中将环境变量评估为字符串?)
                  Python - temporarily modify the current process#39;s environment(Python - 临时修改当前进程的环境)
                  Change current process environment#39;s LD_LIBRARY_PATH(更改当前进程环境的 LD_LIBRARY_PATH)
                  Reading and writing environment variables in Python?(在 Python 中读写环境变量?)
                  When to use sys.path.append and when modifying %PYTHONPATH% is enough(何时使用 sys.path.append 以及何时修改 %PYTHONPATH% 就足够了)
                    <legend id='967Eg'><style id='967Eg'><dir id='967Eg'><q id='967Eg'></q></dir></style></legend>

                    <small id='967Eg'></small><noframes id='967Eg'>

                      <tfoot id='967Eg'></tfoot>

                        <i id='967Eg'><tr id='967Eg'><dt id='967Eg'><q id='967Eg'><span id='967Eg'><b id='967Eg'><form id='967Eg'><ins id='967Eg'></ins><ul id='967Eg'></ul><sub id='967Eg'></sub></form><legend id='967Eg'></legend><bdo id='967Eg'><pre id='967Eg'><center id='967Eg'></center></pre></bdo></b><th id='967Eg'></th></span></q></dt></tr></i><div id='967Eg'><tfoot id='967Eg'></tfoot><dl id='967Eg'><fieldset id='967Eg'></fieldset></dl></div>

                          • <bdo id='967Eg'></bdo><ul id='967Eg'></ul>
                              <tbody id='967Eg'></tbody>