Closed spooning closed 9 years ago
Originally submitted to Google Code by @pekkaklarck on 9 Dec 2010
This is most likely a Jython issue. I've seen this happen on other operating systems so this probably isn't Win7 related.
Do you Bastian have interest to test the approach you pointed out?
Originally submitted to Google Code by basti1... on 9 Dec 2010
Yes. I had planned to revisit this issue when time permits. I think I can do that in the next days. It is probably not Win7 related, but I guess it only happens on OSes which have an IPv6 stack installed at all - so it won't happen on WinXP, for example (just my guess).
Originally submitted to Google Code by @pekkaklarck on 13 Jan 2011
Bastian, have you had time to look at this? We are planning the scope of SeleniumLibrary 2.6 release and it would be nice to include this issue too.
Originally submitted to Google Code by basti1... on 13 Jan 2011
Sorry for not getting back to this issue although I promised to do so. I can't believe it's been nearly two month since I filed the issue :-((
However, I finally found some time to investigate it yesterday.
1) This behaviour can also be observed with a more current stack than the one I originally reported it for. I tried with the following installers:
python-2.7.1.amd64.msi jython_installer-2.5.2rc3.jar robotframework-2.5.5.win-amd64.exe robotframework-seleniumlibrary-2.5.win-amd64.exe
2) I don't think that this can easily be fixed or worked around in RF or selenium library. As far as I can see it happens in selenium.py in do_command(self, verb, args). The relevant lines are
200: conn = httplib.HTTPConnection(self.host, self.port) 212: conn.request("POST", "/selenium-server/driver/", body, headers)
In my case, self.host was "localhost". The solution would involve restricting the name resolution for "localhost" to only return IPv4 addresses and no IPv6 addresses. However it seems there is no way to control this when using httplib.HTTPConnection.
Actually, this error needs to be fixed in Jython's httplib.py. There is already an (quite old) issue in their bugtracker: http://bugs.jython.org/issue1210. I don't really understand why they did not bother to fix it, because the fix is extremely easy. I will post a comment their providing a patch, maybe the are willing to include it.
In the meantime, I think this issue here can be closed as "won't fix".
Originally submitted to Google Code by basti1... on 14 Jan 2011
Actually, jython issue 1210 is not really the right issue because it is about jython not supporting IPv6 and not about the confusing error message when no connection can be established. I therefore filed a new issue:
http://bugs.jython.org/issue1697
Kind regards,
Bastian
Originally submitted to Google Code by @pekkaklarck on 14 Jan 2011
Thanks a lot for your detailed analysis Bastian! Great that you also submitted an issue to Jython's tracker.
We actually can workaround this pretty easily on the library by catching the AssertionError raised by Jython in addition to socker.error the code already catches. The related code tries to connect to Selenium Server multiple times to wait if it is slow to start.
I just committed the fix revision 814071c5e6 so this issue can be considered Done. I hope the new summary somehow describes what was fixed.
When running a robot test using seleniumlibrary on Windows 7/64 bit and Selenium RC is not available, the following error is reported:
Setup failed: Only AF_INET sockets are currently supported on jython
Python 2.7 Jython 2.5.1 robotframework 2.5.1 robotframework-seleniumlibrary-2.4.win32
(All of this are a bit old, I guess, I probably should check if this still appears with the latest versions.)
My guess is the following: Say I configured localhost:45678 as the address of selenium server. On Win 7, if nothing is found at localhost:45678, something somehow resolves localhost to a IPv6 address and tries to open a connection. Then jython complains that it can only handle IPv4 (aka AF_INET).
This may be a jython issue.
Or maybe robotframework can work around that issue. You might want to have a look here: http://web.archiveorange.com/archive/v/8tc1ZoGKsa9aSvd95jF2
"The way to retrieve only AF_INET results from getaddrinfo is to pass AF_INET as the family parameter, e.g.
for res in socket.getaddrinfo(host, port, socket.AF_INET, socket.SOCK_STREAM): af, socktype, proto, canonname, sa = res"
Regards
Bastian