【问题标题】:Finding a specific text in a page using selenium python使用 selenium python 在页面中查找特定文本
【发布时间】:2013-09-25 18:54:23
【问题描述】:

我正在尝试使用 selenium python 从页面https://play.google.com/store/apps/details?id=org.codein.filemanager&hl=en 中查找特定文本。我正在寻找元素名称——来自上述 url 的当前版本。我使用了下面的代码

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

我似乎没有打印输出。我在这里做错了吗?

【问题讨论】:

  • 没有Current Version类的元素。

标签: python firefox selenium selenium-webdriver


【解决方案1】:

没有名称为“当前版本”的类。如果要捕获“当前版本”文本下方的版本号,可以使用此xpath 表达式:

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

【讨论】:

    猜你喜欢
    • 2022-01-26
    • 1970-01-01
    • 2021-02-09
    • 2019-03-23
    • 2016-12-10
    • 1970-01-01
    • 2021-01-25
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多