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

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

        • <bdo id='1ZfM6'></bdo><ul id='1ZfM6'></ul>

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

        <tfoot id='1ZfM6'></tfoot>

        selenium.common.exceptions.WebDriverException:消息:未知错误

        时间:2023-10-08
        • <small id='7J8rF'></small><noframes id='7J8rF'>

          • <bdo id='7J8rF'></bdo><ul id='7J8rF'></ul>
          • <legend id='7J8rF'><style id='7J8rF'><dir id='7J8rF'><q id='7J8rF'></q></dir></style></legend>

                <tbody id='7J8rF'></tbody>

                  <tfoot id='7J8rF'></tfoot>
                  <i id='7J8rF'><tr id='7J8rF'><dt id='7J8rF'><q id='7J8rF'><span id='7J8rF'><b id='7J8rF'><form id='7J8rF'><ins id='7J8rF'></ins><ul id='7J8rF'></ul><sub id='7J8rF'></sub></form><legend id='7J8rF'></legend><bdo id='7J8rF'><pre id='7J8rF'><center id='7J8rF'></center></pre></bdo></b><th id='7J8rF'></th></span></q></dt></tr></i><div id='7J8rF'><tfoot id='7J8rF'></tfoot><dl id='7J8rF'><fieldset id='7J8rF'></fieldset></dl></div>
                  本文介绍了selenium.common.exceptions.WebDriverException:消息:未知错误:无法使用 ChromeDriver 使用 Selenium Python 创建 Chrome 进程的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  我正在尝试使用 selenium 单击一个按钮,所以我让它找到了带有 xpath 的元素,因为我找不到 id .我不认为其余的代码与它有任何关系,但我添加它以防万一

                  I am trying to click a button using selenium so I made it find the element with the xpath since i couldn't find the id . I didn't think the rest of the code had anything to do with it but i added it just in case

                  这是密码

                  import requests
                  import os
                  import selenium
                  from selenium import webdriver
                  os.system("cls")
                  print("                                         ")
                  print("______________     _____________         ________________")
                  print("| |         | |    |  |       | |        |______________|")
                  print("| |________ //     |  |  __   | |               | |")
                  print("| |________ \\     |  | |__|  | |               | |")
                  print("| |          | |   |  |       | |               | |")
                  print("| |__________| |   |__|_______|_|               |_|")
                  
                  print("u001b[34m Welcome To Movie Downloader")
                  print("u001b[31m Please Make Sure To Not Put Every First Letter In Every Word Capital And Also Make Sure To Put Hyphens Instead Of Spaces Between Words, Also Put The Date The Movie Was Made")
                  print("u001b[32m For Example: spider-man-homecoming-2017")
                  
                  
                  def Bot():
                      URL = input("u001b[34m What Movie Do You Want To Download:
                  ")
                      r = requests.get("https://bila.egy.best/movie/" + URL + "/?ref=search-p1")
                      if r.status_code == 200:
                          print("u001b[32m The Url Is Valid | Movie Has Been Found")
                      else:
                          print("u001b[31m The Url Is Invalid")
                      print("u001b[0m")
                      driver = webdriver.Chrome(executable_path=r'C:chromedriver.exe')
                      driver.get("https://bila.egy.best/movie/" + URL + "/?ref=search-p1")
                      driver.find_element_by_xpath("//*[@id=watch_dl]/table/tbody/tr[2]/td[4]/a[1]").click()
                  Answer = input("Would You Like To Bot?")
                  if Answer == "Yes" or "yes" or "sure" or "Sure":
                      Bot()
                  

                  这是错误

                  Traceback (most recent call last):
                    File "Movie_Download.py", line 32, in <module>
                      Bot()
                    File "Movie_Download.py", line 27, in Bot
                      driver = webdriver.Chrome(executable_path="C:chromedriver.exe")
                    File "C:Program Files (x86)Microsoft Visual StudioSharedPython37_64libsite-packagesseleniumwebdriverchromewebdriver.py", line 81, in __init__
                      desired_capabilities=desired_capabilities)
                    File "C:Program Files (x86)Microsoft Visual StudioSharedPython37_64libsite-packagesseleniumwebdriver
                  emotewebdriver.py", line 157, in __init__
                      self.start_session(capabilities, browser_profile)
                    File "C:Program Files (x86)Microsoft Visual StudioSharedPython37_64libsite-packagesseleniumwebdriver
                  emotewebdriver.py", line 252, in start_session
                      response = self.execute(Command.NEW_SESSION, parameters)
                    File "C:Program Files (x86)Microsoft Visual StudioSharedPython37_64libsite-packagesseleniumwebdriver
                  emotewebdriver.py", line 321, in execute
                      self.error_handler.check_response(response)
                    File "C:Program Files (x86)Microsoft Visual StudioSharedPython37_64libsite-packagesseleniumwebdriver
                  emoteerrorhandler.py", line 242, in check_response
                      raise exception_class(message, screen, stacktrace)
                  selenium.common.exceptions.WebDriverException: Message: unknown error: Failed to create a Chrome process.
                  

                  推荐答案

                  你需要注意几件事:

                  • 在传递 chromedriver 二进制文件的 绝对位置 时,使用单个正斜杠以及原始的即 r 开关.所以有效的代码行将是:

                  • While passing the absolute location of chromedriver binary use a single forward slash along with the raw i.e. r switch. So the effective line of code will be:

                  driver = webdriver.Chrome(executable_path=r'C:chromedriver.exe')
                  

                1. 非管理员/非root用户身份执行您的@Test.

                  另一个可能的原因是 Chrome 没有按照规范安装在默认位置:

                  Another possible reason is Chrome is not installed in the default location as per the specification:

                  有两种方法可以解决这种情况:

                  There can be two approaches to solve this situation:

                  • 卸载 Chrome 并在默认位置重新安装 Chrome.
                  • 使用 binary_location 属性指向 chrome 二进制位置.

                  • Uninstall Chrome and reinstall Chrome at default location.
                  • Use binary_location property to point to the chrome binary location.

                  from selenium import webdriver
                  from selenium.webdriver.chrome.options import Options
                  
                  options = Options()
                  options.binary_location = "C:/Program Files (x86)/Google/Chrome/Application/chrome.exe"
                  driver = webdriver.Chrome(chrome_options=options, executable_path="C:/Utility/BrowserDrivers/chromedriver.exe", )
                  driver.get('http://google.com/')
                  

                2. 这篇关于selenium.common.exceptions.WebDriverException:消息:未知错误:无法使用 ChromeDriver 使用 Selenium Python 创建 Chrome 进程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:WebDriverException:消息:服务/usr/bin/google-chrome 意外退 下一篇:未知错误:chrome 无法启动

                  相关文章

                  最新文章

                3. <tfoot id='VwhmL'></tfoot>
                4. <small id='VwhmL'></small><noframes id='VwhmL'>

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

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