原文的提问网址,我也遇到类似的问题,看了后顿然醒悟,python每个东西都是对象。

https://stackoverflow.com/questions/14590341/use-python-selenium-to-get-span-text



摘抄部分解决的方法:

This should do it:

from selenium import webdriver
browser = webdriver.Firefox()browser.get("http://www.google.com")for elem in browser.find_elements_by_xpath('.//span[@class = "gbts"]'):
    print elem.text