简体   繁体   English

selenium.common.exceptions.WebDriverException:消息:使用 Selenium 和 Chromedriver 通过 Python 的目标框架分离错误

[英]selenium.common.exceptions.WebDriverException: Message: target frame detached error using Selenium and Chromedriver via Python

I am doing by parsing program using Python and Selenium.我正在使用 Python 和 Selenium 解析程序。

There is error:有错误:

Traceback (most recent call last):
  File "/Users//Desktop/babushkabot.py", line 123, in <module>
    bot.polling()
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/telebot/__init__.py", line 658, in polling
    self.__threaded_polling(non_stop, interval, timeout, long_polling_timeout, allowed_updates)
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/telebot/__init__.py", line 720, in __threaded_polling
    raise e
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/telebot/__init__.py", line 680, in __threaded_polling
    self.worker_pool.raise_exceptions()
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/telebot/util.py", line 135, in raise_exceptions
    raise self.exception_info
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/telebot/util.py", line 87, in run
    task(*args, **kwargs)
  File "/Users//Desktop/babushkabot.py", line 61, in callback_inline_tomato
    driver.get(url[0])
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/selenium/webdriver/remote/webdriver.py", line 437, in get
    self.execute(Command.GET, {'url': url})
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/selenium/webdriver/remote/webdriver.py", line 425, in execute
    self.error_handler.check_response(response)
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/selenium/webdriver/remote/errorhandler.py", line 247, in check_response
    raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message: target frame detached
  (Session info: chrome=100.0.4896.75)
Stacktrace:
0   chromedriver                        0x00000001053db3d9 chromedriver + 5104601
1   chromedriver                        0x000000010536bbf3 chromedriver + 4647923
2   chromedriver                        0x0000000104f5c9ff chromedriver + 391679
3   chromedriver                        0x0000000104f47a5c chromedriver + 305756
4   chromedriver                        0x0000000104f46b6a chromedriver + 301930
5   chromedriver                        0x0000000104f4706c chromedriver + 303212
6   chromedriver                        0x0000000104f46fc4 chromedriver + 303044
7   chromedriver                        0x0000000104f4dc82 chromedriver + 330882
8   chromedriver                        0x0000000104f4df42 chromedriver + 331586
9   chromedriver                        0x0000000104f48358 chromedriver + 308056
10  chromedriver                        0x0000000104f48918 chromedriver + 309528
11  chromedriver                        0x0000000104f486ca chromedriver + 308938
12  chromedriver                        0x0000000104f47c67 chromedriver + 306279
13  chromedriver                        0x0000000104f47423 chromedriver + 304163
14  chromedriver                        0x0000000104f637fa chromedriver + 419834
15  chromedriver                        0x0000000104fc249d chromedriver + 808093
16  chromedriver                        0x0000000104faf5b3 chromedriver + 730547
17  chromedriver                        0x0000000104f85139 chromedriver + 557369
18  chromedriver                        0x0000000104f86165 chromedriver + 561509
19  chromedriver                        0x000000010539a39d chromedriver + 4838301
20  chromedriver                        0x00000001053b2cde chromedriver + 4938974
21  chromedriver                        0x00000001053b7b5e chromedriver + 4959070
22  chromedriver                        0x00000001053b394a chromedriver + 4942154
23  chromedriver                        0x000000010538f33c chromedriver + 4793148
24  chromedriver                        0x00000001053cd3b8 chromedriver + 5047224
25  chromedriver                        0x00000001053cd53f chromedriver + 5047615
26  chromedriver                        0x00000001053e2705 chromedriver + 5134085
27  libsystem_pthread.dylib             0x00007ff800b55514 _pthread_start + 125
28  libsystem_pthread.dylib             0x00007ff800b5102f thread_start + 15 

Version of Chrome driver is 100.0.4896.60 Chrome 驱动程序版本为 100.0.4896.60
Version of Google Chrome 100.0.4896.75谷歌浏览器版本 100.0.4896.75

If someone could help me to resolve this question, gonna be awesome!如果有人能帮我解决这个问题,那就太棒了!

target frame detached error occurs when the HttpServerResponseInfo contains HTTP_NOT_FOUND and a couple of approaches to address this error are as follows:HttpServerResponseInfo包含HTTP_NOT_FOUND时会发生target frame detached错误,解决此错误的几种方法如下:

  • To switch Selenium's focus within an <iframe> you have to induce WebDriverWait for the frame_to_be_available_and_switch_to_it() as follows:要在<iframe>中切换 Selenium 的焦点,您必须为frame_to_be_available_and_switch_to_it()引入WebDriverWait ,如下所示:

     WebDriverWait(driver, 20).until(EC.frame_to_be_available_and_switch_to_it((By.CSS_SELECTOR,"iframeCssSelector")))
  • Ensure that as you are using chrome=100.0.4896.75 you have downloaded and configured the matching chromedriver=100.0.4896.60确保在使用chrome=100.0.4896.75时,您已经下载并配置了匹配的chromedriver=100.0.4896.60

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 selenium.common.exceptions.WebDriverException: 消息:无法通过 Selenium Python 使用 ChromeDriver Chrome 连接到服务错误 - selenium.common.exceptions.WebDriverException: Message: Can not connect to the Service error using ChromeDriver Chrome through Selenium Python selenium.common.exceptions.WebDriverException:消息:已断开连接:通过Python通过ChromeDriver和Selenium收到了Inspector.detached事件 - selenium.common.exceptions.WebDriverException: Message: disconnected: received Inspector.detached event with ChromeDriver and Selenium through Python selenium.common.exceptions.WebDriverException:消息:未知错误:Chrome 无法启动:在 Python 中使用 ChromeDriver 和 Selenium 崩溃 - selenium.common.exceptions.WebDriverException: Message: unknown error: Chrome failed to start: crashed with ChromeDriver and Selenium in Python selenium.common.exceptions.WebDriverException:消息:未知错误:无法使用带有Selenium Python的ChromeDriver Chrome创建Chrome进程 - selenium.common.exceptions.WebDriverException: Message: unknown error: Failed to create Chrome process with ChromeDriver Chrome with Selenium Python selenium.common.exceptions.WebDriverException: Message: invalid session id using Selenium with ChromeDriver and Chrome through Python - selenium.common.exceptions.WebDriverException: Message: invalid session id using Selenium with ChromeDriver and Chrome through Python selenium.common.exceptions.WebDriverException:消息:“chromedriver”可执行文件需要在 PATH 中 - selenium.common.exceptions.WebDriverException: Message: 'chromedriver' executable needs to be in PATH selenium.common.exceptions.WebDriverException:消息:服务 chromedriver 意外退出 - selenium.common.exceptions.WebDriverException: Message: Service chromedriver unexpectedly exited selenium.common.exceptions.WebDriverException:消息:未知错误:无法使用 ChromeDriver Chrome Selenium 创建 Chrome 进程错误 - selenium.common.exceptions.WebDriverException: Message: unknown error: Failed to create a Chrome process error with ChromeDriver Chrome Selenium python, selenium, chromedriver &#39;selenium.common.exceptions.WebDriverException: 消息:无法访问 u&#39;chrome - python, selenium, chromedriver 'selenium.common.exceptions.WebDriverException: Message: u'chrome not reachable selenium.common.exceptions.WebDriverException:消息:未知错误:Chrome无法启动:使用ChromeDriver Chrome和Selenium异常退出 - selenium.common.exceptions.WebDriverException: Message: unknown error: Chrome failed to start: exited abnormally with ChromeDriver Chrome and Selenium
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM