简体   繁体   中英

Finding a specific text in a page using selenium python

I'm trying to find a specific text from a page https://play.google.com/store/apps/details?id=org.codein.filemanager&hl=en using selenium python. I'm looking for the element name - current version from the above url. I used the below code

 browser = webdriver.Firefox() # Get local session of firefox
 browser.get(sampleURL) # Load page

 elem = browser.find_elements_by_clsss_name("Current Version") # Find the query box
 print elem;
 time.sleep(2) # Let the page load, will be added to the API
 browser.close()

I don't seem to get the output printed. Am I doing anything wrong here?

There is no class with name "Current Version". If you want to capture the version number that is below the "Current Version" text, the you can use this xpath expression:

browser.find_element_by_xpath("//div[@itemprop='softwareVersion']")

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM