Quality Testing

Quality is delighting customers

How to launch a batch file in a Selenium Webdriver project?

How to launch a batch file in a Selenium Webdriver project?

Views: 145

Reply to This

Replies to This Discussion

Hi Madhavi Latha

In your case ,You can Automate your Windows bases operation using AutoIT ,U can convert it in .exe and u can run that file using Selenium Webdriver .

Following is code to execute .exe file

namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
//Login

IWebDriver driver = new InternetExplorerDriver(@"C:\Users\Administrator\Documents\IEDriverServer_Win32_2.32.3");
driver.Navigate().GoToUrl("http://192.192.6.153/CRMPOC/main.aspx");
Thread.Sleep(4000);
Process.Start("C:\\Users\\Administrator\\Desktop\\http_IE8.exe");

}
}
}

Let me know if any queries. for more info please visit: selenium tutorial

Thanks Kavya!

Hi Madhavi,

Since Selenium WebDriver is being used in various automation testing company but it does not support Windows application, and hence we need to use 3rd party tool like Auto IT and use the following piece of code to execute it:

Process P1=Runtime.getRuntime.exec("PathOfBatchFile");

P1.waitFor();

Hope this helps.

Thanks
Anand

Thanks Anand!

RSS

TTWT Magazine


Advertisement

Advertisement

Advertisement

Advertisement

© 2018   Created by Quality Testing.   Powered by

Badges  |  Report an Issue  |  Terms of Service