本文介绍了无法使用 Selenium 和 Python 在 #shadow-root (open) 中找到登录元素的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试使用 selenium 自动执行某些操作,但无法在页面上找到第一个元素 :
- 浏览器快照:
参考文献
您可以在以下位置找到一些相关的详细讨论:
- 如何交互在使用 cssSelector 清除 Chrome 浏览器的浏览数据时使用 #shadow-root (open) 中的元素
- 如何使用 selenium 自动化影子 DOM 元素?
I'm trying to use selenium to automate some actions but am unable to find the first element on the page https://developer.servicenow.com/dev.do and so cannot login
I get the error
解决方案
To Sign In button is deep within multiple #shadow-root (open)
Solution
Tto click()
on the desired element you can use shadowRoot.querySelector()
and you can use the following Locator Strategy:
- Browser Snapshot:
References
You can find a couple of relevant detailed discussions in:
- How to interact with the elements within #shadow-root (open) while Clearing Browsing Data of Chrome Browser using cssSelector
- How to automate shadow DOM elements using selenium?
这篇关于无法使用 Selenium 和 Python 在 #shadow-root (open) 中找到登录元素的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!
【网站声明】本站部分内容来源于互联网,旨在帮助大家更快的解决问题,如果有图片或者内容侵犯了您的权益,请联系我们删除处理,感谢您的支持!