I am a java beginner.
Could someone help me with how to authenticate in runtime, whenever asked for username and password using java. I am trying this
public class Open{
int i=0;
public static void main(String[] args) {
while(i<1){
try {
Process p = Runtime.getRuntime().exec("C:\\Program Files\\Internet Explorer\\iexplore.exe \"my web page"");
Thread.sleep(2000);
// code to fill form
System.out.print("Return value was " + p.waitFor());
i=i+1;
}
catch (Exception e)
{}
}
}
}
But this one asks for password before the page gets loaded due to ldap in my place. how to pass this automatically?
You can do something like that, but you have to change completely your approach. Forget about calling IE (or any other browser) as an external command, what you should use is a framework that allows you to mock the interactions of a user with a web page. For instance, HttpUnit .