Cookies in clientOptions #468
Replies: 2 comments
-
Hi, Finally Regards |
Beta Was this translation helpful? Give feedback.
-
Hi again :) Now I got another Task and I want to click something with the Browsershot::click() method. Is it possible, that the click will be executed only once at the start of the crawl and wont be called by the following crawls? e.g. I want to accept the cookieconsent one time, and after that its already accepted, but i got the problem that all other pages dont know the cookieconsent?! |
Beta Was this translation helpful? Give feedback.
-
Hey there :)
I'm using the Spatie crawler to crawl Cookies from a website. To Receive all cookies I need to "Accept" the CookieConsent. Therefor I would like to set a cookie before the crawler visits the website.
I found out that the Crawler swap the "RequestOptions::COOKIES => true" Option to an empty CookieJar.
After that I tried to instanciate a CookieJar and provide it as the value instead true but that didnt work.
Another try was to set a Header option like this:
RequestOptions::HEADERS => [
'User-Agent' => Crawler::DEFAULT_USER_AGENT,
'Set-Cookie' => '{testName=testValue; path=/; secure; HttpOnly}',
]
But this is still not working. Do you have an idea how I can set cookies, before the crawler visits a website?
Beta Was this translation helpful? Give feedback.
All reactions