【发布时间】:2019-06-12 19:52:51
【问题描述】:
我正在尝试自动化填写登录后出现的网站安全问题的过程。从我已经回答的 6 个问题中随机提出两个问题。
我尝试识别在“aria-label”元素中找到的特定安全问题的每个 Xpath 选项都返回 NoSuchElementException。
我在谷歌兔子洞里尝试了很多方法,包括:
#First Attempt
question_1=browser.find_element_by_xpath('//div[@label="name of first employer?"]')
#Second Attempt
question_1=browser.find_element_by_xpath('//form[@label="name of first employer?"]/label[text()="name of first employer?"]')
我为以下两个安全问题添加了已检查元素的 html:
<input type="password" name="first_security_question" aria-label="Unique pin #4" value="">
<input type="password" name="second_security_question" aria-label="Model of first car?" value="">
我希望识别 aria-label 中的特定问题,以便我可以发送适当的键来填写表单问题,但我得到的只是NoSuchElementException。
【问题讨论】:
标签: python selenium nosuchelementexception