看板 Python 關於我們 聯絡資訊
大家好,我想在scrapy shell 中測試,selenium登入ptt gossip後,將cookies傳給 Request,最後 view(response),卻出現空白頁,想請問是哪個步驟出錯了,謝謝 空白頁連結>>>https://imgur.com/a/G2tMR 以下是我的代碼 import scrapy from selenium import webdriver from selenium.webdriver.common.by import By from scrapy.http import Request,HtmlResponse driver = webdriver.Chrome(r'C:\Users\Surface\Desktop\scrapy\chromedriver.exe') driver.get("https://www.ptt.cc/ask/over18?from=%2Fbbs%2FGossiping%2Findex.html") driver.get_element(By.XPATH,'.//*[@name="yes"]').click() cookies = driver.get_cookies() request = Request("https://www.ptt.cc/ask/over18?from=%2Fbbs%2FGossiping%2Findex.html") response = HtmlResponse("https://www.ptt.cc/ask/over18?from=%2Fbbs%2FGossiping%2Findex.html",request = request) view(response) 謝謝~ -- ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 120.110.127.195 ※ 文章網址: https://www.ptt.cc/bbs/Python/M.1516965240.A.ACA.html