-1
我用硒刮去angel.co数据,但仍然没有得到的数据从网站无法使用硒
from scrapy import Request,Spider
import urllib
from selenium import webdriver
class AngelSpider(Spider):
name = "angel"
allowed_domains = ["angel.co"]
AJAXCRAWL_ENABLED = True
start_urls = (
"https://angel.co/companies?locations[]=India",
)
def __init__(self):
self.path ='/usr/lib/chromium-browser/chromedriver'
self.driver = webdriver.Chrome(self.path)
def parse(self,response):
self.driver.get(response.url)
self.driver.implicitly_wait(50)
while True:
next = self.driver.find_element_by_css_selector("div.more")
try:
next.click()
self.driver.implicitly_wait(10)
divs = self.driver.find_element_by_xpath("//div[@class= 'results']")
for div in divs:
name =divs.find_element_by_css_selector("div.name")
print name.text
except:
break
仍无法刮@alecxe用于'VAL = response.xpath( “// DIV [@数据_tn = '公司/结果']”) COMPANY_NAME = val.xpath(“// DIV [提取()'这两个提取器以及这些xpaths在铬上正常工作,但没有给我的蜘蛛任何结果 –
无法弄清楚我在做什么错误。抓取后没有获得数据,所有的xpath都没问题。 –