Selenium信用卡模块元素不可交互

2024-09-26 18:16:06 发布

您现在位置:Python中文网/ 问答频道 /正文

我正在尝试在这个网站上自动结账: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)

对如何解决这个问题有什么建议吗


Tags: sendid元素inputbydriver错误页面

热门问题