更新README

This commit is contained in:
g1879 2020-06-02 00:14:45 +08:00
parent 1c823470bd
commit cb1efe5e60
2 changed files with 25 additions and 4 deletions

View File

@ -1,3 +1,8 @@
# 中文README
***
- 中文README[点击这里](https://github.com/g1879/DrissionPage/blob/master/README.zh-cn.md)
- 示例:[点击这里](https://github.com/g1879/DrissionPage-examples)
# 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:
1Find all elements whose name is ele_name
1. Find all elements whose name is ele_name
```python
# selenium:
@ -48,7 +53,7 @@ element = WebDriverWait(driver).until(ec.presence_of_all_elements_located((By.XP
element = page.eles('@name:ele_name')
```
2Find the element whose first text contains 'some text'
2. Find the element whose first text contains 'some text'
```python
# selenium:
@ -57,7 +62,7 @@ element = WebDriverWait(driver, timeout = 2).until(ec.presence_of_element_locate
element = page.ele('some text', timeout = 2)
```
3Jump to the first tab
3. Jump to the first tab
```python
# selenium
@ -66,7 +71,7 @@ driver.switch_to.window(driver.window_handles[0])
page.to_tab(0)
```
4Drag an element
4. Drag an element
```python
# selenium
@ -75,6 +80,15 @@ ActionChains(driver).drag_and_drop(ele1, ele2).perform()
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
***

View File

@ -76,7 +76,14 @@ ActionChains(driver).drag_and_drop(ele1, ele2).perform()
ele1.drag_to(ele2)
```
5、滚动窗口到底部保持水平滚动条不变
```python
# selenium
driver.execute_script("window.scrollTo(document.documentElement.scrollLeft,document.body.scrollHeight);")
# DrissionPage
page.scroll_to('bottom')
```
# 背景