Slenium 2 Webdriver Highlight Element
时间:2014-04-30 03:28:21
收藏:0
阅读:610
|
1
2
3
4
5
6
7
8
9
10
11
12
13 |
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)<br> time.sleep(1.1) |
现成代码,直接使用。 也可用于robot。
评论(0)