Skip to content

Commit

Permalink
Use scrapy.utils.test.get_crawler
Browse files Browse the repository at this point in the history
  • Loading branch information
elacuesta committed Jul 25, 2024
1 parent be515ee commit be4a011
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
import scrapy
from playwright.async_api import Page
from scrapy import signals
from scrapy.crawler import Crawler, CrawlerProcess
from scrapy.crawler import CrawlerProcess
from scrapy.utils.test import get_crawler
from scrapy_playwright.utils import use_threaded_loop

from tests.mockserver import StaticMockServer
Expand Down Expand Up @@ -55,9 +56,9 @@ def collect_items(item):

with StaticMockServer() as server:
index_url = server.urljoin("/index.html")
crawler = Crawler(
crawler = get_crawler(
spidercls=ThreadedLoopSpider,
settings={
settings_dict={
"TWISTED_REACTOR": "twisted.internet.asyncioreactor.AsyncioSelectorReactor",
"DOWNLOAD_HANDLERS": {
"http": "scrapy_playwright.handler.ScrapyPlaywrightDownloadHandler",
Expand Down

0 comments on commit be4a011

Please sign in to comment.