Skip to main content
Join the official 2019 Python Developers SurveyStart the survey!

Python Package to run Javascript code snippets easily on Selenium

Project description

SeleniumJS

v1.0.11 Beta

Execute Javascript code with selenium.webdriver easily without the need of execute_script(#). Currently supports 5 DOM Objects and a lot more coming to the project soon.

Currently Supporting DOM Objects

  1. console
  2. location
  3. sessionStorage
  4. localStorage
  5. history
  6. navigator

Install

  1. To Install using pip

     pip install seleniumjs
    
  2. Steps to install to your project directory

    1. Clone the project to your project directory
    2. run the command python3 setup.py install

Usage

  1. Console Class

    from seleniumjs import Console
    console = Console(driver)
    console.time()
    console.log('Hello World')
    console.log('This is seleniumjs')
    console.timeEnd()
    

    Warning : Console doesnt support assert method

  2. Location Class

    from seleniumjs import Location
    location = Location(driver)
    print(location.href)
    location.href = 'https://github.com/shashankrnr32/SeleniumJS#usage'
    print(location.hash)
    
  3. Storage Class

    from seleniumjs import SessionStorage
    sessionStorage = SessionStorage(driver)
    sessionStorage.setItem('key', 'value')
    print(sessionStorage.length)
    

    Info : Use LocalStorage instead of SessionStorage

  4. History Class

    from seleniumjs import History
    history = History(driver)
    print(history.length)
    history.back()
    print(history.length)
    
  5. Navigator Class

    from seleniumjs import Navigator
    navigator = Navigator(driver)
    print(navigator.appCodeName)
    print(navigator.language)
    

    Warning : Navigator doesnt support geolocation(yet)

Testing

The package is under development with testing being done in Google Chrome and Mozilla Firefox. Project will be tested in Edge, Opera in the future releases. Contribute to this project by testing it in Safari.

License

MIT Free License held by Shashank Sharma

This project is not funded/supported by Selenium. To know more about SeleniumHQ visit here

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for seleniumjs, version 1.0.12
Filename, size File type Python version Upload date Hashes
Filename, size seleniumjs-1.0.12-py3-none-any.whl (2.1 kB) File type Wheel Python version py3 Upload date Hashes View hashes
Filename, size seleniumjs-1.0.12.tar.gz (2.2 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page