首页 > 解决方案 > 我正在尝试完成一个程序,我会自动从 kithnyc.com 网站购买鞋子

问题描述

在 kithnyc.com 网站上,他们不允许我通过 python 访问信用卡信息。我尝试检查并查找元素名称,但找不到。它一直告诉我无法定位。另外,我让它等待超过 20 秒,driver.implicitly_wait但它没有用。我也尝试使用WebDriverWait. 听到是我要查找信用卡元素的网址。我需要能够 send_keys 所以 iframe 对我没有用。请让我知道如何找到正确的输入元素。

带有信用卡元素的网站:https ://kith.com/942252/checkouts/2d2db4ea947340bd61426d4e6f658154?previous_step=shipping_method&step=payment_method

这是第一个 x 路径,其中只有信用卡元素的 x_path。

driver.implicitly_wait(20)
send_info_cc = driver.find_element_by_xpath('//input[@placeholder="Card number"]').send_keys(cerdit_card)

Here is the WebDriverWait

WebDriverWait(driver,20).until(EC.frame_to_be_available_and_switch_to_it((By.XPATH,"//input[@placeholder'Card Number']")))

WebDriverWait(driver, 20).until(EC.element_to_be_clickable((By.XPATH, "//input[@name='number' and @placeholder='Card number']"))).send_keys("1234567890987654")

标签: pythonhtmlseleniumselenium-webdriver

解决方案


推荐阅读