Traceback (most recent call last): File "D:\pythonsthl\flaskProject\SeleniumTest\20Test1.py", line 17, in <module> search_input = driver.find_element(By.ID, "from_item_account") File "D:\pythonsthl\flaskProject\venv\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 740, in find_element return self.execute(Command.FIND_ELEMENT, {"using": by, "value": value})["value"] File "D:\pythonsthl\flaskProject\venv\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 346, in execute self.error_handler.check_response(response) File "D:\pythonsthl\flaskProject\venv\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 245, in check_response raise exception_class(message, screen, stacktrace) selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate element: {"method":"css selector","selector":"[id="from_item_account"]"} (Session info: chrome=115.0.5790.99); For documentation on this error, please visit: https://www.selenium.dev/documentation/webdriver/troubleshooting/errors#no-such-element-exception Stacktrace: Backtrace: GetHandleVerifier [0x00D8A813+48355] (No symbol) [0x00D1C4B1] (No symbol) [0x00C25358] (No symbol) [0x00C509A5] (No symbol) [0x00C50B3B] (No symbol) [0x00C7E232] (No symbol) [0x00C6A784] (No symbol) [0x00C7C922] (No symbol) [0x00C6A536] (No symbol) [0x00C482DC] (No symbol) [0x00C493DD] GetHandleVerifier [0x00FEAABD+2539405] GetHandleVerifier [0x0102A78F+2800735] GetHandleVerifier [0x0102456C+2775612] GetHandleVerifier [0x00E151E0+616112] (No symbol) [0x00D25F8C] (No symbol) [0x00D22328] (No symbol) [0x00D2240B] (No symbol) [0x00D14FF7] BaseThreadInitThunk [0x75A77D59+25] RtlInitializeExceptionChain [0x76EDB79B+107] RtlClearBits [0x76EDB71F+191] Process finished with exit code 1
时间: 2024-01-20 11:03:52 浏览: 59
Python3+selenium配置常见报错解决方案
5星 · 资源好评率100%
这个错误是由于找不到指定的元素导致的。根据错误信息,它无法定位到id为"from_item_account"的元素。
这可能是由于以下原因导致的:
1. 页面上没有具有该id的元素。请确保页面上存在具有"id"为"from_item_account"的元素。
2. 元素可能在iframe或者其他frame中,因此无法直接访问。如果元素在frame中,请先切换到相应的frame再进行元素定位。
3. 元素可能是通过动态加载或延迟加载生成的。在进行元素定位之前,可以尝试添加适当的等待时间或条件来确保元素已经加载完毕。
你可以检查这些可能性,并相应地调整你的代码来解决这个问题。如果需要更多帮助,请提供更多信息,我会尽力帮助你解决问题。
阅读全文