GithubHelp home page GithubHelp logo

selenium-utils's Introduction

A toolbox for advanced Selenium acrobatics

Compatibility

Because of type hinting is extensively used, only Python 3.5 and above are supported.

Examples

from selenium import webdriver

from selenium_utils import element
from selenium_utils import screenshot
from selenium_utils import alert
from selenium_utils import tab



driver = webdriver.Chrome()

# find element and scroll it into view
page_header_pixels = 200
button_send = driver.find_element_by_css_selector("#button_send")
element.scroll_into_view(driver, button_send, page_header_pixels)
button_send.click()

# make screenshot of the whole website
screenshot.resize_to_page_size(driver)
screenshot.get_screenshot(driver, "screenshot.png")

# handle expected alert
alert.wait_until_alert_is_present(driver)
alert.handle_alert(driver, accept_alert=True)

# let's say we opened multiple windows and tabs and want to close all but the current one
tab.close_all_tabs_except_given(driver, driver.current_window_handle)

# If an element is moving there's a high probability the clicks will miss the element.
# E.g. if a menu is expanding, we can wait until the animation stops.
element.wait_until_stops_moving(button_send)
button_send.click()

selenium-utils's People

Contributors

jmakov avatar

Stargazers

Hojin Jang avatar Brad avatar AJ Anderson avatar Anna Sudnitsyna avatar MADhatter4² avatar mitool avatar Bhasker Surnida avatar Alexey avatar postmart avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.