Aliases in /etc/hosts for 127.0.0.1 causes a "Bad request" error
See original GitHub issueMeta -
OS: Debian 7.10
Selenium Version: 2.53.0
Browser: Firefox
Browser Version: 45 (package is 45.1.0esr-1~bpo70+1)
I’ve created a daemon which, when run, starts up Xvfb and Selenium 2.53.0 in the background. When I run my test, I get the following error:
When I visit "user" # Drupal\DrupalExtension\Context\MinkContext::assertAtPath()
Could not open connection: Bad request
Command duration or timeout: 11 milliseconds
Build info: version: '2.53.0', revision: '35ae25b', time: '2016-03-15 17:00:58'
System info: host: 'server.example.net', ip: ‘172.xx.xx.xx', os.name: 'Linux', os.arch: 'amd64', os.version: '3.2.0-4-amd64', java.version: '1.7.0_101'
Driver info: org.openqa.selenium.firefox.FirefoxDriver (Behat\Mink\Exception\DriverException)
After discussing with a colleague, it was determined the error was occurring due to the order of the 127.0.0.1 entry in /etc/hosts, which directly relates to https://github.com/seleniumhq/selenium-google-code-issue-archive/issues/3280. I have this in /etc/hosts:
127.0.0.1 localhost.localdomain localhost
When I reverse that to be:
127.0.0.1 localhost localhost.localdomain
the test runs fine.
The /etc/hosts file is Puppet managed across our infrastructure, but more importantly, it was correct in the first place: an FQDN should come first followed by the short name.
In the archived issue linked above, this issue seems to have been fixed since 2.43.0, so it looks like there has potentially been a regression of sorts?
Does anyone else still experience this issue using the latest standalone server, 2.53.0?
Steps to reproduce
This would be to simply adjust your /etc/hosts file and put localhost in front of any other aliases, like so:
127.0.0.1 localhost localhost.localdomain alias etc
Thanks, Emlyn
Issue Analytics
- State:
- Created 7 years ago
- Comments:11 (4 by maintainers)
I see same issue sin 2.53.1 as well. The setPref doesn’t fix it for me, only modifying the /etc/hosts, yet since it is puppet managed, that’s ephemeral at best.
@pcooper19 the original issue was related to Firefox, if you are facing an problem with Chrome, please open a new issue with all the info required by the template.
Since no one has provided a way to reproduce the issue, and it is mostly related to Selenium versions < 3.0.0, I will close this issue. Feel free to reopen if a complete, step by step way to reproduce is provided.