Skip to content

Commit 7a5651a

Browse files
authored
Merge pull request #19 from chavarera/main
various changes implemented
2 parents 3916036 + ea49351 commit 7a5651a

File tree

4 files changed

+168
-24
lines changed

4 files changed

+168
-24
lines changed
File renamed without changes.

README.md

Lines changed: 132 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,132 @@
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+
![S-tool](https://user-images.githubusercontent.com/33047641/125023819-41998700-e09d-11eb-8076-7fad81f98f70.png)
4+
5+
## Selenium wrapper to make your life easy
6+
7+
![python](https://img.shields.io/badge/Python-FFD43B?style=for-the-badge&logo=python)
8+
![selemium](https://img.shields.io/badge/Selenium-e5dfde?style=for-the-badge&logo=selenium)
9+
![s-tool](https://img.shields.io/badge/S-Tool-3776AB?style=for-the-badge)
10+
![Python-World](https://img.shields.io/badge/Python-World-FFD43B?style=for-the-badge&logo=python&logoColor=white)
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)

examples/with_class_object.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
"""Example code with class"""
2+
3+
from s_tool.driver import SeleniumDriver
4+
5+
6+
class SBot(SeleniumDriver):
7+
"""Example Bot using s-tool"""
8+
9+
def __init__(self, *args, **kwargs):
10+
super().__init__(*args, **kwargs)
11+
12+
def run(self):
13+
self.get("https://google.com")
14+
sessionid = self.session()
15+
url = self.url()
16+
cookies = self.cookies()
17+
18+
# print sessionid,url,cookies
19+
print(f"\nurl : {url} \nsession : {sessionid}\ncookies : {cookies}\n")
20+
21+
22+
bot = SBot("firefox", headless=True) # change headless=False to run with gui mode
23+
bot.run()
24+
bot.close()

examples/with_context_manager.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
"""Example code with context manager"""
2+
3+
from s_tool.driver import SeleniumDriver as SBot
4+
5+
with SBot("firefox", headless=True) as self:
6+
self.get("https://google.com")
7+
sessionid = self.session()
8+
url = self.url()
9+
cookies = self.cookies()
10+
11+
# print sessionid,url,cookies
12+
print(f"\nurl : {url} \nsession : {sessionid}\ncookies : {cookies}\n")

0 commit comments

Comments
 (0)