JunTingLin / shopee_crawler

1 stars 0 forks source link

請問為何出現這個錯誤? #2

Closed arguskao closed 1 year ago

arguskao commented 1 year ago

Traceback (most recent call last): File "/Users/user/Dropbox/Code/python/爬蟲/shopee/shopee_crawler/shapee.py", line 67, in for block in driver.find_elements(by=By.XPATH, value='//*[@data-sqe="item"]'): ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/selenium/webdriver/remote/webdriver.py", line 769, in find_elements return self.execute(Command.FIND_ELEMENTS, {"using": by, "value": value})["value"] or [] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/selenium/webdriver/remote/webdriver.py", line 345, in execute self.error_handler.check_response(response) File "/usr/local/lib/python3.11/site-packages/selenium/webdriver/remote/errorhandler.py", line 229, in check_response raise exception_class(message, screen, stacktrace) selenium.common.exceptions.NoSuchWindowException: Message: no such window: target window already closed from unknown error: web view not found (Session info: chrome=116.0.5845.96)

arguskao commented 1 year ago

我解決了

JunTingLin commented 1 year ago

我沒有很詳細看錯誤原因,但看到是跟webdriver相關, 可以試著將 service = ChromeService('chromedriver-win64/chromedriver.exe') 替換成 service = ChromeService(executable_path=ChromeDriverManager().install()) 這樣就不需要自己下載ChromeDriver相關套件放在根目錄下了,ChromeDriverManager會幫你處理好

以上 希望我的程式有幫助到你👍

arguskao commented 1 year ago

果然這樣就成功了,請問您能讓我贊助您一點錢嗎? 這程式真的太棒了

雖然我還在研究中

JunTingLin @.***> 於 2023年8月24日 週四 下午7:40寫道:

我沒有很詳細看錯誤原因,但看到是跟webdriver相關, 可以試著將 service = ChromeService('chromedriver-win64/chromedriver.exe') 替換成 service = ChromeService(executable_path=ChromeDriverManager().install()) 這樣就不需要自己下載ChromeDriver相關套件放在根目錄下了,ChromeDriverManager會幫你處理好

以上 希望我的程式有幫助到你👍

— Reply to this email directly, view it on GitHub https://github.com/JunTingLin/shopee_crawler/issues/2#issuecomment-1691516568, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAIPUEVFEX25KEUAPW5QGR3XW44RPANCNFSM6AAAAAA34IOPQM . You are receiving this because you modified the open/close state.Message ID: @.***>

-- 電話:0980347570 LIne: arguskao 想要憑一己之力改變台灣現在的醫療問題 活力藥師網 http://www.liverx.net

arguskao commented 1 year ago

您的程式太棒了

我能贊助您一點錢嗎?