1

I am working on phpunit-selenium for browser automation with headless Firefox. I updated both selenium and Firefox to latest version. And it started throwing error for me.

“PHPUnit_Extensions_Selenium2TestCase_WebDriverException: Bad request“

Now I googled for this and found that this issue is related to hosts files:

Unable to call FirefoxDriver constructor

https://code.google.com/p/selenium/issues/detail?id=3280

But I cannot update hosts file due to application restrictions. Is there another way to fix this?

Community
  • 1
  • 1
Deep123
  • 391
  • 1
  • 5
  • 18

1 Answers1

0

Modifying the profile should resolve the issue for you.

Note that this is a Java code fragment, You would have to do something similar with the php API:

   profile.setPreference(FirefoxProfile.ALLOWED_HOSTS_PREFERENCE,"set.myhost.com");
Anupam Saini
  • 2,431
  • 2
  • 23
  • 30
  • Yeah I notice this in java. But not able to find any documentation/help in php for same. – Deep123 Jun 30 '15 at 07:06
  • I hope these answers help: http://stackoverflow.com/questions/7328494/selenium2-firefox-use-the-default-profile http://stackoverflow.com/questions/14791156/how-does-one-use-a-custom-firefox-profile-with-phpunits-webdriver-framework – Anupam Saini Jun 30 '15 at 07:10
  • Here is the feature request to add firefox profile in php, Check your version. https://code.google.com/p/php-webdriver-bindings/issues/detail?id=18 – Anupam Saini Jun 30 '15 at 07:11
  • Not sure if this idea is feasible or not .. If i create separate host file and set Firefox to consider that file as host .:( – Deep123 Jun 30 '15 at 07:23