简体   繁体   English

Python Selenium“元素不可交互”错误消息

[英]Python Selenium "element not interactable" error message

I'm new to Selenium and trying to automate entering data.我是 Selenium 的新手,并试图自动输入数据。 Im trying to grab the ID and then click the textbox to send data, but i keep getting an error message.我试图获取 ID,然后单击文本框发送数据,但我不断收到错误消息。 I tried the Xpath also but it doesn't seem to be working.我也试过 Xpath 但它似乎没有用。

here is my code.这是我的代码。

    product = driver.find_element_by_id("(improved-inventory/js/extension-providers/ItemComboBox_0)[2]")
    product.click()
    product.send_keys("027459087093")
    product.send_keys(Keys.RETURN)

Any Help would be Appreciated.任何帮助,将不胜感激。 Here is the HTML im currently taking the id from the input Class.这是 HTML 我当前从输入 Class 获取 id。 When i called product.isdisplayed() it prints false.当我调用 product.isdisplayed() 它打印错误。

<div class="dijitInline dijitTextBox dijitComboBox quickfill qfComboBox dijitValidationTextBox"
id="widget_improved-inventory/js/extension-providers/ItemComboBox_0" 
role="combobox" aria-haspopup="true" data-dojo-attach-point="_popupStateNode" widgetid="improved-inventory/js/extension-providers/ItemComboBox_0" 
aria-disabled="false" aria-owns="improved-inventory/js/extension-providers/ItemComboBox_0_popup" > == $0

<input class="dijitReset dijitInputInner" type="text" autocomplete="off" 
data-dojo-attach-point="textbox,focusNode" role ="textbox" placeholder="Enter   Text" 
tabindex="0" id="improved-inventory/js/extension-providers/ItemComboBox_0" value aria-label="Enter Text:" aria-invalid="false" aria-disabled="false">

Try waiting until input field is clickable:尝试等到输入字段可点击:

from selenium.webdriver.support.wait import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.common.by import By

wait = WebDriverWait(driver, timeout=30)
wait.until(EC.element_to_be_clickable((By.CSS_SELECTOR, ".dijitReset.dijitInputInner")))
product = driver.find_element_by_css_selector(".dijitReset.dijitInputInner")
product.click()
product.send_keys("027459087093")
product.send_keys(Keys.RETURN)

Also, fix your locator.另外,修复您的定位器。

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

相关问题 消息:元素在 Python Selenium 中不可交互 - Message: element not interactable in Python Selenium Python Selenium:消息:元素不可交互 - Python Selenium:Message: element not interactable selenium python 元素不可交互错误 - selenium python element not interactable error python selenium元素不可交互错误 - python selenium element not interactable error Python Selenium 错误:元素不可交互 - Python Selenium ERROR: element not interactable Python Selenium ChromeDriver 错误。 消息:元素不可交互 - Python Selenium ChromeDriver error. Message: element not interactable Python 中的 Selenium:ElementNotInteractableException:消息:元素不可交互 - Selenium in Python: ElementNotInteractableException: Message: element not interactable Python selenium ElementNotInteractableException:消息:元素不可交互 - Python selenium ElementNotInteractableException: Message: element not interactable selenium.common.exceptions.ElementNotVisibleException:消息:尝试使用Selenium Python单击元素时出现元素无法交互错误 - selenium.common.exceptions.ElementNotVisibleException: Message: element not interactable error when trying to click an element using Selenium Python python-selenium返回元素不可交互错误 - python-selenium returning element is not interactable error
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM