Continuous Integration and WebDriver !!Urgent!!

762 views
Skip to first unread message

Rodrigue

unread,
Jul 28, 2010, 8:37:55 PM7/28/10
to webdriver
Hi all,

I'm trying to run my automated tests (work fine in my eclipse ide) on
hudson, which is installed on a debian lenny headless server.

To be able to run the automated tests for the UI, I installed Xvfb.
The FirefoxWebDriver points now on a bash script containing the
following command:

xvfb-run -s "-screen 1 1280x1024x24" /usr/local/bin/firefox $1 $2 $3
$4 $5

The command (a wrapper in reality) makes it easy to start a new Xvfb
server for each application you need to run, which lets you run
multiple tests at a time without the applications conflicting with
each other.

I can run the script from the terminal without a problem. Firefox is
started (I recongnize it because the console doesn't return until I
pressed CTRL+C).

Therefore the FirefoxDriver implementation does have problem with it.
The following exception is namely thrown:

org.openqa.selenium.firefox.NotConnectedException: Unable to connect
to host [0:0:0:0:0:0:0:1%1] on port 7055 after 45000 ms
[junit] at
org.openqa.selenium.firefox.internal.NewProfileExtensionConnection.start(NewProfileExtensionConnection.java:
88)
[junit] at
org.openqa.selenium.firefox.FirefoxDriver.startClient(FirefoxDriver.java:
163)
[junit] at
org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:
72)
[junit] at
org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:
141)
[junit] at
org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:
101)

I would like to know if someone out there got automated Ui Test to
work on Xvfb ( a virtual frame buffer X server)

Many many thanks for any help.

Cheers
Message has been deleted

sqa tester

unread,
Jul 29, 2010, 2:42:47 PM7/29/10
to webdriver
keep your WebDriver test code the same. In your test code, You do not
need to modify FirefoxWebDriver
to point to command that starts Xvfb.

Instead, in my case, i have a script that runs my test and contains
the following:

1. export DISPLAY=":n" --> where n = any integer
2. start Xvfb on screen n
3. run your test

When running test headless from ssh, the display needs to be
specified, then you can start Xvfb and tests will be able to run on
the display
you specified.

hope this helps.

-Kathleen

Rodrigue Lagoue Njinthe

unread,
Jul 29, 2010, 2:51:49 PM7/29/10
to webd...@googlegroups.com
Thanks Kathleen for your answer, I will test it now

hope this helps.

-Kathleen

--
You received this message because you are subscribed to the Google Groups
"webdriver" group.
To post to this group, send email to webd...@googlegroups.com.
To unsubscribe from this group, send email to
webdriver+...@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/webdriver?hl=en.

Rodrigue Lagoue Njinthe

unread,
Jul 29, 2010, 2:53:47 PM7/29/10
to webd...@googlegroups.com
Hi Kathleen,

don't you stop the Xvfb server after all your tests are finished?

Thanks
Rodrigue

-----Original Message-----
From: webd...@googlegroups.com [mailto:webd...@googlegroups.com] On
Behalf Of sqa tester
Sent: Thursday, July 29, 2010 8:38 PM
To: webdriver
Subject: [webdriver] Re: Continuous Integration and WebDriver !!Urgent!!

keep your scripts the same. You do not need to modify FirefoxWebDriver


to point to command that starts Xvfb.

Instead,

export DISPLAY=":n" --> where n = any integer


start Xvfb on screen n

run your test

When running test headless from ssh, the display needs to be

specified, then you can start Xvfb and it will run it on the display
you specified.

hope this helps.

-Kathleen

On Jul 28, 5:37 pm, Rodrigue <rlag...@googlemail.com> wrote:

--

sqa tester

unread,
Jul 29, 2010, 4:13:05 PM7/29/10
to webdriver
i don't. i just keep it running. it might be a good idea to stop it
but i havent gotten to that yet.

On Jul 29, 11:53 am, "Rodrigue Lagoue Njinthe"

Rodrigue Lagoue Njinthe

unread,
Jul 29, 2010, 4:34:48 PM7/29/10
to webd...@googlegroups.com
After following your advice I get a strange error.. here is it

org.openqa.selenium.WebDriverException: Failed to connect to binary
FirefoxBinary(/usr/local/bin/firefox) on port 7055; process output follows:
?*** e = [Exception... "Component returned failure code: 0x80570016
(NS_ERROR_XPC_GS_RETURNED_FAILURE) [nsIJSCID.getService]" nsresult:
"0x80570016 (NS_ERROR_XPC_GS_RETURNED_FAILURE)" location: "JS frame ::
chrome://browser/content/utilityOverlay.js :: getShellService :: line 326"
data: no]


System info: os.name: 'Linux', os.arch: 'i386', os.version:
'2.6.18-028stab064.7', java.version: '1.6.0_20'
Driver info: driver.version: firefox
at
org.openqa.selenium.firefox.internal.NewProfileExtensionConnection.start(New
ProfileExtensionConnection.java:100)
at
org.openqa.selenium.firefox.FirefoxDriver.startClient(FirefoxDriver.java:163
)


at
org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:72)

at
org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:141)

at
cm.bao.warehouse.ui.gwt.client.WarehouseGwtUiTestCase.createFirefoxDriver(Wa
rehouseGwtUiTestCase.java:61)
at
cm.bao.warehouse.ui.gwt.client.WarehouseGwtUiTestCase.getParameters(Warehous
eGwtUiTestCase.java:78)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
Caused by: org.openqa.selenium.firefox.NotConnectedException: Unable to


connect to host [0:0:0:0:0:0:0:1%1] on port 7055 after 45000 ms

at
org.openqa.selenium.firefox.internal.NewProfileExtensionConnection.start(New
ProfileExtensionConnection.java:88)

sqa tester

unread,
Jul 29, 2010, 7:38:42 PM7/29/10
to webdriver
I am not sure what's wrong.

Do you start Xvfb the same way you specified above?

When I start my Xvfb I do not specify the browser at all.

Also, are you on Selenium 2.0a5? I am finding some issues with 2.0a5
that are working fine on 2.0a4. I need to investigate further before I
post the issue.

On Jul 29, 1:34 pm, "Rodrigue Lagoue Njinthe" <rlag...@googlemail.com>

Rodrigue Lagoue Njinthe

unread,
Jul 29, 2010, 7:47:41 PM7/29/10
to webd...@googlegroups.com
Hi!

I started in this case as a standalone programm on the server
Pass the Display using an instance of FirefoxBinary

here is the code:
FirefoxBinary firefoxBinary = new FirefoxBinary();
firefoxBinary.setEnvironmentProperty("DISPLAY",
":1");
ProfilesIni allProfiles = new ProfilesIni();
FirefoxProfile profile =
allProfiles.getProfile("default");
DRIVERS.put(WEBDRIVERS_FIREFOX, new
FirefoxDriver(firefoxBinary, profile));

And finally pass the path to firefox by specifying the system variable "
webdriver.firefox.bin"

Yes I'm on selenium 2.0a5? if necessary I could go back to the previous
version.

Many Thanks for all

Rodrigue Lagoue Njinthe

unread,
Jul 29, 2010, 8:06:37 PM7/29/10
to webd...@googlegroups.com
Hi!

I got a connection using x11vnc on the server just to see what is going on
there. I could see that during the 45 seconds, the firefox browser was
started, but the webdriver didn't set the url to load.

I think the real problem is that here:

[Exception... "Component returned failure code: 0x80570016
(NS_ERROR_XPC_GS_RETURNED_FAILURE) [nsIJSCID.getService]" nsresult:
"0x80570016 (NS_ERROR_XPC_GS_RETURNED_FAILURE)" location: "JS frame ::
chrome://browser/content/utilityOverlay.js :: getShellService :: line 326"
data: no] "

