I'm new to Selenium and trying to automate entering data. Im trying to grab the ID and then click the textbox to send data, but i keep getting an error message. I tried the Xpath also but it doesn't seem to be working.
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. When i called product.isdisplayed() it prints false.
<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.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.