【问题标题】:Using Selenium to get the information within title= ' '使用 Selenium 获取 title= ' ' 中的信息
【发布时间】:2020-12-27 02:22:36
【问题描述】:

请帮助我找到解决方案,通过使用不带 XPath 的 Selenium 从该 html 代码中获取信息,因为我想从中创建一个循环。

我想从这个“title="4.7/5 - 10378 评论”中得到结果为:“4.7”

请看下图:

enter image description here

【问题讨论】:

    标签: python selenium selenium-webdriver web-scraping


    【解决方案1】:

    如果您已经设置了driver

    不如试试这样的,

    rating = driver.find_element_by_class_name("stars").get_attribute("title")
    
    print (rating)
    
    
    
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2022-01-02
      • 2016-12-12
      • 1970-01-01
      • 2018-10-29
      • 2021-04-06
      • 1970-01-01
      • 2018-12-31
      • 2020-01-11
      相关资源
      最近更新 更多