[英]I can't fill card data in selenium python
Hi guess, today I struggled with a problem I cant fill card data.嗨猜,今天我遇到了一个我无法填写卡片数据的问题。 https://i.stack.imgur.com/VzN22.png As I understood it appears cuz of nested html(html in html I'm not good in eng).
https://i.stack.imgur.com/VzN22.png据我了解,它似乎是嵌套 html 的原因(html 中的 html 我不擅长英语)。 So what do u supposed to do?
那你该怎么办?
I tried to fill it by id, full xpath, selector etc...我试图用 id、完整的 xpath、选择器等来填充它...
Nothing works.没有任何效果。
Some code what I used我使用的一些代码
WebDriverWait(driver, 20).until(EC.element_to_be_clickable((By.ID, "cardCvc-input"))).send_keys("1234")
data.数据。 https://i.stack.imgur.com/VzN22.png
https://i.stack.imgur.com/VzN22.png
You need to switch to iframe
first to access the element.The input
element present inside an iframe
.您需要先切换到
iframe
才能访问该元素。 iframe
中存在的input
元素。
Induce WebDriverWait
() and frame_to_be_available_and_switch_to_it
() and following css
selector.引出
WebDriverWait
() 和frame_to_be_available_and_switch_to_it
() 并遵循css
选择器。
WebDriverWait(driver,10).until(EC.frame_to_be_available_and_switch_to_it((By.CSS_SELECTOR,"iframe[title='payment']")))
WebDriverWait(driver, 20).until(EC.element_to_be_clickable((By.ID, "cardCvc-input"))).send_keys("1234")
To come out from iframe
you need to switch to default_content.要从
iframe
出来,您需要切换到 default_content。
driver.switch_to.default_content()
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.