2017-01-25 74 views
0

我已经制作了一个程序来访问公司内部的网站,以便每小时检索一小时内的订单数量数据。访问是好的,但试图检索数据是一个问题,因为它是在混乱的表格格式。无法通过后端访问。用BeautifulSoup&Selenium解析表格和麻烦

driver.get("companyurl") #fetching the site & feeding to beautifulsoup 
url = driver.page_source("companyurl") 
soup = BeautifulSoup(url) 
#this is where the issues start 

类型错误:“统一”对象不是可调用(2号线)

还具有检索表本身与汤的问题,但这是另一天另一美元

回答

0

尝试发送页面的源代码硒驱动程序接收直入BeautifulSoup解析:

driver.get("companyurl") 
soup = BeautifulSoup(driver.page_source) 

然后尝试搜索你的表:

all_tables = soup.find_all('table').get_text() 

或者,如果你知道它的位置:

a_table = soup.find_all('table')[1].get_text() 
+0

工作PERF,最终的代码是(工作了几天之后) 'driver.get( “公司网址”)'' url = driver.page_source' 'soup = BeautifulSoup(url,“html.parser”)' – Rob