By locating text element selenium (div, td, span, etc.)

# Precise positioning element via text content. May be due to the page content spaces, often less than the positioning element 
driver.find_element_by_xpath ( ' // div [text () = "active service"] ' )    # To locate other label elements (such as: td, span, etc.), just to replace div 

# fuzzy positioning elements with text content 
driver.find_element_by_xpath ( ' // div [the contains (text (), "active service")] ' )

Guess you like

Origin www.cnblogs.com/testlearn/p/12120502.html