I haven't tried this code, but this should work.
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)
Hope this helps. Thanks.
Source - https://gist.github.com/dariodiaz/3104601
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…