Reputation: 1
I'm running this code using scrapy_selenium but I'm not able to pass the driver to parse_page, can anyone identify what I'm doing wrong?
class LSpider(scrapy.Spider):
name = 'test'
def start_requests(self):
yield SeleniumRequest(
url='https://www.url.com',
wait_time=3,
screenshot=True,
callback=self.login
)
def login(self, response):
driver = response.request.meta['driver']
search_input = driver.find_element_by_xpath("(//input[@class='input__input'])[1]")
search_input.send_keys("user")
search_input_password = driver.find_element_by_xpath("(//input[@class='input__input'])[2]")
search_input_password.send_keys("password")
search_input.send_keys(Keys.ENTER)
time.sleep(3)
yield SeleniumRequest(
url='https:url.com/url',
callback=self.parse_page,
screenshot=True
)
def parse_page(self, response):
driver = response.request.meta['driver']
search = driver.find_element_by_xpath("//input[@class='search-box']")
Upvotes: 0
Views: 109