How to run test cases without opening a browser.

1,322 views
Skip to first unread message

SAI ROSHAN

unread,
Jul 27, 2011, 6:44:36 AM7/27/11
to webdriver
I have a set of test cases prepared in My Eclipse, i run it using Run
As JUnit Test.
Now i want to run the test cases without opening a Firefox browser
window....
can some one give an idea in it... how can i do it??

I am using FirefoxDriver WebDriver and application is being run in
FireFox.

Thanks in advance.

Mark Collin

unread,
Jul 27, 2011, 6:56:46 AM7/27/11
to webd...@googlegroups.com
Use HTMLUnitDriver

Thanks in advance.

--
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.


--
This message contains confidential information and is intended only for the individual named. If you are not the named addressee you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately by e-mail if you have received this e-mail by mistake and delete this e-mail from your system. If you are not the intended recipient you are notified that disclosing, copying, distributing or taking any action in reliance on the contents of this information is strictly prohibited.

If you have received this email in error please notify postm...@ardescosolutions.com

Harish Kumar

unread,
Jul 27, 2011, 6:56:41 AM7/27/11
to webd...@googlegroups.com
use HtmlUnit Driver instead of Firefox Driver

--
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.




--
Thank You

HARISH KUMAR

darrell

unread,
Jul 27, 2011, 9:03:42 AM7/27/11
to webdriver
It should be noted that HTMLUnitDriver might not behave the same as
FirefoxDriver. No window will open but if the website is very
javascript (AJAX) heavy, you might find test cases failing due to a
false negative (problem with the test case not with the website).

I'm curious why you want to run the test cases without opening a
browser? If it is just a matter wanting to use the computer while the
test cases are running, you might wan to consider getting a cheap
computer and running the test cases with RemoteWebDriver. At my
company we have a small VMware image with Windows XP running and the
Selenium Server. I run the test cases on my local box but I use
RemoteWebDriver and have it control a browser on the Windows XP box.
So I never see the web browser running. If I want to see the tests
running i can either remote desktop to the VMware image or I can run a
Selenium Server on my local machine and change the code to run on
localhost rather than the IP of the VMware image.

Darrell

Harish Kumar

unread,
Jul 27, 2011, 9:15:27 AM7/27/11
to webd...@googlegroups.com
darrell, you are right.

HtmlUnit does not behave exactly as Firefox. (for examples, page Submission).

--
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.

Mark Collin

unread,
Jul 27, 2011, 9:29:56 AM7/27/11
to webd...@googlegroups.com
Agreed, but it is the only way to run without opening the browser. The
other drivers all drive the actual browser.

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

Darrell

--


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.


--

Marc Guillemot

unread,
Jul 27, 2011, 9:45:41 AM7/27/11
to webd...@googlegroups.com
Le 27/07/2011 15:15, Harish Kumar a �crit :
> ...

> HtmlUnit does not behave exactly as Firefox. (for examples, page
> Submission).

in many cases it does!
Note that you shouldn't compare the default settings of the
HtmlUnitDriver with Firefox as it is (wrongly in my opinion) simulating
IE7 with JS disabled.

Cheers,
Marc.
--
HtmlUnit support & consulting from the source
Blog: http://mguillem.wordpress.com

Bill Ross

unread,
Jul 27, 2011, 12:30:05 PM7/27/11
to webd...@googlegroups.com
> I have a set of test cases prepared in My Eclipse, i run it using Run
> As JUnit Test.
> Now i want to run the test cases without opening a Firefox browser
> window....
> can some one give an idea in it... how can i do it??

I found a way to do this by accident: if you set up sshd on a Windows
machine and ssh in (from same machine is ok) and start the test from
the cmd line, the browser will not show (This was Win XP).

Bill

SAI ROSHAN CHHETRI

unread,
Jul 28, 2011, 12:40:07 AM7/28/11
to webd...@googlegroups.com
Thanks Bill...can u put more light on that.....can u give some examples..
thanks
Roshu

SAI ROSHAN

unread,
Jul 28, 2011, 2:21:08 AM7/28/11
to webdriver
i tried a simple example using HtmlUnitDriver:ie

@Test
public void testhtml(){

HtmlUnitDriver driver = new
HtmlUnitDriver(BrowserVersion.FIREFOX_3);
driver.get("http://www.google.com");
System.out.print("title is " +driver.getTitle().toString());



}

it is not able to return the title...do i have to do some extra thing
here?
Can some one reply with an example?
thanks Roshu


On Jul 28, 9:40 am, SAI ROSHAN CHHETRI <rosunchet...@gmail.com> wrote:
> Thanks Bill...can u put more light on that.....can u give some examples..
> thanks
> Roshu
>

Bill Ross

unread,
Jul 28, 2011, 3:21:44 PM7/28/11
to webd...@googlegroups.com
You have to figure out ssh/sshd in cygwin. It worked in XP and I
haven't tried it in W7. The other detail is that I used putty to
log into 127.0.0.1 because I like the way that window works.

How you run from the cmd line depends on your environment. You might
launch via ant, maven, or java, according to your preference. In my
case I wasn't running with junit, and I just launched with a java
cmd wrapped in a shell script.

Bill

---

Thanks Bill...can u put more light on that.....can u give some examples..
thanks
Roshu

Levent

unread,
Sep 23, 2011, 3:07:09 PM9/23/11
to webdriver
Actually I ran into this "problem" today by accident.
Actually I wanted to run webdriver over cygwin/ssh on a windows box
because my ie is not supported on MAC.
I want to do this because somehow when I run the tests on remotedriver
some of them get stuck, and when I run them locally they run fine.
The problem is when I try the same tests over ssh, firefox and chrome
are running w/o opening the browser, and ie is not working at all!
When I run locally, webdriver works fine for ie, but when I try to run
the exact same script over ssh, I get the webdriver remote call to
http never returns and script gets stuck during browser
initialization.

Selenium 1 (the legacy one) used to work fine even when started over
ssh. I don't understand what causes this difference in webdriver
behavior when run locally vs. over ssh.
Is it looking for certain environment variables on Windows or what?


On Jul 28, 12:21 pm, Bill Ross <r...@cgl.ucsf.EDU> wrote:
> You have to figure out ssh/sshdin cygwin. It worked in XP and I
> haven't tried it in W7. The other detail is that I used putty to
> log into 127.0.0.1 because I like the way that window works.
>
> How you run from the cmd line depends on your environment. You might
> launch via ant, maven, or java, according to your preference. In my
> case I wasn't running with junit, and I just launched with a java
> cmd wrapped in a shell script.
>
> Bill
>
> ---
>
> Thanks Bill...can u put more light on that.....can u give some examples..
> thanks
> Roshu
>
>
>
>
>
>
>
>
>
> On Wed, Jul 27, 2011 at 10:00 PM, Bill Ross <r...@cgl.ucsf.edu> wrote:
> > > I have a set of test cases prepared in My Eclipse, i run it using Run
> > > As JUnit Test.
> > > Now i want to run the test cases without opening a Firefox browser
> > > window....
> > > can some one give an idea in it... how can i do it??
>
> > I found a way to do this by accident: if you set upsshdon a Windows
Reply all
Reply to author
Forward
0 new messages