Reputation:
Here is the page. It is necessary to pull out an input from it
<input id = "paymentAmount" class = "input-text pull-left" tabindex = "1" name = "paymentAmount" type = "text">
And enter another text into it.
I tried to do this through ID, through xpath, through @name. What could be the problem?
elem = WebDriverWait(driver, 20).until(EC.visibility_of_element_located(
(By.XPATH, "//input[contains(@id, 'paymentAmount')]")))
Upvotes: 0
Views: 113
Reputation: 12255
There's iFrame, you should switch to it, wait for loader to disappear, delete old value in the input and than set yours.
from selenium.webdriver.common.by import By
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
driver = webdriver.Chrome()
wait = WebDriverWait(driver, 20)
driver.get("https://www.xendpay.com/")
wait.until(EC.frame_to_be_available_and_switch_to_it((By.ID, "iFrameResizer0")))
wait.until(EC.invisibility_of_element_located((By.CLASS_NAME, "loader")))
payment_amount = wait.until(EC.element_to_be_clickable((By.ID, "paymentAmount")))
ActionChains(driver).double_click(payment_amount).send_keys(Keys.DELETE).send_keys("999").perform()
Upvotes: 1
Reputation: 83
got it:
driver.switch_to_frame("iFrameResizer0")
driver.find_elements_by_name('paymentAmount')
Upvotes: 0
Reputation: 6103
Your element is located in iframe html tag. You need to switch to the iframe (iFrameResizer0 in the link you provided):
driver.SwitchTo().Frame(driver.FindElement(By.Id("iFrameResizer0")));
... do your find here.
// switch back to default
driver.DefaultContent();
Upvotes: 1