LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 04-07-2011, 07:54 AM   #1
brownie_cookie
Member
 
Registered: Mar 2011
Location: Belgium
Distribution: CentOS release 5.5 (Final), Red Hat Enterprise Linux ES release 4 (Nahant Update 8)
Posts: 416
Blog Entries: 2

Rep: Reputation: 12
XVFB


Hi all

I'm running a Linux server and I'm working with Selenium.
so i made a test case with Selenium (to check a website) , i exported it to a java file, and i did actually everything i need to do to get this to work BUT when i run the script like

Code:
./check_selenium.sh -b "http://www.google.com" -c "some.folder.name.Rc" -t "*firefox"
and then i get this error:
Code:
UNKNOWN - some.folder.name.Rc: Got some problems: java.lang.RuntimeException: Could not start Selenium session: Failed to start new browser session: Error while launching browser |;;;;
(btw, i still didn't found the solution of that error...)
but the main thingie is that the test must be done in the background, no need to open a webbrowser and let everything run and than close the webbrowser, i just need it to test the website and give me back some result.
And i've read some articles about how to run it headless, and with XVFB is the one that pops out...

I installed it with
Code:
yum install Xvfb
I've found some code that normally should work
Code:
startx -- `which Xvfb` :1 -screen 0 1024x768x24
but now what?
Can someone help me pls how i should run my testcase of selenium on the background (perhaps with Xvfb?)
 
Old 04-07-2011, 02:23 PM   #2
theNbomr
LQ 5k Club
 
Registered: Aug 2005
Distribution: OpenSuse, Fedora, Redhat, Debian
Posts: 5,396
Blog Entries: 2

Rep: Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908
I've never used Xvfb with startx; normally, I just run it standalone:
Code:
Xvfb :1 -auth /etc/xauth.xvfb -fbdir /tmp &
I have a simple authorization file containing simply 'localhost'. After having launched the Xvfb, you can let it serve X to your applications by setting $DISPLAY accordingly:
Code:
export DISPLAY=localhost:1
The ':1' corresponds with the similar argument to Xvfb

Now, if we want to test it, we can launch some application using it.
Code:
# Use commandline '-display' argument as alternative to setting $DISPLAY
xterm -display localhost:1 &
Since there is no visible display presented by the virtual X server, we don't see anything. However, the virtual display can be viewed as a snapshot, since it is stored on our filesystem as a xwd formatted file. We can view a snapshot of the file with xwud:
Code:
xwud -in /tmp/Xvfb_screen0
--- rod.
 
Old 04-15-2011, 02:19 AM   #3
brownie_cookie
Member
 
Registered: Mar 2011
Location: Belgium
Distribution: CentOS release 5.5 (Final), Red Hat Enterprise Linux ES release 4 (Nahant Update 8)
Posts: 416
Blog Entries: 2

Original Poster
Rep: Reputation: 12
Sorry for the late reply
i tried what you suggested, but after the first command i get the following error:
Code:
[root@monitor2 testmap]# Xvfb :1 -auth /etc/xauth.xvfb -fbdir /tmp &
[1] 14407
[root@monitor2 testmap]# _XSERVTransSocketINETCreateListener: ...SocketCreateListener() failed
_XSERVTransMakeAllCOTSServerListeners: server already running

Fatal server error:
Cannot establish any listening sockets - Make sure an X server isn't already running
unlink: No such file or directory
unlink  failed, errno 2
[1]+  Exit 1                  Xvfb :1 -auth /etc/xauth.xvfb -fbdir /tmp
so he says a x server is already running, how can i see that and how can i kill that proces?

UPDATE:
Nice thing to know is that everything works, so i can use the command like this:
Code:
./check_selenium -c "com.example.tests.login" -b "http://website.com" -t "*firefox"
this works, but as you probably know, he opens a browser, which i don't want !!
So HOW can i do this, without the webbrowser, so i guessed with XVFB, but i don't know how this works (i'm not familiar with that)

Thanks in advance

Last edited by brownie_cookie; 04-15-2011 at 02:22 AM.
 
Old 04-15-2011, 09:38 AM   #4
theNbomr
LQ 5k Club
 
Registered: Aug 2005
Distribution: OpenSuse, Fedora, Redhat, Debian
Posts: 5,396
Blog Entries: 2

Rep: Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908
Quote:
Originally Posted by brownie_cookie View Post
Sorry for the late reply
i tried what you suggested, but after the first command i get the following error:
Code:
[root@monitor2 testmap]# Xvfb :1 -auth /etc/xauth.xvfb -fbdir /tmp &
[1] 14407
[root@monitor2 testmap]# _XSERVTransSocketINETCreateListener: ...SocketCreateListener() failed
_XSERVTransMakeAllCOTSServerListeners: server already running

Fatal server error:
Cannot establish any listening sockets - Make sure an X server isn't already running
unlink: No such file or directory
unlink  failed, errno 2
[1]+  Exit 1                  Xvfb :1 -auth /etc/xauth.xvfb -fbdir /tmp
so he says a x server is already running, how can i see that and how can i kill that proces?
It is a process, so you can kill it just like any other process. Find the process in the process list, using 'ps', and then send it a kill signal. But, that will probably kill your normal X server. If so, then the better approach would be to simply use a different server number. Change the ":1" everywhere to ":2" and retry. Read the X man page for details. If you still have remnants from your first try using startx, then maybe that is the existing X server. If so, kill it and retry.

--- rod.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Xvfb question ndo Linux - General 1 05-18-2007 11:49 AM
Xvfb and gnome dogalmity Linux - General 0 07-26-2006 11:23 AM
Xvfb not loading at startup novaprime Linux - Software 4 07-08-2005 11:05 AM
xvfb issues asyoung Linux - General 0 07-14-2003 12:49 PM
Xvfb listening to all IP addresses? ericcarlson Linux - General 0 09-10-2002 06:30 AM


All times are GMT -5. The time now is 11:55 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration