selenium + js operation

# A method, selenium can be successfully targeted to the element, arguments [0] corresponds WebElement, ** kwargs parameters corresponding to each of the js 
js = "arguments [0] = .innerHTML arguments [. 1]" 
Self .__ driver.execute_script (js, WebElement, ** kwargs) 

# method 2: using the positioning element and the process js  
js = 'document.getElementsByClassName ( "NAV Site-fr-right") [0] .childNodes [. 1] .removeAttribute ( "target")' 
Self. __driver.execute_script (JS) 

# JS positioned by xpath element 
# document.evaluate ( '// div [@ class = "staffList-header"] // button [@ class = "button-block"]'). iterateNext ()


Guess you like

Origin blog.51cto.com/11463754/2452391