I am using selenium rc with the code given below in eclipse
package com.example.tests;
import org.junit.*;
import com.thoughtworks.selenium.*;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import java.util.regex.Pattern;
public class Newclass extends SeleneseTestBase {
public void setUp() throws Exception {
selenium=new
DefaultSelenium("localhost",4444,"*chrome","http://www.google.com");
selenium.start();
}
public void testNewclass() throws Exception {
selenium.open("/");
selenium.type("gbqfq", "selenium");
selenium.click("link=Selenium - Web Browser Automation");
}
public void tearDown() throws Exception {
selenium.stop();
}
}
and getting error as
lo
address.getHostName() = localhost
address.getHostAddress() = 127.0.0.1
address.isLoopbackAddress() = true
eth0
address.getHostName() = ITEM-42569
address.getHostAddress() = 192.168.229.1
address.isLoopbackAddress() = false
eth1
address.getHostName() = ITEM-42569
address.getHostAddress() = 192.168.172.1
address.isLoopbackAddress() = false
eth2
address.getHostName() = item-42569.axway.int
address.getHostAddress() = 10.151.14.203
address.isLoopbackAddress() = false
Loopback interface LO:
lo
address.getHostName() = localhost
address.getHostAddress() = 127.0.0.1
address.isLoopbackAddress() = true
Please suggest to resolve this.
Thanks
Priyanka
Here is my configuration :
Build info: version: '2.20.0', revision: '16008', time: '2012-02-28
15:00:40'
System info: os.name: 'Linux', os.arch: 'i386', os.version: '2.6.32-6-pve',
java.version: '1.6.0_24'
The ifconfig command returns the following :
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:869352 errors:0 dropped:0 overruns:0 frame:0
TX packets:869352 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:1070565705 (1020.9 MB) TX bytes:1070565705 (1020.9 MB)
venet0 Link encap:UNSPEC HWaddr
00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00
inet addr:127.0.0.2 P-t-P:127.0.0.2 Bcast:0.0.0.0
Mask:255.255.255.255
UP BROADCAST POINTOPOINT RUNNING NOARP MTU:1500 Metric:1
RX packets:32998219 errors:0 dropped:0 overruns:0 frame:0
TX packets:30544855 errors:0 dropped:2 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:20522408319 (19.1 GB) TX bytes:13622815605 (12.6 GB)
venet0:0 Link encap:UNSPEC HWaddr
00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00
inet addr:178.33.141.16 P-t-P:178.33.141.16 Bcast:0.0.0.0
Mask:255.255.255.255
UP BROADCAST POINTOPOINT RUNNING NOARP MTU:1500 Metric:1
I've got that message :
org.openqa.selenium.firefox.NotConnectedException: Unable to connect to
host 127.0.0.2 on port 7056 after 45000 ms. Firefox console output:
*** LOG addons.xpi: startup
*** LOG addons.xpi: Ignoring file entry whose name is not a valid add-on
ID:
/var/lib/tomcat5.5/temp/anonymous9016981218572319765webdriver-profile/extensions/webdriver-staging
*** LOG addons.xpi: checkForChanges
*** LOG addons.xpi: No changes found
org.openqa.selenium.firefox.internal.NewProfileExtensionConnection.start(NewProfileExtensionConnection.java:95)
org.openqa.selenium.firefox.FirefoxDriver.startClient(FirefoxDriver.java:187)
org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:93)
org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:142)
org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:88)
org.opens.tanaguru.contentadapter.html.HTMLCleanerImpl.initWebDriver(HTMLCleanerImpl.java:108)
org.opens.tanaguru.contentadapter.html.HTMLCleanerImpl.run(HTMLCleanerImpl.java:78)
org.opens.tanaguru.contentadapter.ContentsAdapterImpl.run(ContentsAdapterImpl.java:89)
org.opens.tanaguru.contentadapter.ContentsAdapterImpl.run(ContentsAdapterImpl.java:73)
org.opens.tanaguru.service.ContentAdapterServiceImpl.adaptContent(ContentAdapterServiceImpl.java:53)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
java.lang.reflect.Method.invoke(Method.java:597)
org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:309)
org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183)
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:110)
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:89)
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)
$Proxy57.adaptContent(Unknown Source)
org.opens.tanaguru.service.AuditServiceThreadImpl.adaptContent(AuditServiceThreadImpl.java:281)
org.opens.tanaguru.service.AuditServiceThreadImpl.run(AuditServiceThreadImpl.java:158)
java.lang.Thread.run(Thread.java:662)
Firefox is being launched and is listening on 127.0.0.1.
As you can see, due to virtualization, the "venet" network interface is at
the same time a loopback address and not a loopback address.
The obtainLoopbackIp() method of the NetworkUtils called in the buildUrl()
method of the NewProfileExtensionConnection class returns the wrong
interface. So the driver tries to connect to it and causes the error.
I saw on the code that comment :
// Let's hope there's no such thing as network interfaces with mixed
addresses ;)
on the NetwordInterface class.
Well it seems I encounter that case and it causes the connection problem.
How can we fix this? How can I contribute?
Thanks
Koj
To be more precise, here are some details of the configuration :
Firefox driver version 2.20
Virtual Machine System : Ubuntu 8.04.4 LTS
Physical Host System : Proxmox 1.9 (based on Debian Lenny 5.0)
Mozilla Firefox 10.0.2
How can re-open this issue.
I fixed this by using the isLoopback() method of the native
java.net.NetwordInterface and saving the result as an attribute of the
class NetWorkInterface.
The method isLoopBack() returns now the value of this attribute and thus
avoid this weird computation that parses the different INETAddress of a
given NetworkInterface. I guess this attribute is trusted regarding its
low-level source.
About the getIp4LoopbackOnly() method, I also use that attribute, and I
consider that if the NetworkInterface is not seen as a loopack interface,
it has to automatically returns null to this method.
So this method now looks like :
public INetAddress getIp4LoopbackOnly() {
INetAddress lastFound = null;
if (!isLoopback) {
return lastFound;
}
// Goes by the wildly unscientific assumption that if there are more
than one set of
// loopback addresses, firefox will bind to the last one we get.
// An alternate theory if this fails is that firefox prefers 127.0.0.1
// Most "normal" boxes don't have multiple addresses so we'll just
refine this
// algorithm until it works.
// See NetworkUtilsTest#testOpenSuseBoxIssue1181
for (INetAddress inetAddress : inetAddresses) {
if (inetAddress.isLoopbackAddress() && inetAddress.isIPv4Address()) {
lastFound = inetAddress;
}
}
return lastFound;
}
What do you think? Does that behaviour match with all the use cases?
Thanks
Regards
Koj
Same problem here. Connecting to Selenium Server using Remote Webdriver
gives:
selenium.common.exceptions.WebDriverException: Message: u'Unable to connect
to host 127.0.0.2 on port 7055 after 45000 ms.
To be more odd Remote Webdriver fails while Firefox Webdriver works just
fine. I do not think it is related to Iceweasel as Firefox as I do not get
this error on other machines than hudson. I suppose it is purely related to
net connection spec.
******
System info: Linux hudson 2.6.32-042stab054.5 x86_64 GNU/Linux
Selenium: version 2.21.0, build 16552
Selenium bindings for Python 2.7
Browser info: Mozilla Iceweasel 10.0.3
*******
Remote traceback:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/lh/.virtualenvs/test-manager/lib/python2.7/site-packages/selenium/webdriver/remote/webdriver.py",
line 60, in __init__
self.start_session(desired_capabilities, browser_profile)
File "/home/lh/.virtualenvs/test-manager/lib/python2.7/site-packages/selenium/webdriver/remote/webdriver.py",
line 102, in start_session
'desiredCapabilities': desired_capabilities,
File "/home/lh/.virtualenvs/test-manager/lib/python2.7/site-packages/selenium/webdriver/remote/webdriver.py",
line 153, in execute
self.error_handler.check_response(response)
File "/home/lh/.virtualenvs/test-manager/lib/python2.7/site-packages/selenium/webdriver/remote/errorhandler.py",
line 147, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message: u'Unable to connect
to host 127.0.0.2 on port 7055 after 45000 ms. Firefox console output:
Xlib: extension "RANDR" missing on display ":0".
*** LOG addons.xpi: startup\n*** LOG addons.xpi: Ignoring file entry whose
name is not a valid add-on ID:
/tmp/anonymous3953150894869654301webdriver-profile/extensions/webdriver-staging
*** LOG addons.xpi: checkForChanges
*** LOG addons.xpi: No changes found
' ; Stacktrace: Method start threw an error in
NewProfileExtensionConnection.java
*******
Selenium Server log: attached.
*******
java -classpath selenium-server.jar org.openqa.selenium.net.NetworkUtils
venet0
address.getHostName() = hudson
address.getHostAddress() = 10.38.146.45
address.isLoopbackAddress() = false
address.getHostName() = localhost
address.getHostAddress() = 127.0.0.2
address.isLoopbackAddress() = true
lo
address.getHostName() = localhost.rdev
address.getHostAddress() = 0:0:0:0:0:0:0:1%1
address.isLoopbackAddress() = true
address.getHostName() = localhost
address.getHostAddress() = 127.0.0.1
address.isLoopbackAddress() = true
Loopback interface LO:
lo
address.getHostName() = localhost.rdev
address.getHostAddress() = 0:0:0:0:0:0:0:1%1
address.isLoopbackAddress() = true
address.getHostName() = localhost
address.getHostAddress() = 127.0.0.1
address.isLoopbackAddress() = true
****
/etc/hosts
::1 localhost ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
127.0.0.1 localhost.localdomain localhost
# Auto-generated hostname. Please do not remove this comment.
10.38.146.45 hudson
Tried different /etc/hosts settings (as proposed in #3280) but with no use.
I do not want to wage recompile server code so I really would appreciate
fixing this issue.
Attachments:
selenium-server.log 12.2 KB
@lukasz I think you're running in a vm and the output you're showing is
from the actual physical host ? What does the corresponding output inside
the VM look like ?
Comment #19 on issue 1181 by kristian...@gmail.com: Firefox driver
connection problem
http://code.google.com/p/selenium/issues/detail?id=1181
(No comment was entered for this change.)
I guess lukasz encountered the same problem as me.
The network configuration looks like mine and corresponds to VM's one.
The problem is due to the way a loopback interface is defined.
I suggested a correction, which seems to be trusted, due to the fact it is
based on java.net.NetworkInterface.
If we use this correction, its "venet0" won't be seen as a loopback
interface, and the second one (the "lo" one) will be returned.
Koj
@grom83 The "patch" you supply does not really compile. Any chance you can
supply a real patch ?
Here is how I fixed the NetworkInterface class.
I can compile it without any problem.
Koj
Attachments:
NetworkInterface.java 4.4 KB