• <bdo id='LlIpQ'></bdo><ul id='LlIpQ'></ul>
    1. <legend id='LlIpQ'><style id='LlIpQ'><dir id='LlIpQ'><q id='LlIpQ'></q></dir></style></legend>

      <small id='LlIpQ'></small><noframes id='LlIpQ'>

      <tfoot id='LlIpQ'></tfoot>

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

        如何使用带有 python、selenium 和 chromedriver 的 Bra

        时间:2023-10-08

            <tfoot id='5xuQV'></tfoot>

            <small id='5xuQV'></small><noframes id='5xuQV'>

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

                  <tbody id='5xuQV'></tbody>

              1. <legend id='5xuQV'><style id='5xuQV'><dir id='5xuQV'><q id='5xuQV'></q></dir></style></legend>
                  <bdo id='5xuQV'></bdo><ul id='5xuQV'></ul>
                • 本文介绍了如何使用带有 python、selenium 和 chromedriver 的 Brave 网络浏览器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  我从 Google 的 Chrome 切换到 Brave 网络浏览器,并且很难让它与 Brave 类似的浏览器一起使用用 Chrome 做了.Brave 是基于铬的,所以我猜它不应该那么难.我确保我的 Brave 和 Chromedriver 使用相同的版本,像这样,

                  I switched from Google's Chrome to Brave web browser and am having a hard time getting it to work with Brave like it did with Chrome. Brave is based on chromium so I guessed it should not be that hard. I made sure that my Brave and Chromedriver are on the same version like this,

                  ~/some/path $ chromedriver --version
                  ChromeDriver 76.0.3809.126 (d80a294506b4c9d18015e755cee48f953ddc3f2f-refs/branch-heads/3809@{#1024})
                  

                  我的chromedriver也在/user/bin,

                  My chromedriver is also in /user/bin,

                  ~/path $ cd /usr/bin/
                  /usr/bin $ ls | grep chromedriver
                  chromedriver 
                  

                  为了检查 Brave 版本,我得到:Version 0.68.132 Chromium: 76.0.3809.132 (Official Build) (64-bit)

                  And to check the Brave version, I get: Version 0.68.132 Chromium: 76.0.3809.132 (Official Build) (64-bit)

                  然后我运行这段代码,

                  from selenium import webdriver
                  
                  driver = webdriver.Chrome(executable_path='/usr/bin/brave-browser')
                  driver.get("http://www.python.org")
                  driver.close()
                  

                  这会打开一个 Brave 窗口,但随后会引发异常,而不是获取驱动程序指向的页面,

                  This opens a Brave window but then instead of getting the page the driver is pointed to, an exception is thrown,

                  Traceback (most recent call last):
                    File "webscrap.py", line 3, in <module>
                      driver = webdriver.Chrome(executable_path='/usr/bin/brave-browser')
                    File "/home/username/.local/lib/python3.6/site-packages/selenium/webdriver/chrome/webdriver.py", line 73, in __init__
                      self.service.start()
                    File "/home/username/.local/lib/python3.6/site-packages/selenium/webdriver/common/service.py", line 98, in start
                      self.assert_process_still_running()
                    File "/home/username/.local/lib/python3.6/site-packages/selenium/webdriver/common/service.py", line 111, in assert_process_still_running
                      % (self.path, return_code)
                  selenium.common.exceptions.WebDriverException: Message: Service /usr/bin/brave-browser unexpectedly exited. Status code was: -11
                  

                  推荐答案

                  我终于成功了:

                  试试这个python脚本(python3.7)

                  Try this python script (python3.7)

                  from selenium import webdriver
                  
                  driver_path = "C:/Users/username/PycharmProjects/chromedriver.exe"
                  brave_path = "C:/Program Files (x86)/BraveSoftware/Brave-Browser/Application/brave.exe"
                  
                  option = webdriver.ChromeOptions()
                  option.binary_location = brave_path
                  # option.add_argument("--incognito") OPTIONAL
                  # option.add_argument("--headless") OPTIONAL
                  
                  # Create new Instance of Chrome
                  browser = webdriver.Chrome(executable_path=driver_path, chrome_options=option)
                  
                  browser.get("https://www.google.es")
                  

                  干杯.

                  这篇关于如何使用带有 python、selenium 和 chromedriver 的 Brave 网络浏览器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:如何解决此问题元素不可交互的 Selenium Python 下一篇:如何在每个请求上使用 selenium python 轮换各种用户

                  相关文章

                  最新文章

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

                    <small id='E2ddS'></small><noframes id='E2ddS'>