Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save dariodiaz/3104601 to your computer and use it in GitHub Desktop.
Save dariodiaz/3104601 to your computer and use it in GitHub Desktop.
python: Highlights a Selenium Webdriver element
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)
@richardmodis
Copy link

Useful stuff!

@vanclist
Copy link

Thanks a lot!

@iamjoe1960
Copy link

great stuff! Many Thanks

@globanov
Copy link

globanov commented Nov 3, 2016

Muchas gracias!

@weichaoliu
Copy link

Thanks a lot.

@buni-buni
Copy link

great work thanks alot !

@catoleg
Copy link

catoleg commented Jan 10, 2018

Thank you sir!

@DrewOrtego
Copy link

DrewOrtego commented Apr 17, 2018

Thanks a million!

@PatrickBluth
Copy link

Awesome stuff.

@eagleEggs
Copy link

Thanks - Is there a license with this code?

@Gexar
Copy link

Gexar commented Oct 22, 2019

Thank you very much!

@roshansukur
Copy link

thanks a ton! very useful...

@klinsc
Copy link

klinsc commented Jan 12, 2020

This's Awesome!

@kerajel
Copy link

kerajel commented May 13, 2020

8 years in, still amazing, thanks!

@erenjaeger123456
Copy link

urakoze cyane

@pandeyshashank7
Copy link

can someone provide the screenshot of how it looks?

@ulfgj
Copy link

ulfgj commented Apr 6, 2021

._patent say what?

@matheuscdo
Copy link

Such a helpfull code! Thanks a lot!

@Sendery
Copy link

Sendery commented Jan 31, 2023

Thanks,
I did add a seccond loop to make it blink...
Thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment