-
-
Save DrewOrtego/6c69c40a09b5f01d8a4863a7a28b90bb to your computer and use it in GitHub Desktop.
python: Highlights a Selenium Webdriver element
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
import time | |
def highlight(element): | |
"""Highlights (blinks) a Selenium Webdriver element""" | |
driver = element._parent | |
def apply_style(s): | |
driver.execute_script("arguments[0].setAttribute('style', arguments[1]);", | |
element, s) | |
original_style = element.get_attribute('style') | |
apply_style("background: yellow; border: 2px solid red;") | |
time.sleep(.3) | |
apply_style(original_style) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment