Slenium 2 Webdriver Highlight Element
2020-11-15 02:22
标签:com blog style class div code log tar c t string 现成代码,直接使用。 也可用于robot。 Slenium 2 Webdriver Highlight Element,搜素材,soscw.com Slenium 2 Webdriver Highlight Element 标签:com blog style class div code log tar c t string 原文地址:http://www.cnblogs.com/WandyYing/p/3695824.html
def
highlight_element(
self
, locator):
"""docstring for highlight_element"""
self
._info(
"start"
)
element
=
self
._element_find(locator,
True
,
True
)
parent
=
element._parent
parent.execute_script(
"""
element = arguments[0];
original_style = element.getAttribute(‘style‘);
element.setAttribute(‘style‘, original_style + "; background: yellow; border: 2px solid red;");
setTimeout(function(){
element.setAttribute(‘style‘, original_style);
}, 1000);
"""
, element)
time.sleep(1.1
)
文章标题:Slenium 2 Webdriver Highlight Element
文章链接:http://soscw.com/index.php/essay/21359.html