selenium, CSS positioning method application

 

 

 

As shown, the download button

 

 

 

Check its elements, is not directly targeted by xpath can not locate, turned firepath acquired CSS is invalid #downloadItems> a

But as after firepath , directly in html copy the following CSS is positioned can be used

html body div.pt.pt-right div.cont dl.newcodecontent dd#downloadItems a

Complete script

browser.find_element_by_css_selector("html body div.pt.pt-right div.cont dl.newcodecontent dd#downloadItems a").click()

Similar methods can be positioned with reference to this element

Guess you like

Origin www.cnblogs.com/becks/p/11872302.html