And seems to be independent from webdriver...

I don't know if some people out there already got and solved such a problem
on firefox...

Many Thanks for your help

Rodrigue

-----Original Message-----
From: webd...@googlegroups.com [mailto:webd...@googlegroups.com] On
Behalf Of sqa tester

Sent: Friday, July 30, 2010 1:39 AM

Felipe Knorr Kuhn

unread,
Jul 29, 2010, 12:55:06 PM7/29/10
to webd...@googlegroups.com
Which CI server are you using?

Hudson has a very easy to setup plugin called Xvnc, which does it all for you.

That's what I've been using and it's working great so far.

FK

Rodrigue Lagoue Njinthe

unread,
Jul 31, 2010, 9:34:27 AM7/31/10
to webd...@googlegroups.com
Hi All

@Felipe

I'm using Hudson...

Thanks for any help
Rodrigue

-----Original Message-----
From: webd...@googlegroups.com [mailto:webd...@googlegroups.com] On

Felipe Knorr Kuhn

unread,
Jul 31, 2010, 1:22:26 PM7/31/10
to webd...@googlegroups.com
Rodrigue, are you using the xvnc plugin?

It takes care of all the boring startup/shutdown process during your build:

Starting xvnc
[workspace] $ vncserver :11

New 'X' desktop is feons:11

Starting applications specified in /home/knorr/.vnc/xstartup
Log file is /home/knorr/.vnc/feons:11.log

[postExample] $ ant -file build.xml deploy
Buildfile: /home/knorr/.hudson/jobs/Post Example/workspace/postExample/build.xml
Trying to override old definition of datatype resources

compile, deploy and test targets invoked

[testng] ===============================================
[testng] Sample Application Tests
[testng] Total tests run: 1, Failures: 0, Skips: 0
[testng] ===============================================
[testng]

BUILD SUCCESSFUL
Total time: 30 seconds
Terminating xvnc.
$ vncserver -kill :11
Killing Xtightvnc process ID 16789
Recording test results
[htmlpublisher] Archiving HTML reports...
[htmlpublisher] Archiving at PROJECT level
/home/knorr/.hudson/jobs/Post
Example/workspace/postExampleTest/report/html to
/home/knorr/.hudson/jobs/Post Example/htmlreports/HTML_Report
Finished: SUCCESS

Are your tests running OK if you don't try to run them headless?

FK

Rodrigue Lagoue Njinthe

unread,
Jul 31, 2010, 3:17:39 PM7/31/10
to webd...@googlegroups.com
Hi Felipe,

" Rodrigue, are you using the xvnc plugin?"

no I don't, is it a hudson plugin?

Many Thanks

Felipe Knorr Kuhn

unread,
Jul 31, 2010, 3:49:18 PM7/31/10
to webd...@googlegroups.com
Yes.

It's available at the plugin setup page (Manage Hudson -> Manage Plugins).

After installing it, you'll have an option in your project to enable Xvnc.

FK

On Sat, Jul 31, 2010 at 4:17 PM, Rodrigue Lagoue Njinthe

Rodrigue Lagoue Njinthe

unread,
Jul 31, 2010, 3:52:54 PM7/31/10
to webd...@googlegroups.com
OK I'm installing it.

Do you know if it also work with the Xvfb server. I cannot find something
about it on the plugin page... I'm asking it, because the vncserver cannot
be find from the sources configured on my debian lenny server...

Many thanks..

Rodrigue Lagoue Njinthe

unread,
Jul 31, 2010, 5:42:59 PM7/31/10
to webd...@googlegroups.com
Hi Felipe,

I installed the xvnc plugin, hudson says it starts vnc server, but the
problem still persists...

perhaps it's a problem with firefox installation. What would be strange,
since I can surf on internet with it...

Many thanks

Rodrigue Lagoue Njinthe

unread,
Aug 1, 2010, 7:15:00 PM8/1/10
to webd...@googlegroups.com
Hi Felipe,

