【发布时间】:2022-09-30 19:51:15
【问题描述】:
无法在该字段中输入电子邮件 ID 可以帮助我解决这些错误。[代码错误2
serviceC = Service(r\"C:\\chromedriver_win32\\chromedriver.exe\")
driver = webdriver.Chrome(service=serviceC)
# My gmail credentials
my_username = \"my_mail_id@fake.com\"
my_password = \"mypassword\"
# open Wev.flock.com login
driver.get(\"http://web.flock.com\")
print(\"Website link\")
driver.implicitly_wait(10)
# Get started With Flock
Enter_email_id = driver.find_element(By.XPATH, \'//*[@id=\"widgets_InputBox_0\"]/input\')
# XPATH = \'//*[@id=\"widgets_InputBox_0\"]/input\'
# Full XPATH = \'/html/body/div[3]/div/div[1]/div/div/div[3]/div[3]/input\'
Enter_email_id.send_keys(my_username)
# automatically close the driver after 30 seconds
time.sleep(30)
driver.close()
下面我通过终端附加输出 主要问题是我无法找到输入字段的正确地址selenium.common.exceptions.NoSuchElementException:消息:没有这样的元素:无法找到元素:{\"method\":\"xpath\",\"selector\":\"//*[@id=\"widgets_InputBox_0 \“]/输入\”}
任何帮助,将不胜感激
DevTools listening on ws://127.0.0.1:55084/devtools/browser/fa303344-68e7-4306-a7fd-511ef7d18a15
Website link
[1676:6032:0925/155230.539:ERROR:device_event_log_impl.cc(214)] [15:52:30.540] USB: usb_service_win.cc:415 Could not read device interface GUIDs: The system cannot find the file specified. (0x2)
[1676:6032:0925/155230.540:ERROR:device_event_log_impl.cc(214)] [15:52:30.540] USB: usb_device_handle_win.cc:1048 Failed to read descriptor from node connection: A device attached to the system is not functioning. (0x1F)
[1676:6032:0925/155230.541:ERROR:device_event_log_impl.cc(214)] [15:52:30.542] USB: usb_device_handle_win.cc:1048 Failed to read descriptor from node connection: A device attached to the system is not functioning. (0x1F)
Traceback (most recent call last):
File \"d:\\Projects\\FlockAutomation.py\", line 22, in <module>
Enter_email_id = driver.find_element(By.XPATH, \'//*[@id=\"widgets_InputBox_0\"]/input\')
File \"C:\\Users\\itadmin\\AppData\\Local\\Programs\\Python\\Python310\\lib\\site-packages\\selenium\\webdriver\\remote\\webdriver.py\", line 855, in find_element
return self.execute(Command.FIND_ELEMENT, {
File \"C:\\Users\\itadmin\\AppData\\Local\\Programs\\Python\\Python310\\lib\\site-packages\\selenium\\webdriver\\remote\\webdriver.py\", line 428, in execute
self.error_handler.check_response(response)
File \"C:\\Users\\itadmin\\AppData\\Local\\Programs\\Python\\Python310\\lib\\site-packages\\selenium\\webdriver\\remote\\errorhandler.py\", line 243, in check_response
raise exception_class(message, screen, stacktrace)
**selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate element: {\"method\":\"xpath\",\"selector\":\"//*[@id=\"widgets_InputBox_0\"]/input\"}**
(Session info: chrome=105.0.5195.127)
Stacktrace:
Backtrace:
Ordinal0 [0x007BDF13+2219795]
Ordinal0 [0x00752841+1779777]
Ordinal0 [0x0066423D+803389]
Ordinal0 [0x00693025+995365]
Ordinal0 [0x006931EB+995819]
Ordinal0 [0x006C0F52+1183570]
Ordinal0 [0x006AE844+1108036]
Ordinal0 [0x006BF192+1175954]
Ordinal0 [0x006AE616+1107478]
Ordinal0 [0x00687F89+950153]
Ordinal0 [0x00688F56+954198]
GetHandleVerifier [0x00AB2CB2+3040210]
GetHandleVerifier [0x00AA2BB4+2974420]
GetHandleVerifier [0x00856A0A+565546]
GetHandleVerifier [0x00855680+560544]
Ordinal0 [0x00759A5C+1808988]
Ordinal0 [0x0075E3A8+1827752]
Ordinal0 [0x0075E495+1827989]
Ordinal0 [0x007680A4+1867940]
BaseThreadInitThunk [0x75B46739+25]
RtlGetFullPathName_UEx [0x76FD8FD2+1218]
RtlGetFullPathName_UEx [0x76FD8F9D+1165]
标签: python selenium selenium-webdriver