简体   繁体   English

运行此 python 代码时出现错误。 错误是“ElementNotInteractableException”。 任何人都可以帮助我吗?

[英]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.

相关问题 谁能帮我解决运行这个tensorflow程序时遇到的错误 - can anyone help me in resolving the error which I am getting while running this tensorflow program 运行这部分代码时出现错误。 尝试了一些现有的解决方案,但都没有帮助 - I am getting error while running this part of the code. tried some of the existing solutions, none of them helped 我在 python 的 if -else 程序中遇到编译错误。代码是用 Python 3 编写的,谁能帮帮我 - I am getting compilation error in if -else program in python .The code is written in Python 3, can anyone help me 我的 python 代码出现错误,你能帮我修复它吗? - i am getting an error in my python code can you help me fix it? 为什么我在应用此代码时收到此错误。 我在下面附上了错误和代码? - Why I am getting this error while applying this code. I have enclosed the error and code below? 您好,我收到此代码错误。 错误[列表索引超出范围] - hello, i am getting an error with this code. error [list index out of range] 你能帮我解决运行 Stringtie prepDE.py 后出现的错误吗? - Can you help me to resolve the error I am getting after running Stringtie prepDE.py? 我得到此python代码的NonType错误。 我该如何更改代码? - I am getting NonType error for this python code. How should I change my code? 我在pygame中创建移动平台时遇到了麻烦。 我遇到错误,有人可以帮我吗? - I am having trouble creating moving platforms in pygames. I am getting an error, can anyone help me out please? 为什么我收到 OmegaExpansion header 的 Python 模块错误。 谁能帮我? - why am i getting Python Module error for OmegaExpansion header. Can anyone help me?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM