Synchronization:
Providing wait for the tool is known as synchronization. It is to maintain in synch between application &tool
It 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
The advantages of the above command are, 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:-
if the application is taking time to refresh the page then use the below command Thread.sleep(5000); //5secs
It is a standard wait. It is simply waiting up to the given time.
Whenever we use thread. Sleep add throws. The 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.
Write 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 for page load command to thread.sleep() command.
Assignments:-
1) Write a program to test login functionality gmail,facebook&yahoo.com
2) Complete the mail registration scenario?
Write a program to click on links like Hindi, Bengali, Telugu in google.co.in
Write 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 click languages(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 In-depth knowledge on Selenium, click on below
- Io streams /external files in Selenium
- Selenium Grid
- Conditional statements in Selenium
- Different flavors of Selenium
- Selenium WebDriver Features