使用 Selenium 访问 Shadow DOM 树 [英] Accessing Shadow DOM tree with Selenium

查看:31
本文介绍了使用 Selenium 访问 Shadow DOM 树的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以使用 Selenium/Chrome webdriver 访问 Shadow DOM 中的元素?

Is it possible to access elements within a Shadow DOM using Selenium/Chrome webdriver?

正如预期的那样,使用普通元素搜索方法不起作用.我在 w3c 上看到了对 switchToSubTree 规范的引用,但不能't 找到任何实际的文档、示例等.

Using the normal element search methods doesn't work, as is to be expected. I've seen references to the switchToSubTree spec on w3c, but couldn't locate any actual docs, examples, etc.

有人成功了吗?

推荐答案

不幸的是,看起来 webdriver 规范还不支持这个.

Unfortunately it looks like the webdriver spec does not support this yet.

我的窥探被发现了:

http://www.w3.org/TR/webdriver/#switching-to-hosted-shadow-doms

https://groups.google.com/forum/#!msg/selenium-developers/Dad2KZsXNKo/YXH0e6eSHdAJ

这篇关于使用 Selenium 访问 Shadow DOM 树的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