Python package to easily work with selenium and manage tabs effectively.

Overview

Simple Selenium

The aim of this package is to quickly get started with working with selenium for simple browser automation tasks.

Installation

Install from PyPI

pip install simpleselenium

Features

Some basic feature is being listed below.

  • easy management of different tabs
  • switching to a tab is super easy
  • know if a tab is active or alive
  • closing a tab is easy as browser.close_tab(tab_object)
  • Several (built-in) functions
    • tab.infinite_scroll()
    • tab.scroll()
    • tab.scroll_to_bottom()
    • tab.click(element_on_page)
    • tab.switch() to focus on tab i.e. make it the active tab
  • Can't find a way to use usual selenium methods? Use tab.driver object to access the browser/driver object and use accordingly

Usage

The best way to getting started with the package is to use the Browser object to start a browser and call open method off it which returns a Tab object.

Browser

import time  # just to slow down stuffs and see things for testing
from simpleselenium import Browser

chrome_driver = r"/path/to/chromedriver"

with Browser(name="Chrome", driver_path=chrome_driver, implicit_wait=10) as browser:
    google = browser.open("https://google.com")
    yahoo = browser.open("https://yahoo.com")
    bing = browser.open("https://bing.com")
    duck_duck = browser.open("https://duckduckgo.com/")

    print(yahoo)  # A Tab Object
    print(yahoo.is_alive)
    print(yahoo.is_active)
    print(dir(yahoo))  # All methods and attributes of Tab Objects

    print(browser.get_all_tabs())  # List of tab objects

    print(browser.tabs.all())
    print(browser.tabs)  # TabManager object
    print(dir(browser.tabs))  # All methods and attributes of TabManager Objects

    browser.close_tab(bing)  # close a browser tab
    print(browser.tabs.all())

    print(browser.get_current_tab())  # current tab
    time.sleep(5)

    yahoo.switch()  # switch/focus/tap to/on `yahoo` tab
    print(browser.get_current_tab())
    time.sleep(5)

    google.switch()
    print(browser.get_current_tab())
    time.sleep(5)

    browser.close_tab(yahoo)
    time.sleep(5)

    print(google.driver)  # Usual selenium driver object which can be worked upon

    print(google.driver.title, google.title)

    print(google.scroll_to_bottom())
    print(google.is_active)
    print(google.is_alive)
    print(bing.is_alive)  # False, it has been deleted.

    print(browser.get_all_tabs())

TODO

  • Complete documentation
  • Test Code
You might also like...
Python Webscraping using Selenium

Web Scraping with Python and Selenium The code shows how to do web scraping using Python and Selenium. We use as data the https://sbot.org.br/localize

This file will contain a series of Python functions that use the Selenium library to search for elements in a web page while logging everything into a file

element_search with Selenium (Now With docstrings 😎 ) Just to mention, I'm a beginner to all this, so it it's very possible to make some mistakes The

Compiles python selenium script to be a Window's executable

Problem Statement Setting up a Python project can be frustrating for non-developers. From downloading the right version of python, setting up virtual

Automated tests for OKAY websites in Python (Selenium) - user friendly version

Okay Selenium Testy Aplikace určená k testování produkčních webů společnosti OKAY s.r.o. Závislosti K běhu aplikace je potřeba mít v počítači nainstal

Whatsapp messages bulk sender using Python Selenium.

Whatsapp Sender Whatsapp Sender automates sending of messages via Whatsapp Web. The tool allows you to send whatsapp messages in bulk. This program re

reCaptchaBypasser For Bypass Any reCaptcha For Selenium Python

reCaptchaBypasser ' Usage : from selenium import webdriver from reCaptchaBypasser import reCaptchaScraper import time driver = webdriver.chrome(execu

Based on the selenium automatic test framework of python, the program crawls the score information of the educational administration system of a unive

whpu_spider 该程序基于python的selenium自动化测试框架,对某高校的教务系统的成绩信息实时爬取,在检测到成绩更新之后,会通过电子邮件的方式,将更新的成绩以文本的方式发送给用户,可以使得用户在不必手动登录教务系统网站时,实时获取成绩更新的信息。 该程序仅供学习交流,不可用于恶意攻

