logo
Loading...

使用Selenium 出現Traceback Error - Cupoy

在D019的題目當中用到了Selenium但系統執行了範例後會不斷traceback,並出現以下的錯...

pycrawler,pycrawler-d19

使用Selenium 出現Traceback Error

2020/01/18 下午 10:37
Python網路爬蟲討論版
Wei-Shan Chang
觀看數:23
回答數:2
收藏數:1
pycrawler
pycrawler-d19

在D019的題目當中用到了Selenium

但系統執行了範例後會不斷traceback,並出現以下的錯誤訊息 (後面太長就沒複製過來了)

估狗之後有些建議是chrome的驅動程式需要安裝在python path之下

可是安裝之後仍無法正常使用,請問是否有其他可能解決的方法呢? 謝謝!

---------------------------------------------------------------------------
FileNotFoundError                         Traceback (most recent call last)
~\Anaconda3\lib\site-packages\selenium\webdriver\common\service.py in start(self)
    75                                             stderr=self.log_file,
---> 76                                             stdin=PIPE)
    77         except TypeError:

~\Anaconda3\lib\subprocess.py in __init__(self, args, bufsize, executable, stdin, stdout, stderr, preexec_fn, close_fds, shell, cwd, env, universal_newlines, startupinfo, creationflags, restore_signals, start_new_session, pass_fds, encoding, errors, text)
   774                                 errread, errwrite,
--> 775                                 restore_signals, start_new_session)
   776         except:

~\Anaconda3\lib\subprocess.py in _execute_child(self, args, executable, preexec_fn, close_fds, pass_fds, cwd, env, startupinfo, creationflags, shell, p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite, unused_restore_signals, unused_start_new_session)
  1177                                          os.fspath(cwd) if cwd is not None else None,
-> 1178                                          startupinfo)
  1179             finally:

FileNotFoundError: [WinError 2] The system cannot find the file specified

During handling of the above exception, another exception occurred:

WebDriverException                        Traceback (most recent call last)

回答列表

  • 2020/01/19 上午 00:58
    Felix
    贊同數:0
    不贊同數:0
    留言數:0

    有可能跟我遇到相同的問題,我先前遇到的問題是原本安裝Google Chrome跟後面升級版本後路徑不同,電腦中存在兩個新舊版本在不同的位置(ChromeDriver呼叫了原本Google Chrome安裝的預設路徑),可以查看電腦中是否存在多個版本,把舊的刪除即可...

  • 2020/01/20 下午 04:05
    張維元 (WeiYuan)
    贊同數:1
    不贊同數:0
    留言數:1

    這個是 driver 的問題沒錯,可以把你的程式碼貼上來嗎?