Skip to content

Commit

Permalink
working playwright?
Browse files Browse the repository at this point in the history
  • Loading branch information
MatthewZMSU committed Nov 21, 2024
1 parent bbdf23d commit 7fefd7f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from scrapy import signals
from scrapy.core.downloader.handlers.http import HTTPDownloadHandler
from scrapy.crawler import Crawler
from scrapy.utils.reactor import verify_installed_reactor
from scrapy import signals
from twisted.internet.defer import Deferred

from scrapypuppeteer import CloseContextRequest
Expand Down
12 changes: 7 additions & 5 deletions scrapypuppeteer/browser_managers/playwright_browser_manager.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import asyncio
import base64
import uuid
from typing import Dict, Callable, Awaitable, Union
from dataclasses import dataclass
from typing import Awaitable, Callable, Dict, Union

from playwright.async_api import async_playwright, Browser, BrowserContext, Page
from playwright.async_api import Browser, BrowserContext, Page, async_playwright
from scrapy.http import TextResponse

from scrapypuppeteer import PuppeteerResponse, PuppeteerRequest
from scrapypuppeteer import PuppeteerRequest, PuppeteerResponse
from scrapypuppeteer.browser_managers import BrowserManager
from scrapypuppeteer.request import CloseContextRequest, ActionRequest
from scrapypuppeteer.request import ActionRequest, CloseContextRequest
from scrapypuppeteer.response import (
PuppeteerHtmlResponse,
PuppeteerScreenshotResponse,
Expand Down Expand Up @@ -50,7 +50,9 @@ async def open_new_page(self):
page_id = uuid.uuid4().hex.upper()

self.contexts[context_id] = await self.browser.new_context()
self.pages[page_id] = BrowserPage(context_id, page_id, await self.contexts[context_id].new_page())
self.pages[page_id] = BrowserPage(
context_id, page_id, await self.contexts[context_id].new_page()
)
self.context2page[context_id] = page_id

return context_id, page_id
Expand Down

0 comments on commit 7fefd7f

Please sign in to comment.