I did it like you mentioned before. My display variable is ":1" but the xvnc plugin start the server at :10

Here is what is printed at start of the hudson job
------------
Starting xvnc
[workspace] $ vncserver :10

New 'X' desktop is myserver.net:10

Starting applications specified in /home/appdir/.vnc/xstartup
Log file is /home/appdir/.vnc/myserver.net:10.log
------------


Here is what is printed when the hudson job is finished
-------
Terminating xvnc.
$ vncserver -kill :10
Killing Xtightvnc process ID 13859
Zeichne Testergebnisse auf.
----------------

I also connected to this display from my client using a vnc client. I can see that firefox get started (Probably from Webdriver), but Webdriver somehow doesn't set the url to the application like it should. The Firefox stays open 45s (the time out) and then get killed.

After all I receive an email with the following error:

-----------
Error Message:
Failed to connect to binary FirefoxBinary(/usr/local/bin/firefox) on port 7055; process output follows: �*** e = [Exception... "Component returned failure code: 0x80570016 (NS_ERROR_XPC_GS_RETURNED_FAILURE) [nsIJSCID.getService]" nsresult: "0x80570016 (NS_ERROR_XPC_GS_RETURNED_FAILURE)" location: "JS frame :: chrome://browser/content/utilityOverlay.js :: getShellService :: line 326" data: no] System info: os.name: 'Linux', os.arch: 'i386', os.version: '2.6.18-028stab064.7', java.version: '1.6.0_20' Driver info: driver.version: firefox
---------------

Seems like it's a firefox issue. Does anybody already solved such a problem?

Many thanks?

Rodrigue Lagoue Njinthe

unread,
Aug 1, 2010, 7:41:41 PM8/1/10
to webd...@googlegroups.com
Or perhaps there is a problem with the process of starting firefox with
webdriver? I'm telling it because, when I starts the vncserver as daemon,
start firefox and connect on it via the tightvncclient, I can work with
firefox without a problem...

Thanks for your help

Simon Stewart

unread,
Aug 2, 2010, 4:57:03 AM8/2/10
to webd...@googlegroups.com
You said:

" My display variable is ":1" but the xvnc plugin start the server at :10"

I'd suggest that your DISPLAY (in capitals) value should be ":10"

Simon

On Mon, Aug 2, 2010 at 12:41 AM, Rodrigue Lagoue Njinthe

Rodrigue Lagoue

unread,
Aug 2, 2010, 8:36:47 AM8/2/10
to webd...@googlegroups.com
Hi Simon

first of all thanks for your reply. I can confirm that my display is setted to :1, since i can see it when running the command "env" from a terminal. The other evidence is that, when starting it the xvnc server manually from the command line. I get the message:

New 'X' desktop is server:1

Thanks again for your reply
Rodrigue

Felipe Knorr Kuhn

unread,
Aug 2, 2010, 10:15:26 AM8/2/10
to webd...@googlegroups.com
Rodrigue,

If you launch your tests from Hudson and the xvnc plugin, you don't
need to set the display variable before launching firefox, all
processes spawned by hudson will be redirected to the new display
managed by xvnc.

Since you said you could connect to :10 and see Firefox opening, I
really don't know what else could be wrong.

After searching the group, this seems to be a frequent issue:

https://groups.google.com/group/webdriver/search?group=webdriver&q=7055&qt_g=Search+this+group

I would think that the Firefox extensions are not being installed
properly, but I have no idea how to solve this. Have you tried setting
different profiles?

FK

On Sun, Aug 1, 2010 at 8:15 PM, Rodrigue Lagoue Njinthe

Rodrigue Lagoue Njinthe

unread,
Aug 2, 2010, 2:48:24 PM8/2/10
to webd...@googlegroups.com
Hi Felipe,

thanks for your replies. I found it nice... I also think I should check the configuration of firefox on my server...

Rodrigue Lagoue Njinthe

unread,
Aug 4, 2010, 4:47:40 PM8/4/10
to webd...@googlegroups.com
Hi Felipe, Kathleen and all those who tried to help for this problem,

