Skip to content
main
Switch branches/tags
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

S-Tool

S-tool

Selenium wrapper to make your life easy

python selemium s-tool Python-World

Table of Contents

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

pip install s-tool

Setup for development

To clone and run this application, you'll need Git and Poetry and python Version ^3.8

# 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

Examples

Example 1

"""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

"""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 for discussion.

License

MIT