Cannot add cookie to page using Selenium with php

I use phpunit extension phpunit-selenium to run a test on my website using selenium mesh, but whenever I try to run tests in Internet Explorer, I get an error message:

Cannot add cookie to page (WARNING. Server did not provide any stacktrace)

The problem seems to be related to the phpunit-selenium attempt, but unable to set the cookie "PHPUNIT_SELENIUM_TEST_ID".

I found sample code to set and delete cookies from here , and the interesting thing is, the code from the link runs just fine on IE, displaying the contents of the cookie, but when I try to add cookies to my site, it fails.

I tried possible solutions, such as getting a website before trying to set a cookie, and turning off Protected Mode.

Is there another security setting in IE or something that I am missing?

+4
source share
4 answers

I had a similar problem with testing Selenium in IE9.
Try setting IE as your default browser.

http://kenhirakawa.com/selenium-unable-to-add-cookie-to-page/

+1
source

I used this solution and it works for me, i.e. eleven

  • try using 32-bit IEDriverServer.exe against IE 10 or 11, even on a 64-bit version of Windows
  • Uncheck Enable Protected Mode in Internet Explorer on the Security tab for all zones
+1
source

I had this error because I was following the tutorial. Ironing is amazing.

The first example in the documentation is for PHPUnit_Extensions_Selenium2TestCase . All the others on the page are for PHPUnit_Extensions_SeleniumTestCase .

Maybe change

 extends PHPUnit_Extensions_Selenium2TestCase 

to

 extends PHPUnit_Extensions_SeleniumTestCase 
0
source

Not sure if this will work, but it’s definitely worth a try, Open IE as an administrator and inside Internet Options, on the Security tab, uncheck the Enable Protected Mode box. Now try repeating the selenium tests.

-one
source

Source: https://habr.com/ru/post/1498644/


All Articles