Run batch file or any .exe application using Webdriver apis?

1,450 views
Skip to first unread message

Kailash Gajara

unread,
Feb 29, 2012, 1:56:56 PM2/29/12
to seleniu...@googlegroups.com
Hi,

I need to launch tests written in selenium webdriver and that test will eventually run a batch file or .exe application and wait till that application is completed. So depending on results from batch file run, my script in selenium will proceed. I found out following solution using native java fn,

                        // Run application
// Run AutoIt script
// String[] commands = new String[]{};
// String AutoItScriptpath = "c:\\test\\saveImage.exe";
// commands = new String[]{AutoItScriptpath };
// Runtime.getRuntime().exec(commands);

My question is that "is there any better way of doing this task?" specially using webdriver. 

Thanks

Kailash

David

unread,
Feb 29, 2012, 7:33:43 PM2/29/12
to Selenium Users
Nope, as far as I know, the WebDriver API, and JSONWireProtocol has no
method to execute an external application.

So what you have found is the best solution.

But do note that that solution restricts you to the local machine.
Won't run under Grid2 mode or RemoteWebDriver.

To use it with those, you either need to execute the application
remotely as well using a tool like PsExec.exe or use/build a client-
server connection where WebDriver/Java code is client and server will
listen for command to execute the application remotely. Client server
examples are using XML-RPC or SOAP or REST web service (server resides
on machine executing the application, WebDriver client runs remotely
elsewhere via RemoteWebDriver or Grid2). Personally, I prefer web
service (XML-RPC) route than to go with PsExec, because it is more
cross platform.

FYI, remote call from Linux to Windows would use winexe tool rather
than PsExec.exe. And remote call from Windows/Linux to Linux/Mac would
be over SSH rather than winexe/PsExec.

Krishnan Mahadevan

unread,
Feb 29, 2012, 9:10:02 PM2/29/12
to seleniu...@googlegroups.com
David
If all that Kailash wants is the ability to kick off selenium tests based on the execution status of a batch or any exe for that matter and assuming that this batch/exe resides in a place which can be accessed via a network share I dont think Grid executions are going to be a restriction. What you did say makes sense when coupling webdriver tests with autoIT code but here I think it has no connections with each other. 
--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To post to this group, send email to seleniu...@googlegroups.com.
To unsubscribe from this group, send email to selenium-user...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/selenium-users?hl=en.



--
Thanks & Regards
Krishnan Mahadevan

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"
My Scribblings @ http://wakened-cognition.blogspot.com/

Mark Collin

unread,
Jun 14, 2012, 11:53:00 AM6/14/12
to seleniu...@googlegroups.com

Don’t mix JMeter and Selenium.  They have different objectives and trying to merge them together will end in pain/un targeted and potentially unmaintainable test scripts.

 

It may seem like a quick win at first, but in the long run you are just setting yourself up for some serious pain.

 

From: seleniu...@googlegroups.com [mailto:seleniu...@googlegroups.com] On Behalf Of aakash attrey
Sent: 14 June 2012 07:42
To: seleniu...@googlegroups.com
Subject: [selenium-users] Re: Run batch file or any .exe application using Webdriver apis?

 

Hi,
I want to launch j-meter scripts that can be launched by a batch file.My concerns is to how do i launch that particular batch file in my test run in selenium?Is that even possilble?

--

You received this message because you are subscribed to the Google Groups "Selenium Users" group.

To view this discussion on the web visit https://groups.google.com/d/msg/selenium-users/-/82aoRydV9h4J.


To post to this group, send email to seleniu...@googlegroups.com.
To unsubscribe from this group, send email to selenium-user...@googlegroups.com.

For more options, visit this group at http://groups.google.com/group/selenium-users?hl=en-US.

Krishnan Mahadevan

unread,
Jun 14, 2012, 12:34:44 PM6/14/12
to seleniu...@googlegroups.com
Mark
I would like to understand more about the long term pain with this. Can you please shed more light on what might end up becoming potential problems?
--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To post to this group, send email to seleniu...@googlegroups.com.
To unsubscribe from this group, send email to selenium-user...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/selenium-users?hl=en-US.

Mark Collin

unread,
Jun 15, 2012, 6:29:01 AM6/15/12
to seleniu...@googlegroups.com

JMeter tests should be testing load, and not functionality.

 

A functional Selenium test where you log into a site and then interact with some client side JavaScript and check that things look right on the screen is completely incompatible with a load test IMHO.

 

·         With a Selenium test you are testing the website to ensure that it functions correctly when a user interacts with it.

·         With a JMeter test you are hammering the webserver to see what sort of traffic it can deal with/at what point it falls over, checking that a menu drops down when you mouse pointer hovers over it is a pointless exercise.

 

There will be some tests that could meet both requirement above, but in my experience a one size fits all solution usually results in a watered down test that is neither functional nor load and is rarely fit for purpose.

 

I have seen attempts to use Selenium to play through scenarios that you record with the JMeter proxy, but generally speaking you then need to go through the recorded JMeter test to strip out the chaff and put in extra functionality anyway.  The time saved by recording an automated Selenium test with the JMeter proxy is negligible at best.

Reply all
Reply to author
Forward
0 new messages