Selenium RC Programmes

There are some Selenium RC Programmes given here:

Ques: Write a program to Login into Facebook?

Program:

Package SeleniumRC;

Import com.thoughtworks.selenium.default selenium;

Public class facebook_login {

Public static void main (string [] args) {

// to do auto-generated method stub

Default Selenium  Selenium = new Default Selenium (“local host”, 4444, “*firefox”,” https://www.facebook.com/”);

Selenium.start ();     //Launch browser

Selenium.open (“https://www.facebook.com/”);  //enter and open the given url

Selenium.window maximize();   //it will maximize the window screen to the full width.

Selenium.type (“email”, example@email.com);   //enter the given credential in Email field.

Selenium.type (“pass”, example);   //enter the given credential in Password field.

Selenium.click(“u_0_2”);   //this command is for the click on the Log In Button.

}

}

 

Ques: Write a program to Login into Gmail.com by valid credentials?

Program:

Package SeleniumRC;

Import com.thoughtworks.selenium.default selenium;

Public class gmail_login {

Public static void main (string [] args) {

// to do auto-generated method stub

Default Selenium  Selenium = new Default Selenium (“local host”, 4444, “*firefox”,” https://gmail.com”);

Selenium.start ();     //Launch browser

Selenium.open (“https:// https://gmail.com”);  //enter and open the given url

Selenium.window maximize();   //it will maximize the window screen to the full width.

Selenium.type (“identifierId”, example@gmail.com);   //enter the given credential in Email field.

Selenium.click (“identifierNext”);   //click on the Next button

Thread.sleep (2000);   //2secs

Selenium.type (“password”, example);   //enter the given credential in Password field.

Selenium.click(“passwordNext”);   //this command is for the click on the Log In Button.

}

}

 

Ques: Write a program to Login into Yahoo mail?

Program:

Package SeleniumRC;

Import com.thoughtworks.selenium.default selenium;

Public class yahoo_login {

Default Selenium  Selenium = new Default Selenium (“local host”, 4444, “*firefox”,” https://www.yahoo.com/”);

Public void Open_url(){

Selenium.start ();     //Launch browser

Selenium.open (“https://www.yahoo.com/”);  //enter and open the given url

Selenium.window maximize();   //it will maximize the window screen to the full width.

}

Public void Login() {

Selenium.click (“uh-signin”);  // click on Sign In button

Selenium.type (“login-username”, example@yahoo.com);   //enter the given credential in Email field.

Selenium.click (“login-signin”);   // click on Next button

Thread.sleep (2000)   //2secs wait

Selenium.type (“login-passwd”, example);   //enter the given credential in Password field.

Selenium.click(“login-signin”);   //this command is for the click on the Sign In Button.

}

Public static void main (string [] args) {

// to do auto-generated method stub

yahoo_login m=new yahoo_login();

m.Open_url();

m.Login();

}

Useful Links:

Please click here to read Selenium RC Specification

Please click here to read Steps for creating a project in Eclipse

Please click here to read Selenium Configuration with Java

Please click here to read Selenium Components

Please click here to read Selenium IDE

Please click here to read Advantages and limitations of Selenium IDE

Leave a Comment