README.md 2.1 KB
Newer Older
泰斯特Test's avatar
泰斯特Test 已提交
1
# violent-webdriver
2

泰斯特Test's avatar
泰斯特Test 已提交
3
violent-webdriver is created by post-packaging selenium webdriver,  violent-webdriver has many convinient functions
泰斯特Test's avatar
泰斯特Test 已提交
4
which can highly insure the browser operation, you don't need to worry about whether the element is really present
泰斯特Test's avatar
泰斯特Test 已提交
5
on current page or clickable at specific time while using violent-webdriver. it will handle this sort
泰斯特Test's avatar
泰斯特Test 已提交
6
of annoying problems
泰斯特Test's avatar
泰斯特Test 已提交
7

8 9 10 11
violent-webdriver 诞生于二次封装 selenium webdriver,内部封装了许多方法来确保浏览器操作的执行性,你不需要去担心定位到的元素是否存在
于当前页面或者是否在当前时刻处于可点击状态,报错重试机制可以帮你自动解决这些不必要的麻烦。


泰斯特Test's avatar
泰斯特Test 已提交
12
Find the latest version on github : https://github.com/amazingTest/violent-webdriver
泰斯特Test's avatar
泰斯特Test 已提交
13

14

泰斯特Test's avatar
泰斯特Test 已提交
15 16
## Installation
The last stable release is available on PyPI and can be installed with pip.
泰斯特Test's avatar
泰斯特Test 已提交
17
**make sure that Chrome has been installed and match the selenium version** 
泰斯特Test's avatar
泰斯特Test 已提交
18

泰斯特Test's avatar
泰斯特Test 已提交
19
    $ pip install selenium
泰斯特Test's avatar
泰斯特Test 已提交
20

泰斯特Test's avatar
泰斯特Test 已提交
21
    $ pip install violent-webdriver
泰斯特Test's avatar
泰斯特Test 已提交
22

泰斯特Test's avatar
泰斯特Test 已提交
23 24 25 26 27
## Best Practice
Firstly, create a python file: c:\folder\mytest.py

    # c:\folder\mytest.py
    from violent_webdriver import Chrome
泰斯特Test's avatar
泰斯特Test 已提交
28

泰斯特Test's avatar
泰斯特Test 已提交
29
    dr = Chrome.violent_chromedriver(executable_path=[CHROMEDRIVER_PATH], use_mobile_emulation=True)
泰斯特Test's avatar
泰斯特Test 已提交
30
    dr.get('http://www.baidu.com')
泰斯特Test's avatar
泰斯特Test 已提交
31 32
    dr.v_send_keys(locate_rule={'css selector': 'input[name=\'word\']'}, message='test')
    dr.v_click(locate_rule={'css selector': 'button[class=\'se-bn\']'})
泰斯特Test's avatar
泰斯特Test 已提交
33 34

then use your IDE to run this script or
泰斯特Test's avatar
泰斯特Test 已提交
35 36

    $ python c:\folder\mytest.py
泰斯特Test's avatar
泰斯特Test 已提交
37

泰斯特Test's avatar
泰斯特Test 已提交
38 39 40
if successful, you will see the search result of 'test' by a mobile emulated browser

For more code examples, please refer to the examples folder in source distribution or
泰斯特Test's avatar
泰斯特Test 已提交
41
visit https://github.com/amazingTest/violent-webdriver/tree/master/examples
泰斯特Test's avatar
泰斯特Test 已提交
42 43

## Contact me
44 45 46 47 48 49 50 51 52 53
For information and suggestions you can contact me at 523314409@qq.com

Finally, if you really find this lib useful,**donation** is welcome by using your phone to scann the two-dimensional 
code below
 
最后,如果你觉得这个库真的好用的话可以扫码给作者一些鼓励哦~

![image](https://github.com/amazingTest/violent-webdriver/blob/master/images/wechatDonation.jpg)