I have just found a workaround with the help of someone who had practically a similar problem.

Why it didn't work?

It seems like the firefox installed on my debian (lenny) headless server doesn't convert from "localhost" to "127.0.0.1" automatically.
The firefox process starts and listen to the address "127.0.0.1:7055" (seen in the output of netstat command), whereas the FirefoxDriver instance tries to make a connection to it using "localhost:7055". The following code from the class FirefoxDriver confirms it:

@Override
protected void startClient() {
LazyCommandExecutor exe = (LazyCommandExecutor) getCommandExecutor();
FirefoxProfile profileToUse = getProfile(exe.profile);
profileToUse.addWebDriverExtensionIfNeeded(false);

// TODO(simon): Make this not sinfully ugly
ExtensionConnection connection = connectTo(exe.binary, profileToUse, "127.0.0.1");
exe.setConnection(connection);

try {
connection.start();
} catch (IOException e) {
throw new WebDriverException("An error occurred while connecting to Firefox", e);
}
}

The solution:
To fix it I just extended the class FirefoxDriver and overrided the #connectTo() method. Since the #startClient() Method uses private classes in it. Here is the code:

--
/**
*
* @author rodrigue
*
*/
public class BaoFirefoxDriver extends FirefoxDriver {

private static final String Localhost = "localhost";
private static final String LocalhostIp = "127.0.0.1";

public BaoFirefoxDriver() {
super();
}

public BaoFirefoxDriver(Capabilities capabilities) {
super(capabilities);
}

public BaoFirefoxDriver(FirefoxBinary binary, FirefoxProfile profile) {
super(binary, profile);
}

public BaoFirefoxDriver(FirefoxProfile profile) {
super(profile);
}

@Override
protected ExtensionConnection connectTo(FirefoxBinary binary,
FirefoxProfile profile, String host) {
String hostToUse = host;
if (Localhost.equalsIgnoreCase(host)) {
hostToUse = LocalhostIp;
}
return super.connectTo(binary, profile, hostToUse);
}

}
------
@Simon

It would be nice to give us a change to change the localhost value more easily.


Thanks again for your help

sqa tester

unread,
Aug 4, 2010, 4:52:08 PM8/4/10
to webdriver
Thanks for providing solution to issue you came across with.

On Aug 4, 1:47 pm, "Rodrigue Lagoue Njinthe" <rlag...@googlemail.com>
wrote:
> https://groups.google.com/group/webdriver/search?group=webdriver&q=70...
> ...
>
> read more »

Tomás Pollak

unread,
Aug 4, 2010, 5:46:05 PM8/4/10
to webd...@googlegroups.com
Do you have the line
127.0.0.1 localhost
in your /etc/hosts file?

Rodrigue Lagoue Njinthe

unread,
Aug 4, 2010, 5:52:59 PM8/4/10
to webd...@googlegroups.com

Hi Thómas,

 

no I don't (I just checked it)

Bartosz Majsak

unread,
Sep 3, 2010, 12:17:36 PM9/3/10
to webdriver
Hi everyone,

I was struggling with similar problem today. I'm using Hudson slave to
make headless builds and xvnc plugin to run firefox and webdriver
tests in it.
I was using selenium 2.0a5 version and having similar exception as
mentioned in this thread (ubuntu 10.04 x64, firefox 3.6.8).
When I rolled back to the 2.0a4 version everything is working fine. I
also tried approach with overriding connectTo but it does not work as
well.

So maybe there is some a small issue with firefox driver in alpha5?

Best regards,
Bartosz


