-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都沒問題。 –