Discussion:
[selenium-users] AutoIT integration with selenium script - issue
Manfred Lobo
2018-12-06 20:21:38 UTC
Permalink
Hi All,

I face the issue " Cannot run program, CreateProcess error=2, The system
cannot find the file specified" for the following code.

Getting error in runAutoIT method present at the end of the code. Your help
is highly appreciated.

code is as follows:

package com.cstudymaven.testscript;

import org.openqa.selenium.support.ui.WebDriverWait;
import org.testng.annotations.Test;

import com.cstudymaven.utilities.ReadExcel;
import com.cstudymaven.pompages.EditProfile;
import com.cstudymaven.pompages.SignInPage;
import com.cstudymaven.utilities.BaseTest;

public class TestScript extends BaseTest
{
SignInPage signin = null;
EditProfile edprf=null;
@Test
public void signUp()
{
String[][] credentials = ReadExcel.getData(filePath, "User_Login");
try {

for (int i = 1; i < credentials.length; i++) {
String email = credentials[i][0];
String password = credentials[i][1];
signin = new SignInPage(driver);
signin.clickonLogin();
Thread.sleep(1500);
signin.enterEmail(email);
Thread.sleep(1500);
signin.enterPassword(password);
signin.clicktoStart();
edprf=new EditProfile(driver);
wait = new WebDriverWait(driver, 10);
Thread.sleep(1500);
edprf.editprofile();
Thread.sleep(1500);
edprf.gotoprofile();
Thread.sleep(1500);
edprf.editlogo();
Thread.sleep(1500);
edprf.camera();
Thread.sleep(2500);
edprf.cfile();
Thread.sleep(1500);
runAutoIT(); //AutoIT function
}
}
catch (Exception e)
{
e.printStackTrace();
try
{

}
catch (Exception e1)
{

}

}
}

//AutoIT method to handle windows dialog box

public void runAutoIT() throws Exception
{
String
strFilePath="C:\\Users\\LOBO\\Desktop\\Manfred\\Resume\\1Amanfred.jpg";
String
strPath="C:\\Users\\LOBO\\eclipse-workspace\\CaseStudyMaven\\InputData\\cstudymaven.exe";
String strParameter=strPath+""+strFilePath;
Runtime.getRuntime().exec(strParameter);
}

}
--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to selenium-users+***@googlegroups.com.
To post to this group, send email to selenium-***@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/481c3a7c-6f89-4268-9768-25fe9af6f106%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
connect2tech
2018-12-08 17:30:51 UTC
Permalink
In the following line, you have to specify the path of executable file

Runtime.getRuntime().exec(strParameter);

It should be

Runtime.getRuntime().exec(strPath);

Check out guru99.com. This has been explained very well there.

Regards,
~NC
https://goo.gl/DEYjrg
https://goo.gl/aemgkS
Post by Manfred Lobo
Hi All,
I face the issue " Cannot run program, CreateProcess error=2, The system
cannot find the file specified" for the following code.
Getting error in runAutoIT method present at the end of the code. Your
help is highly appreciated.
package com.cstudymaven.testscript;
import org.openqa.selenium.support.ui.WebDriverWait;
import org.testng.annotations.Test;
import com.cstudymaven.utilities.ReadExcel;
import com.cstudymaven.pompages.EditProfile;
import com.cstudymaven.pompages.SignInPage;
import com.cstudymaven.utilities.BaseTest;
public class TestScript extends BaseTest
{
SignInPage signin = null;
EditProfile edprf=null;
@Test
public void signUp()
{
String[][] credentials = ReadExcel.getData(filePath, "User_Login");
try {
for (int i = 1; i < credentials.length; i++) {
String email = credentials[i][0];
String password = credentials[i][1];
signin = new SignInPage(driver);
signin.clickonLogin();
Thread.sleep(1500);
signin.enterEmail(email);
Thread.sleep(1500);
signin.enterPassword(password);
signin.clicktoStart();
edprf=new EditProfile(driver);
wait = new WebDriverWait(driver, 10);
Thread.sleep(1500);
edprf.editprofile();
Thread.sleep(1500);
edprf.gotoprofile();
Thread.sleep(1500);
edprf.editlogo();
Thread.sleep(1500);
edprf.camera();
Thread.sleep(2500);
edprf.cfile();
Thread.sleep(1500);
runAutoIT(); //AutoIT function
}
}
catch (Exception e)
{
e.printStackTrace();
try
{
}
catch (Exception e1)
{
}
}
}
//AutoIT method to handle windows dialog box
public void runAutoIT() throws Exception
{
String
strFilePath="C:\\Users\\LOBO\\Desktop\\Manfred\\Resume\\1Amanfred.jpg";
String
strPath="C:\\Users\\LOBO\\eclipse-workspace\\CaseStudyMaven\\InputData\\cstudymaven.exe";
String strParameter=strPath+""+strFilePath;
Runtime.getRuntime().exec(strParameter);
}
}
--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to selenium-users+***@googlegroups.com.
To post to this group, send email to selenium-***@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/7160a942-7d52-4477-aa26-32761861d48e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Loading...