【问题标题】:How To WebScrape This Field如何 WebScrape 此字段
【发布时间】:2021-04-28 06:45:50
【问题描述】:

我的代码进入了这个网站,我只想要每一行的标题。

我的代码打印的比标题多。

示例第 1 行的预期输出应该是 - 'Welcome and Introduction of Dr. Hotz'

这种格式的第 2、3 行应该继续。

from selenium import webdriver
import time
driver = webdriver.Chrome()

url='https://meetinglibrary.asco.org/session/13399'
driver.get(url)
time.sleep(2)

eachRow=driver.find_elements_by_xpath("//span[@class='ng-star-inserted']")
for line in eachRow:
   print(line.text)

【问题讨论】:

    标签: python selenium web-scraping beautifulsoup


    【解决方案1】:

    您可以尝试使用 div 来查找行。

    eachRow=driver.find_elements_by_xpath("//div[@class='record__title ng-star-inserted']")
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-09-29
      • 2021-12-20
      • 2013-08-25
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2022-01-15
      • 2014-02-09
      相关资源
      最近更新 更多