[英]I am getting error while running this python code. The error is “ElementNotInteractableException”. Can any on help me out?
I want to open student login from this website: https://exams.mlrinstitutions.ac.in/ open website-->click on 'Logins'-->click on 'Student Login'我想从这个网站打开学生登录: https://exams.mlrinstitutions.ac.in/打开网站-->点击“登录”-->点击“学生登录”
This code is working fine up to the opening and clicking Logins.此代码在打开并单击登录之前都可以正常工作。 But when the code clicks on 'Student Login' it is encountering an error.
但是当代码点击“学生登录”时,它会遇到错误。
For HTML code please open the webpage and use inspect elements.对于 HTML 代码,请打开网页并使用检查元素。
CODE代码
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
path = "C:\Program Files (x86)\chromedriver.exe"
driver = webdriver.Chrome(executable_path=path)
driver.get("https://exams.mlrinstitutions.ac.in/")
first = WebDriverWait(driver, 60).until(
EC.presence_of_element_located((By.ID, "lnkLogins"))
)
first.click()
first = WebDriverWait(driver, 60).until(
EC.presence_of_element_located((By.ID, "lnkStudent"))
)
first.click()
ERROR错误
DevTools listening on ws://127.0.0.1:55873/devtools/browser/0977ccf6-90ba-4f79-b746-e8ff53bd4035
Traceback (most recent call last):
File "c:\Users\dile2\OneDrive\Desktop\mini\sel.py", line 19, in <module>
first.click()
File "C:\Users\dile2\Python39\lib\site-packages\selenium\webdriver\remote\webelement.py", line 80, in click
self._execute(Command.CLICK_ELEMENT)
File "C:\Users\dile2\Python39\lib\site-packages\selenium\webdriver\remote\webelement.py", line 633, in _execute
return self._parent.execute(command, params)
[13984:14080:0210/201137.350:ERROR:device_event_log_impl.cc(211)] [20:11:37.349] USB: usb_device_handle_win.cc:1049 Failed to read descriptor from node connection: A device attached to the system is not functioning. (0x1F)
File "C:\Users\dile2\Python39\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 321, in execute
self.error_handler.check_response(response)
File "C:\Users\dile2\Python39\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 242, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.ElementNotInteractableException: Message: element not interactable
(Session info: chrome=88.0.4324.150)
Instead of presence_of_element_located()
use element_to_be_clickable()
而不是 present_of_element_located(
presence_of_element_located()
使用element_to_be_clickable()
driver.get("https://exams.mlrinstitutions.ac.in/")
first = WebDriverWait(driver, 60).until(EC.element_to_be_clickable((By.ID, "lnkLogins")))
first.click()
first = WebDriverWait(driver, 60).until(EC.element_to_be_clickable((By.ID, "lnkStudent")))
first.click()
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.