How to Synchronize Selenium

Synchronization:

2Providing wait to the tool is known as synchronization. It is to maintain in synch between application &tool

2It is two types

1)page load

2)page refresh

1) Page load:-If the application is taking time to load the page then use the command

2Advantages of above command is, it doesn’t wait up to the given time .whenever the page load is completed ,it contains the execution. the given time is the maximum time to wait .

2) Page refresh:-

2if the application is taking time to refresh the page then use the below command

Thread.sleep(5000);  //5secs

2It is a standard wait .It is simply wait upto the given time.

2When ever we use thread. Sleep add throws. Exception to method &main method became it’s a java command . some of the java commands will throw exception  to handle it use throws exception.

2Write a program to register into mail.in.com by using methods?

Interested in mastering Selenium Training? Enroll now for FREE demo on Selenium Training Courses.

Note:-when ever the application is taking time either for page load or page refresh use selenium. Wait for page load command ,if it is throwing exception like timeout then change the wait forpageload command to thread.sleep() command.

Assignments:-

1) Write a program to test login functionality gmail,facebook&yahoo.com

2) Complete the mail registration scenario?

2Write a program to click on links like Hindi, Bengali, Telugu in google.co.in

2Write a program to click on links like Hindi, Bengali, Telugu by passing parameter  to the method.

Check out the top Selenium Interview Questions now!

Prog:- 

Package selenium rc;

Import com.throughworth.selenium.defaultselenium;

Public class googlelanguages-parameter{

Public defaultselenium selenium = new defaultselenium(“localhost”,1234,”firefox”,”//http:”)

Public void open url(){

Selenium.start();

Selenium.open();

Selenium.windowmaximize();

}

Public void clicklanguages(string str){

Selenium.click(“link=”+str);

Selenium.waitforpage to load(“3000”);

Selenium.click(“link=English”);

}

Public static void main(string[] args){

Googlelanguages-parameter g=new googlelanguages-parameter();

g.open url();

g.click language(“hindi”);

g.click language(“Bengali”);

g.click language(“telugu”);

}

For an Indepth knowledge on Selenium, click on below