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