-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #19 from chavarera/main
various changes implemented
- Loading branch information
Showing
4 changed files
with
168 additions
and
24 deletions.
There are no files selected for viewing
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,132 @@ | ||
# s-tool | ||
|
||
Selenium wrapper to make your life easy. | ||
|
||
## Features | ||
|
||
- [X] Manage multiple webdrivers. | ||
- [X] Click any type of element. | ||
- [X] Extract Page source. | ||
- [X] Select different type of elements. | ||
- [X] Retrive cookies. | ||
- [X] take fullpage and elementwise screenshots. | ||
- [X] display and hide elements. | ||
|
||
## TODO | ||
|
||
- [ ] Fill information(forms) | ||
- [ ] horizontal and vertical scrolling | ||
- [ ] Handeling alerts and popup | ||
- [ ] Switching windows,tabs,frames. | ||
- [ ] adding universal login functionality with forms | ||
- [ ] handling iframe windows. | ||
- [ ] Writing Parser to extract data from WebDriver. | ||
- [ ] Logging driver activities | ||
# S-Tool | ||
|
||
![S-tool](https://user-images.githubusercontent.com/33047641/125023819-41998700-e09d-11eb-8076-7fad81f98f70.png) | ||
|
||
## Selenium wrapper to make your life easy | ||
|
||
![python](https://img.shields.io/badge/Python-FFD43B?style=for-the-badge&logo=python) | ||
![selemium](https://img.shields.io/badge/Selenium-e5dfde?style=for-the-badge&logo=selenium) | ||
![s-tool](https://img.shields.io/badge/S-Tool-3776AB?style=for-the-badge) | ||
![Python-World](https://img.shields.io/badge/Python-World-FFD43B?style=for-the-badge&logo=python&logoColor=white) | ||
|
||
## Table of Contents | ||
|
||
- [Key Features](#key-features) | ||
- [How To Use](#how-to-use) | ||
- [Examples](#examples) | ||
- [Todo](#todo) | ||
- [License](#license) | ||
|
||
## Key Features | ||
|
||
- WebDriver | ||
- Manage multiple web drivers such as chrome,chromium,firefox. | ||
- Different Utilities | ||
- Retrieve element with 5 different attribute. | ||
- Perform clicks on element | ||
- Take full page and element screenshot. | ||
- Hide and show elements. | ||
- Information filling on different form elements such as text,radio,checkbox. | ||
- Retrieves current cookies from browser. | ||
- Retrieve url and web page source | ||
- Element Parser | ||
- table Information | ||
- Retrieve dropdown options in dictionary | ||
|
||
## How To Use | ||
|
||
### Install using PYPI | ||
|
||
```bash | ||
pip install s-tool | ||
``` | ||
|
||
### Setup for development | ||
|
||
To clone and run this application, you'll need [Git](https://git-scm.com) and | ||
[Poetry](https://python-poetry.org/) and [python Version ^3.8](http://python.org/) | ||
|
||
```bash | ||
# Clone this repository | ||
git clone https://github.com/Python-World/s-tool.git | ||
|
||
# Go into the repository | ||
cd s-tool | ||
|
||
# Install dependencies | ||
poetry config virtualenvs.in-project true | ||
poetry install | ||
|
||
# Start Poetry shell | ||
poetry shell | ||
``` | ||
|
||
Note: If you're doing development setup, [see this guide](CONTRIBUTING) | ||
|
||
## Examples | ||
|
||
### Example 1 | ||
|
||
```python | ||
"""Example code with class""" | ||
|
||
from s_tool.driver import SeleniumDriver | ||
|
||
|
||
class SBot(SeleniumDriver): | ||
"""Example Bot using s-tool""" | ||
|
||
def __init__(self, *args, **kwargs): | ||
super().__init__(*args, **kwargs) | ||
|
||
def run(self): | ||
self.get("https://google.com") | ||
sessionid = self.session() | ||
url = self.url() | ||
cookies = self.cookies() | ||
|
||
# print sessionid,url,cookies | ||
print(f"\nurl : {url} \nsession : {sessionid}\ncookies : {cookies}\n") | ||
|
||
|
||
bot = SBot("firefox", headless=True) # change headless=False to run with gui mode | ||
bot.run() | ||
bot.close() | ||
|
||
``` | ||
|
||
### Example 2 | ||
|
||
```python | ||
"""Example code with context manager""" | ||
|
||
from s_tool.driver import SeleniumDriver as SBot | ||
|
||
with SBot("firefox", headless=True) as obj: | ||
obj.get("https://google.com") | ||
sessionid = obj.session() | ||
url = obj.url() | ||
cookies = obj.cookies() | ||
|
||
# print sessionid,url,cookies | ||
print(f"\nurl : {url} \nsession : {sessionid}\ncookies : {cookies}\n") | ||
|
||
``` | ||
|
||
## Todo | ||
|
||
- Web driver utilities | ||
- Scrolling element and page. | ||
- Handling popup and alert boxes. | ||
- Switching windows,frame,tabs,iframes. | ||
- logger. | ||
- Element Parser | ||
- list | ||
- radio and checkboxes | ||
|
||
Note: If you have any idea to improve or optimized in better way | ||
[create issue](https://github.com/Python-World/s-tool/issues/new) for discussion. | ||
|
||
## License | ||
|
||
[MIT](LICENSE) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
"""Example code with class""" | ||
|
||
from s_tool.driver import SeleniumDriver | ||
|
||
|
||
class SBot(SeleniumDriver): | ||
"""Example Bot using s-tool""" | ||
|
||
def __init__(self, *args, **kwargs): | ||
super().__init__(*args, **kwargs) | ||
|
||
def run(self): | ||
self.get("https://google.com") | ||
sessionid = self.session() | ||
url = self.url() | ||
cookies = self.cookies() | ||
|
||
# print sessionid,url,cookies | ||
print(f"\nurl : {url} \nsession : {sessionid}\ncookies : {cookies}\n") | ||
|
||
|
||
bot = SBot("firefox", headless=True) # change headless=False to run with gui mode | ||
bot.run() | ||
bot.close() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
"""Example code with context manager""" | ||
|
||
from s_tool.driver import SeleniumDriver as SBot | ||
|
||
with SBot("firefox", headless=True) as self: | ||
self.get("https://google.com") | ||
sessionid = self.session() | ||
url = self.url() | ||
cookies = self.cookies() | ||
|
||
# print sessionid,url,cookies | ||
print(f"\nurl : {url} \nsession : {sessionid}\ncookies : {cookies}\n") |