|
1 |
| -# s-tool |
2 |
| - |
3 |
| -Selenium wrapper to make your life easy. |
4 |
| - |
5 |
| -## Features |
6 |
| - |
7 |
| -- [X] Manage multiple webdrivers. |
8 |
| -- [X] Click any type of element. |
9 |
| -- [X] Extract Page source. |
10 |
| -- [X] Select different type of elements. |
11 |
| -- [X] Retrive cookies. |
12 |
| -- [X] take fullpage and elementwise screenshots. |
13 |
| -- [X] display and hide elements. |
14 |
| - |
15 |
| -## TODO |
16 |
| - |
17 |
| -- [ ] Fill information(forms) |
18 |
| -- [ ] horizontal and vertical scrolling |
19 |
| -- [ ] Handeling alerts and popup |
20 |
| -- [ ] Switching windows,tabs,frames. |
21 |
| -- [ ] adding universal login functionality with forms |
22 |
| -- [ ] handling iframe windows. |
23 |
| -- [ ] Writing Parser to extract data from WebDriver. |
24 |
| -- [ ] Logging driver activities |
| 1 | +# S-Tool |
| 2 | + |
| 3 | + |
| 4 | + |
| 5 | +## Selenium wrapper to make your life easy |
| 6 | + |
| 7 | + |
| 8 | + |
| 9 | + |
| 10 | + |
| 11 | + |
| 12 | +## Table of Contents |
| 13 | + |
| 14 | +- [Key Features](#key-features) |
| 15 | +- [How To Use](#how-to-use) |
| 16 | +- [Examples](#examples) |
| 17 | +- [Todo](#todo) |
| 18 | +- [License](#license) |
| 19 | + |
| 20 | +## Key Features |
| 21 | + |
| 22 | +- WebDriver |
| 23 | + - Manage multiple web drivers such as chrome,chromium,firefox. |
| 24 | +- Different Utilities |
| 25 | + - Retrieve element with 5 different attribute. |
| 26 | + - Perform clicks on element |
| 27 | + - Take full page and element screenshot. |
| 28 | + - Hide and show elements. |
| 29 | + - Information filling on different form elements such as text,radio,checkbox. |
| 30 | + - Retrieves current cookies from browser. |
| 31 | + - Retrieve url and web page source |
| 32 | +- Element Parser |
| 33 | + - table Information |
| 34 | + - Retrieve dropdown options in dictionary |
| 35 | + |
| 36 | +## How To Use |
| 37 | + |
| 38 | +### Install using PYPI |
| 39 | + |
| 40 | +```bash |
| 41 | +pip install s-tool |
| 42 | +``` |
| 43 | + |
| 44 | +### Setup for development |
| 45 | + |
| 46 | +To clone and run this application, you'll need [Git](https://git-scm.com) and |
| 47 | +[Poetry](https://python-poetry.org/) and [python Version ^3.8](http://python.org/) |
| 48 | + |
| 49 | +```bash |
| 50 | +# Clone this repository |
| 51 | +git clone https://github.com/Python-World/s-tool.git |
| 52 | + |
| 53 | +# Go into the repository |
| 54 | +cd s-tool |
| 55 | + |
| 56 | +# Install dependencies |
| 57 | +poetry config virtualenvs.in-project true |
| 58 | +poetry install |
| 59 | + |
| 60 | +# Start Poetry shell |
| 61 | +poetry shell |
| 62 | +``` |
| 63 | + |
| 64 | +Note: If you're doing development setup, [see this guide](CONTRIBUTING) |
| 65 | + |
| 66 | +## Examples |
| 67 | + |
| 68 | +### Example 1 |
| 69 | + |
| 70 | +```python |
| 71 | +"""Example code with class""" |
| 72 | + |
| 73 | +from s_tool.driver import SeleniumDriver |
| 74 | + |
| 75 | + |
| 76 | +class SBot(SeleniumDriver): |
| 77 | + """Example Bot using s-tool""" |
| 78 | + |
| 79 | + def __init__(self, *args, **kwargs): |
| 80 | + super().__init__(*args, **kwargs) |
| 81 | + |
| 82 | + def run(self): |
| 83 | + self.get("https://google.com") |
| 84 | + sessionid = self.session() |
| 85 | + url = self.url() |
| 86 | + cookies = self.cookies() |
| 87 | + |
| 88 | + # print sessionid,url,cookies |
| 89 | + print(f"\nurl : {url} \nsession : {sessionid}\ncookies : {cookies}\n") |
| 90 | + |
| 91 | + |
| 92 | +bot = SBot("firefox", headless=True) # change headless=False to run with gui mode |
| 93 | +bot.run() |
| 94 | +bot.close() |
| 95 | + |
| 96 | +``` |
| 97 | + |
| 98 | +### Example 2 |
| 99 | + |
| 100 | +```python |
| 101 | +"""Example code with context manager""" |
| 102 | + |
| 103 | +from s_tool.driver import SeleniumDriver as SBot |
| 104 | + |
| 105 | +with SBot("firefox", headless=True) as obj: |
| 106 | + obj.get("https://google.com") |
| 107 | + sessionid = obj.session() |
| 108 | + url = obj.url() |
| 109 | + cookies = obj.cookies() |
| 110 | + |
| 111 | + # print sessionid,url,cookies |
| 112 | + print(f"\nurl : {url} \nsession : {sessionid}\ncookies : {cookies}\n") |
| 113 | + |
| 114 | +``` |
| 115 | + |
| 116 | +## Todo |
| 117 | + |
| 118 | +- Web driver utilities |
| 119 | + - Scrolling element and page. |
| 120 | + - Handling popup and alert boxes. |
| 121 | + - Switching windows,frame,tabs,iframes. |
| 122 | + - logger. |
| 123 | +- Element Parser |
| 124 | + - list |
| 125 | + - radio and checkboxes |
| 126 | + |
| 127 | +Note: If you have any idea to improve or optimized in better way |
| 128 | +[create issue](https://github.com/Python-World/s-tool/issues/new) for discussion. |
| 129 | + |
| 130 | +## License |
| 131 | + |
| 132 | +[MIT](LICENSE) |
0 commit comments