Last active
March 31, 2020 02:37
-
-
Save dsantuc/68b91f9c2fcc01d14802d60524afcd60 to your computer and use it in GitHub Desktop.
Getting all cookies from various BeHat/Mink browser drivers
Glad you found this useful. This was kind of a hack because I wanted to be able to reuse authenticated sessions across tests, as described here: https://www.gnaritas.com/2017/04/26/automated-testing-for-wordpress-4/
In my case, I needed to download a file using Guzzle while running Selenium tests. Downloading files using Selenium and moving them to the right location on the Docker container that runs Behat tests was a pain. The problem with Guzzle, however, is that it needs the cookie, since the file download needs authentication too. It's really the dual approach to accessing my SUT that made it necessary to extract cookies from Selenium and put them in a Guzzle CookieJar. I'll probably need to blog about this too :)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks! I had no idea that
->getWebDriverSession()->getAllCookies()
even existed. This method wasn't part of theDriverInterface
but specific to theSelenium2Driver
implementation, which is why I completely overlooked it.