我正在尝试在这个网站上自动结账:https://en.aw-lab.com。 现在我试图通过查找信用卡模块的每个输入路径来支付,但我得到了错误:
AttributeError: 'NoneType' object has no attribute 'send_keys
。 这意味着找不到元素,因此无法发送密钥。现在我的问题是,如何访问此元素
我尝试通过ID和xpath查找card元素上的name,但错误仍然存在。我还尝试在找到元素之前添加睡眠,这样页面就可以完全加载,但这并没有解决问题
time.sleep(2)
cardname = driver.find_element_by_xpath('//*[@id="cardOwner"]')
cardname.send_keys(ccname_input)
其他帖子提到要进入iframe,但是这个页面没有iframe。
另一篇文章说脚本是由javascript生成的:我也尝试了该代码,但随后出现了一个错误element not interactable
inputCC = WebDriverWait(driver, 15).until(
lambda driver: driver.find_element_by_xpath('//*[@id="cardOwner"]')
)
inputCC.send_keys(ccname_input)
对如何解决这个问题有什么建议吗
选择具有该id的输入,而不是div
相关问题 更多 >
编程相关推荐