mirror of
https://gitee.com/g1879/DrissionPage.git
synced 2024-11-29 18:47:34 +08:00
update README.md.
This commit is contained in:
parent
abd6d4fb24
commit
15e9a7d683
@ -142,11 +142,12 @@ set_headless()
|
|||||||
text = webdriver.execute_script('return window.getComputedStyle(arguments[0], "::after").getPropertyValue("content");', element)
|
text = webdriver.execute_script('return window.getComputedStyle(arguments[0], "::after").getPropertyValue("content");', element)
|
||||||
|
|
||||||
# 使用 DrissionPage:
|
# 使用 DrissionPage:
|
||||||
text = element.after
|
text = element.pseudo_after
|
||||||
```
|
```
|
||||||
|
|
||||||
- 获取 shadow-root
|
- shadow-root 操作
|
||||||
|
|
||||||
|
selenium 新增了 ShadowRoot,但功能实在是太少。
|
||||||
```python
|
```python
|
||||||
# 使用 selenium:
|
# 使用 selenium:
|
||||||
shadow_element = webdriver.execute_script('return arguments[0].shadowRoot', element)
|
shadow_element = webdriver.execute_script('return arguments[0].shadowRoot', element)
|
||||||
@ -156,6 +157,7 @@ shadow_element = element.sr
|
|||||||
|
|
||||||
# 在 shadow_root 下可继续执行查找,获取普通元素
|
# 在 shadow_root 下可继续执行查找,获取普通元素
|
||||||
ele = shadow_element.ele('tag:div')
|
ele = shadow_element.ele('tag:div')
|
||||||
|
ele.click()
|
||||||
```
|
```
|
||||||
|
|
||||||
- 用 xpath 直接获取属性或文本节点(返回文本)
|
- 用 xpath 直接获取属性或文本节点(返回文本)
|
||||||
|
Loading…
Reference in New Issue
Block a user