簡體   English   中英

使用Selenium Python在頁面中查找特定文本

[英]Finding a specific text in a page using selenium python

我正在嘗試使用硒python從頁面https://play.google.com/store/apps/details?id=org.codein.filemanager&hl=zh_CN中查找特定文本。 我正在尋找元素名稱-上述網址的當前版本。 我用下面的代碼

 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()

我似乎沒有得到輸出打印。 我在這里做錯什么嗎?

沒有名為“當前版本”的類。 如果要捕獲“當前版本”文本下方的版本號,則可以使用此xpath表達式:

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

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM