使用python将数据从selenium解析为美丽的汤

时间:2014-05-19 06:17:58

标签: python selenium-webdriver beautifulsoup lxml

我收到错误

FeatureNotFound: Couldn't find a tree builder with the features you requested: lxml. Do 
you need to install a parser library?

我的进口商品是......

import mechanize
import urllib2
from bs4 import BeautifulSoup
import time
from selenium import webdriver
import lxml

我的代码是......

(driver.page_source自己使用print语句正确打印,但不会解析为beautifulsoup)

from selenium import webdriver
driver = webdriver.Firefox()
driver.get(url2)
driver.set_window_position(0, 0)
driver.set_window_size(100000, 200000)
driver.execute_script("window.scrollTo(0, document.body.scrollHeight);")
time.sleep(5) # wait to load
html = driver.page_source
driver.quit()
import lxml
soup = BeautifulSoup(html, 'lxml')
print soup

它不喜欢的线是......

    FeatureNotFound                           Traceback (most recent call last)
<ipython-input-17-62919c26be91> in <module>()
     73 driver.quit()
     74 from lxml import etree
---> 75 soup = BeautifulSoup(html, 'lxml'

0 个答案:

没有答案