【发布时间】:2020-07-23 15:58:57
【问题描述】:
我想通过点击选择更多信息链接。我已经尽我所能,但每次错误 NoSuchElementException: no such element: Unable to locate element: {"method":"xpath","selector" 弹出.
起初,我想可能是因为我没有正确更改选项卡,这就是显示此错误的原因。但是,即使在使用 window_handles 之后,我仍然无法在此页面上找到任何元素。
请帮助!
self.driver.window_handles
base = self.driver.window_handles[0]
child = self.driver.window_handles[1]
window_set = {self.driver.window_handles[0], self.driver.window_handles[1]}
for x in window_set:
if(base != x):
self.driver.switch_to.window(x)
self.driver.find_element_by_id("mc-lnk-moreInfo").click()
【问题讨论】:
-
完成编辑...
-
希望它不在 iframe 元素中
标签: selenium selenium-webdriver automation selenium-chromedriver nosuchelementexception