且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

与最新版本的硒和Firefox不好的请求问题

更新时间:2023-11-29 20:57:04

修改个人资料应该可以解决您的问题。

请注意,这是一个Java代码片段,你将不得不做类似的PHP API:

$ p $ profile.setPreference(FirefoxProfile .ALLOWED_HOSTS_PREFERENCE, set.myhost.com);


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?

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");