mirror of
https://gitee.com/g1879/DrissionPage.git
synced 2024-12-10 04:00:23 +08:00
更新README
This commit is contained in:
parent
1c823470bd
commit
cb1efe5e60
22
README.en.md
22
README.en.md
@ -1,3 +1,8 @@
|
|||||||
|
# 中文README
|
||||||
|
***
|
||||||
|
- 中文README:[点击这里](https://github.com/g1879/DrissionPage/blob/master/README.zh-cn.md)
|
||||||
|
- 示例:[点击这里](https://github.com/g1879/DrissionPage-examples)
|
||||||
|
|
||||||
# Introduction
|
# Introduction
|
||||||
***
|
***
|
||||||
|
|
||||||
@ -39,7 +44,7 @@ Even better, it is very concise and user-friendly, with little code and friendly
|
|||||||
|
|
||||||
The following code implements exactly the same function, comparing the code amounts of the two:
|
The following code implements exactly the same function, comparing the code amounts of the two:
|
||||||
|
|
||||||
1、Find all elements whose name is ele_name
|
1. Find all elements whose name is ele_name
|
||||||
|
|
||||||
```python
|
```python
|
||||||
# selenium:
|
# selenium:
|
||||||
@ -48,7 +53,7 @@ element = WebDriverWait(driver).until(ec.presence_of_all_elements_located((By.XP
|
|||||||
element = page.eles('@name:ele_name')
|
element = page.eles('@name:ele_name')
|
||||||
```
|
```
|
||||||
|
|
||||||
2、Find the element whose first text contains 'some text'
|
2. Find the element whose first text contains 'some text'
|
||||||
|
|
||||||
```python
|
```python
|
||||||
# selenium:
|
# selenium:
|
||||||
@ -57,7 +62,7 @@ element = WebDriverWait(driver, timeout = 2).until(ec.presence_of_element_locate
|
|||||||
element = page.ele('some text', timeout = 2)
|
element = page.ele('some text', timeout = 2)
|
||||||
```
|
```
|
||||||
|
|
||||||
3、Jump to the first tab
|
3. Jump to the first tab
|
||||||
|
|
||||||
```python
|
```python
|
||||||
# selenium
|
# selenium
|
||||||
@ -66,7 +71,7 @@ driver.switch_to.window(driver.window_handles[0])
|
|||||||
page.to_tab(0)
|
page.to_tab(0)
|
||||||
```
|
```
|
||||||
|
|
||||||
4、Drag an element
|
4. Drag an element
|
||||||
|
|
||||||
```python
|
```python
|
||||||
# selenium
|
# selenium
|
||||||
@ -75,6 +80,15 @@ ActionChains(driver).drag_and_drop(ele1, ele2).perform()
|
|||||||
ele1.drag_to(ele2)
|
ele1.drag_to(ele2)
|
||||||
```
|
```
|
||||||
|
|
||||||
|
5. Scroll the window to the bottom (keep the horizontal scroll bar unchanged)
|
||||||
|
|
||||||
|
```python
|
||||||
|
# selenium
|
||||||
|
driver.execute_script("window.scrollTo(document.documentElement.scrollLeft,document.body.scrollHeight);")
|
||||||
|
# DrissionPage
|
||||||
|
page.scroll_to('bottom')
|
||||||
|
```
|
||||||
|
|
||||||
# Background
|
# Background
|
||||||
|
|
||||||
***
|
***
|
||||||
|
@ -76,7 +76,14 @@ ActionChains(driver).drag_and_drop(ele1, ele2).perform()
|
|||||||
ele1.drag_to(ele2)
|
ele1.drag_to(ele2)
|
||||||
```
|
```
|
||||||
|
|
||||||
|
5、滚动窗口到底部(保持水平滚动条不变)
|
||||||
|
|
||||||
|
```python
|
||||||
|
# selenium
|
||||||
|
driver.execute_script("window.scrollTo(document.documentElement.scrollLeft,document.body.scrollHeight);")
|
||||||
|
# DrissionPage
|
||||||
|
page.scroll_to('bottom')
|
||||||
|
```
|
||||||
|
|
||||||
# 背景
|
# 背景
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user