selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate elemen
翻看网络上的资料,了解到定位元素仅会在当前所处的frame中寻找该元素,如果有多个frame时需要先切换到对应的frame下才能够找到该元素。所以如果想要代码能够正常执行需要先切换到元素所在的frame下,切换frame使用的语句为:driver.switch_to_frame(***)情况2.frame没有id或name标记,但有class标记,需要先获取到对应的frame,然后在切换至该frame。上面是初始时完成的代码,最终的目的是获取到当前登录人的昵称。
原创
2022-08-19 19:25:50 ·
4235 阅读 ·
0 评论