Percy visual testing for Python Selenium

percy-selenium-python Percy visual testing for Python Selenium. Installation npm install @percy/cli: $ npm install --save-dev @percy/cli pip install P

A Python Selenium library inspired by the Testing Library

Selenium Testing Library Slenium Testing Library (STL) is a Python library for Selenium inspired by Testing-Library. Dependencies Python 3.6, 3.7, 3.8

Releases(0.1.0)
  • 0.1.0(Oct 27, 2021)

    First Release.

    • easy management of different tabs
    • switching to a tab is super easy
    • know if a tab is active or alive
    • closing a tab is easy as browser.close_tab(tab_object)
    • Several (built-in) functions
      • tab.infinite_scroll()
      • tab.scroll()
      • tab.scroll_to_bottom()
      • tab.click(element_on_page)
      • tab.switch() to focus on tab i.e. make it the active tab
    • Can't find a way to use usual selenium methods? Use tab.driver object is access the browsr/driver and use accordingly
    Source code(tar.gz)
    Source code(zip)
    simpleselenium-0.1.0-py3-none-any.whl(7.39 KB)
    simpleselenium-0.1.0.tar.gz(6.64 KB)
Owner
Vishal Kumar Mishra
Vishal Kumar Mishra
A simple Python script I wrote that scrapes NASA's James Webb Space Telescope tracker website using Selenium and returns its current status and location.

A simple Python script I wrote that scrapes NASA's James Webb Space Telescope tracker website using Selenium and returns its current status and location.

null 9 Feb 10, 2022
Selenium-python but lighter: Helium is the best Python library for web automation.

Selenium-python but lighter: Helium Selenium-python is great for web automation. Helium makes it easier to use. For example: Under the hood, Helium fo

Michael Herrmann 3.2k Dec 31, 2022
Fully functioning price detector built with selenium and python

Fully functioning price detector built with selenium and python

mark sikaundi 4 Mar 30, 2022
A simple python script that uses selenium(chrome web driver),pyautogui,time and schedule modules to enter google meets automatically

A simple python script that uses selenium(chrome web driver),pyautogui,time and schedule modules to enter google meets automatically

null 3 Feb 7, 2022
This is a Python script for Github Bot which uses Selenium to Automate things.

github-follow-unfollow-bot This is a Python script for Github Bot which uses Selenium to Automate things. Pre-requisites :- Python A Github Account Re

Chaudhary Hamdan 10 Jul 1, 2022
This project is used to send a screenshot by email of your MyUMons schedule using Selenium python lib (headless mode)

MyUMonsSchedule Use MyUMonsSchedule python script to send a screenshot by email (Gmail) of your MyUMons schedule. If you use it on Windows, take care

Pierre-Louis D'Agostino 6 May 12, 2022
Akulaku Create NewProduct Automation using Selenium Python

Akulaku-Create-NewProduct-Automation Akulaku Create NewProduct Automation using Selenium Python Usage: 1. Install Python 3.9 2. Open CMD on Bot Folde

Rahul Joshua Damanik 1 Nov 22, 2021
Youtube Tool using selenium Python

YT-AutoLikeComment-AutoReportComment-AutoComment Youtube Tool using selenium Python Auto Comment Auto Like Comment Auto Report Comment Usage: 1. Insta

Rahul Joshua Damanik 1 Dec 13, 2021
Selenium Page Object Model with Python

Page-object-model (POM) is a pattern that you can apply it to develop efficient automation framework.

Mohammad Ifran Uddin 1 Nov 29, 2021
Aplikasi otomasi klik di situs popcat.click menggunakan Python dan Selenium

popthe-popcat Aplikasi Otomasi Klik di situs popcat.click. aplikasi ini akan secara otomatis melakukan click pada kucing viral itu, sehingga anda tida

cndrw_ 2 Oct 7, 2022