Skip to content

Commit

Permalink
Updated test for RecaptchaSolver
Browse files Browse the repository at this point in the history
  • Loading branch information
MatthewZMSU committed Apr 26, 2024
1 parent 23cfb8d commit d9ed4e1
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion scrapypuppeteer/response.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ def __init__(self, url, puppeteer_request, context_id, page_id, data, **kwargs):
super().__init__(url, puppeteer_request, context_id, page_id, **kwargs)


class PuppeteerRecaptchaSolverResponse(PuppeteerJsonResponse):
class PuppeteerRecaptchaSolverResponse(PuppeteerJsonResponse): # TODO: to inherit from HTMLResponse (or think about better solution to the problem!)
"""
Response for RecaptchaSolver.
Result is available via self.recaptcha_data and self.data["recaptcha_data"]
Expand Down
5 changes: 5 additions & 0 deletions tests/mockserver.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,9 +137,14 @@ def _form_response(self, page_id, context_id, close_page):

class RecaptchaSolver(LeafResource):
def _form_response(self, page_id, context_id, close_page):
html = """
<html> <head></head> <body>clicked</body>
"""
return {
"contextId": context_id,
"pageId": page_id,
"html": html,
"cookies": None,
"recaptcha_data": {
"captchas": [1], # 1 captcha
"some_other_fields": [],
Expand Down

0 comments on commit d9ed4e1

Please sign in to comment.