On Aug 4, 11:52 pm, "Rodrigue Lagoue Njinthe" <rlag...@googlemail.com>
wrote:
> Hi Thómas,
>
> no I don't (I just checked it)
>
> From: webd...@googlegroups.com [mailto:webd...@googlegroups.com] On Behalf Of Tomás Pollak
> Sent: Wednesday, August 04, 2010 11:46 PM
> To: webd...@googlegroups.com
> Subject: Re: [webdriver] Continuous Integration and WebDriver !!Urgent!!
>
> Do you have the line
> 127.0.0.1 localhost
> in your /etc/hosts file?
>
> https://groups.google.com/group/webdriver/search?group=webdriver<https://groups.google.com/group/webdriver/search?group=webdriver&q=70...> &q=7055&qt_g=Search+this+group
> >>> webdriver+...@googlegroups.com <mailto:webdriver%2Bunsu...@googlegroups.com> .
> >>>> For more options, visit this group at
> >>>http://groups.google.com/group/webdriver?hl=en.
>
> >>> --
>
> >>> You received this message because you are subscribed to the Google Groups
> >>> "webdriver" group.
> >>> To post to this group, send email to webd...@googlegroups.com.
> >>> To unsubscribe from this group, send email to
> >>> webdriver+...@googlegroups.com <mailto:webdriver%2Bunsu...@googlegroups.com> .
> >>> For more options, visit this group at
> >>>http://groups.google.com/group/webdriver?hl=en.
>
> >>> --
>
> >>> You received this message because you are subscribed to the Google Groups
> >> "webdriver" group.
> >>> To post to this group, send email to webd...@googlegroups.com.
> >>> To unsubscribe from this group, send email to
> >> webdriver+...@googlegroups.com <mailto:webdriver%2Bunsu...@googlegroups.com> .
> >>> For more options, visit this group at
> >>http://groups.google.com/group/webdriver?hl=en.
>
> >> --
>
> >> You received this message because you are subscribed to the Google Groups
> >> "webdriver" group.
> >> To post to this group, send email to webd...@googlegroups.com.
> >> To unsubscribe from this group, send email to
> >> webdriver+...@googlegroups.com <mailto:webdriver%2Bunsu...@googlegroups.com> .
> >> For more options, visit this group at
> >>http://groups.google.com/group/webdriver?hl=en.
>
> >> --
>
> >> You received this message because you are subscribed to the Google Groups "webdriver" group.
> >> To post to this group, send email to webd...@googlegroups.com.
> >> To unsubscribe from this group, send email to webdriver+...@googlegroups.com <mailto:webdriver%2Bunsu...@googlegroups.com> .
> >> For more options, visit this group athttp://groups.google.com/group/webdriver?hl=en.
>
> > --
>
> > You received this message because you are subscribed to the Google Groups "webdriver" group.
> > To post to this group, send email to webd...@googlegroups.com.
> > To unsubscribe from this group, send email to webdriver+...@googlegroups.com <mailto:webdriver%2Bunsu...@googlegroups.com> .
> > For more options, visit this group athttp://groups.google.com/group/webdriver?hl=en.
>
> > --
>
> > You received this message because you are subscribed to the Google Groups "webdriver" group.
> > To post to this group, send email to webd...@googlegroups.com.
> > To unsubscribe from this group, send email to webdriver+...@googlegroups.com <mailto:webdriver%2Bunsu...@googlegroups.com> .
> > For more options, visit this group athttp://groups.google.com/group/webdriver?hl=en.
>
> --
> You received this message because you are subscribed to the Google Groups "webdriver" group.
> To post to this group, send email to webd...@googlegroups.com.
> To unsubscribe from this group, send email to webdriver+...@googlegroups.com <mailto:webdriver%2Bunsu...@googlegroups.com> .
> For more options, visit this group athttp://groups.google.com/group/webdriver?hl=en.
>
> --
> You received this message because you are subscribed to the Google Groups "webdriver" group.
> To post to this group, send email to webd...@googlegroups.com.
> To unsubscribe from this group, send email to webdriver+...@googlegroups.com <mailto:webdriver%2Bunsu...@googlegroups.com> .
> For more options, visit this group athttp://groups.google.com/group/webdriver?hl=en.
Reply all
Reply to author
Forward
0 new messages