block of statements which are accountable for a specific task.methods are reusable and can call from main() and with in the function.
Syntax: public static String funcName()
{
return "pass";
}
WAP to login into In.com
Note: whenever you are using methods in the program then we have declare the selenium object globally either public or private.
public : we can use the object with in the class as well as outside of the class.
private: we use the object with in a class only.
public static DefaultSelenium selenium=new defaultSelenium("localhost",4444,"*firefox","http://");
public static String openUrl()
{
selenium.start();
selenium.open("http://mail.in.com");
selenium.windowMaximize();
return "pass";
}
public static String login()
{
selenium.type("f_id","selenium_froum");// give username for mail.in
selenium.type("f_pwd","test12234");
selenium.click("css=input.signin");
return "pass";
}
public static void main(String args[])
{
openUrl();
login();
}
}
Syntax: public static String funcName()
{
return "pass";
}
WAP to login into In.com
Note: whenever you are using methods in the program then we have declare the selenium object globally either public or private.
public : we can use the object with in the class as well as outside of the class.
private: we use the object with in a class only.
public static DefaultSelenium selenium=new defaultSelenium("localhost",4444,"*firefox","http://");
public static String openUrl()
{
selenium.start();
selenium.open("http://mail.in.com");
selenium.windowMaximize();
return "pass";
}
public static String login()
{
selenium.type("f_id","selenium_froum");// give username for mail.in
selenium.type("f_pwd","test12234");
selenium.click("css=input.signin");
return "pass";
}
public static void main(String args[])
{
openUrl();
login();
}
}
No comments:
Post a Comment