Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cookie Seemed to be destroyed in between #196

Closed
Binit-Dhakal opened this issue May 7, 2023 · 1 comment
Closed

Cookie Seemed to be destroyed in between #196

Binit-Dhakal opened this issue May 7, 2023 · 1 comment

Comments

@Binit-Dhakal
Copy link

Description

I am trying to login into the https://countyfusion5.kofiletech.us/countyweb/loginDisplay.action?town=&countyname=Franklin by clicking the "Login as a guest button" using playwright-scrapy, but am redirected to this URL "https://countyfusion5.kofiletech.us/countyweb/loginDisplay.action?countyname=Base&errormsg=error.invalid.struts2.token". When I try with playwright alone, there seems to be no problem but with scrapy-playwright I am getting the issue.

Code to reproduce

class SfranklinohioSpider(scrapy.Spider):
    name = 'sFranklinOhio'

    def start_requests(self):
        yield scrapy.Request(
            "https://countyfusion5.kofiletech.us/countyweb/loginDisplay.action?countyname=Franklin",
            meta={
                'playwright': True,
                "playwright_include_page": True,
                "playwright_page_methods": [
                    PageMethod("click", "input.basebold1"),
                ],
                "playwright_context": "har_saver"
            },
            callback=self.login_as_guest
        )

    async def login_as_guest(self, response):
         await page.wait_for_timeout(10000)

My takeway

I used har_saver as playwright context with code

PLAYWRIGHT_CONTEXTS = {
  "har_saver": {
    'record_har_path': 'check_franklin.har'
  },
}

to see the har file and I can see that during login POST request cookies are not sent. I don't know the reason for this but will appreciate it if anyone can help with this or point me in the correct direction.

Please let me know if I need to provide any thing more to help you reproduce this bug.

Thank you,
Binit

@Binit-Dhakal
Copy link
Author

The same issue was raised in #149 and the #149 (comment) answer of PLAYWRIGHT_PROCESS_REQUEST_HEADERS=None did the trick for me.
Thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant