Selenium - 浏览器无法打开

时间:2017-07-04 15:28:30

标签: python

我写了一个非常简单的代码。它应该打开一个Chrome浏览器窗口,但我收到一条错误消息。

这是我的代码

    from selenium import webdriver
chrome_path = "C:\\Users\\Admin\\Documents\\chromedriver"
driver = webdriver.Chrome(chrome_path)

这是我在shell中看到的错误

    Traceback (most recent call last):
  File "C:/Users/Admin/AppData/Local/Programs/Python/Python35-32/te.py", line 3, in <module>
    driver = webdriver.Chrome(chrome_path)
  File "C:\Users\Admin\AppData\Local\Programs\Python\Python35-32\lib\site-packages\selenium\webdriver\chrome\webdriver.py", line 62, in __init__
    self.service.start()
  File "C:\Users\Admin\AppData\Local\Programs\Python\Python35-32\lib\site-packages\selenium\webdriver\common\service.py", line 74, in start
    stdout=self.log_file, stderr=self.log_file)
  File "C:\Users\Admin\AppData\Local\Programs\Python\Python35-32\lib\subprocess.py", line 947, in __init__
    restore_signals, start_new_session)
  File "C:\Users\Admin\AppData\Local\Programs\Python\Python35-32\lib\subprocess.py", line 1224, in _execute_child
    startupinfo)
OSError: [WinError 193] %1 is not a valid Win32 application

知道这可能是什么吗?

1 个答案:

答案 0 :(得分:0)

您是否尝试过将.exe添加到路径?