Understanding Selenium IDE basic

How Base URL and open command work together in Selenium IDE?

Lets take wordpress site example

URL is http://demo.opensourcecms.com/wordpress/wp-login.php

in this url what is the base URL and what it the sub url?

BaseURL = http://demo.opensourcecms.com/wordpress/

SubURL = wp-login.php

 

Main purpose of seperating these URL is we can change our base url from beta website url to live url.

 

how to locating Locating by CSS using selenium IDE?

Please refer this blog – Link

how to locating Locating by Id using selenium IDE?

Please refer this blog – Link

how to locating Locating by Name using selenium IDE?

Please refer this blog – Link

how to locating Locating by XPath using selenium IDE?

Please refer this blog – Link

how to locating Locating Hyperlinks by Link Text using selenium IDE?

Please refer this blog – Link

How to use Locator Assistance to get other options to identify the webelement in selenium IDE?

Follow this blog entry before read this blog > Read ME

Target is used to identify webelement on the webpage

How many types for Locating Elements on the webpage?

Locating by Id / Locating by Name / Locating by XPath / Locating Hyperlinks by Link Text / Locating by CSS

We need to install two addons in firefox before moving forward

Firebug :: Add-ons for Firefox

FirePath :: Add-ons for Firefox

Using this addon we can get all details of webpage.

Locating by Id

Lets go on to WordPress web portal – http://demo.opensourcecms.com/wordpress/wp-login.php

We want to find Username textbox element on the webpage using ID of that element

For that start firebug.

use web element inspector to get location of Username element on the webpage.

We get following code for it. in which one attribute  id=”user_login” which is used to identify Username field at run time.

<input type="text" tabindex="10" size="20" value="" class="input" id="user_login" name="log" style="background-color: rgb(251, 251, 251);">

Locating by Name

Using Name of the webelement we get access of that at runtime.

In wordpress example name=”log” 

<input type="text" tabindex="10" size="20" value="" class="input" id="user_login" name="log" style="background-color: rgb(251, 251, 251);">

🙂 Locating by XPath 🙂 

Very useful…………..

For this we will firebug + firepath.

There are two ways of accessing element using xpath:

  1. absolute XPATH
  2. Relative XPATH

On wordpress website we get both as following to identify element

//*[@id='user_login']

 

html/body/div[1]/form/p[1]/label/input

We mostly use identical / relative xpath identify web element on the page.

Locating by XPath

Locating by XPath

Locating by XPath – By finding a nearby element with an id or name attribute (ideally a parent element) you can locate your target element based on the relationship

Locating Hyperlinks by Link Text

 <a title="Password Lost and Found" href="http://demo.opensourcecms.com/wordpress/wp-login.php?action=lostpassword" style="background-color: transparent;">Lost your password?</a>

 

 

Locating by CSS

What is CSS?

  • CSS stands for Cascading Style Sheets
  • Styles define how to display HTML elements

So in our wordpress example, Login page webelements has given some css

  • class=”input”
<input type="text" tabindex="10" size="20" value="" class="input" id="user_login" name="log" style="background-color: rgb(251, 251, 251);">

 

If we want to identify webelement using CSS given to it We should enter following values into Target field

css=input[type=”password”]

 

<input type="password" tabindex="20" size="20" value="" class="input" id="user_pass" name="pwad">

 

How many types for Locating Elements on the webpage?

Locating by Id

Locating by Name

Locating by XPath

Locating Hyperlinks by Link Text

Locating by CSS

Implicit Locators

What is Command, Target, and Value fields in selenium IDE?

Follow this blog entry before read this blog > Read ME and This

 

Command, Target, and Value

Command = This field having all commands list for selenium ide.

 

 

Target: all recorded web elements’ id goes into this. Target is used to identify webelement on the webpage. There are different way to Locating Elements on the webpage. like Locating by Id, Locating by Name, Locating by XPath, Locating Hyperlinks by Link Text, Locating by CSS, Implicit Locators. We will these all in next blogs.

In target field we get all recorded elements id for all testcases. This field dropdown is like an object repository.

 

Value: this field is simple value, stored on that recorded webelement during recording. or we can set new value for second run of the testcase.

what is Selenium IDE Test Case Pane ?

Follow this blog entry before read this blog > Read ME

 

Command, Target, and Value in editable mode

Command, Target, and Value in editable mode

In testcase pane recorded testcase steps are listed in readable Table format. This table have 3 columns Command, Target, and Value.

 

When we click on any of the row of the table we get all three fields Command, Target, and Value in editable mode. we can change values in that. check out the image for verifying correspondence

 

Lets check more on Command, Target, and Value on next blog.

what is selenium ide Source View?

Follow this blog entry before read this blog > Read ME

 

Source View in selenium IDE is displaying format of the recorded test-case which will actually going to store when we save testcase. Default this will save as HTML.

 

We can change this format to other languages as well.

 

 

Check out the HTML code of out Recorded Testcases.

LoginToWordPress

 

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head profile="http://selenium-ide.openqa.org/profiles/test-case">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link rel="selenium.base" href="http://demo.opensourcecms.com/" />
<title>New Test</title>
</head>
<body>
<table cellpadding="1" cellspacing="1" border="1">
<thead>
<tr><td rowspan="1" colspan="3">New Test</td></tr>
</thead><tbody>
<tr>
 <td>open</td>
 <td>/wordpress/wp-login.php</td>
 <td></td>
</tr>
<tr>
 <td>type</td>
 <td>id=user_login</td>
 <td>admin</td>
</tr>
<tr>
 <td>type</td>
 <td>id=user_pass</td>
 <td>demo</td>
</tr>
<tr>
 <td>type</td>
 <td>id=user_pass</td>
 <td>demo123</td>
</tr>
<tr>
 <td>clickAndWait</td>
 <td>id=wp-submit</td>
 <td></td>
</tr>

</tbody></table>
</body>
</html>

Check this code on Link

WriteNewPost

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head profile="http://selenium-ide.openqa.org/profiles/test-case">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link rel="selenium.base" href="http://demo.opensourcecms.com/" />
<title>New Test</title>
</head>
<body>
<table cellpadding="1" cellspacing="1" border="1">
<thead>
<tr><td rowspan="1" colspan="3">New Test</td></tr>
</thead><tbody>
<tr>
 <td>open</td>
 <td>/wordpress/wp-login.php</td>
 <td></td>
</tr>
<tr>
 <td>type</td>
 <td>id=user_login</td>
 <td>admin</td>
</tr>
<tr>
 <td>type</td>
 <td>id=user_pass</td>
 <td>demo</td>
</tr>
<tr>
 <td>type</td>
 <td>id=user_pass</td>
 <td>demo123</td>
</tr>
<tr>
 <td>clickAndWait</td>
 <td>id=wp-submit</td>
 <td></td>
</tr>

</tbody></table>
</body>
</html>

 

Check this code on LINK

Let’s Recording sample testcase.

We record testcases using Selenium IDE.

We record following two testcases

LoginToWordPress

WriteNewPost

 

Lets start FireFox browser and open Selenium IDE.

Click on record button of Selenium IDE.

Follow following steps to record first testcase

  1. Enter http://demo.opensourcecms.com/wordpress/wp-login.php URL into firefox address.
  2. Enter “admin” in the “Username” field
  3. Enter “demo123” in the “Password” field
  4. Click on the “Log In” button

Now save this testcase with name LoginToWordPress

 

 

Now record second TestCase WriteNewPost.

Go to file menu > New Test Case to add new testcase

Use Ctrl + S shortcut key to save this testcase with name WriteNewPost.

Click on Record button of Selenium IDE.

  1. Click on the “Posts” link
  2. Click on the “Add New” button
  3. Type “Selenium Demo Post” in the title field
  4. Click on the “Publish” button
WriteNewPost

WriteNewPost

 

Now we learn all basic Selenium IDE Features. Checkout next blog post.

 

How to Opening the Selenium IDE?

Its very easy 😉

Prerequisite : Selenium IDE should be install with firefox .

 

Steps:-

  1. Start firefox.
  2. Go to Tools menu.
  3. Select Selenium IDE option

OR

  1. Start firefox.
  2. Use Ctrl + Alt + S shortcut to start Selenium IDE

pencil come out from selenium IDE logo ! OMG

How to parameterize test in junit with example

@Parameters

The custom runner Parameterized implements parameterized tests. When running a parameterized test class, instances are created for the cross-product of the test methods and the test data elements.

 how to convert array to list in java ?

package myWorkjUnit;

import java.util.Arrays;
import java.util.List;

public class ArrayToList {
 public static void main(String[] argv) {

 String sArray[] = new String []{"Array A", "Array B", "Array C"};

 //convert array to list
 List<String> lList = Arrays.asList(sArray);

 System.out.println(lList);

 }

}

package myWorkjUnit;

import java.util.Arrays;
import java.util.Collection;

import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
import org.junit.runners.Parameterized.Parameters;

/*Structure of a parameterized test class

1. A static method that generates and returns test data,
2. A single constructor that stores the test data, and
3. A test.
*/

@RunWith(value = Parameterized.class)
public class ParameterizedTestExample {
 private int number1;

 /*
 * Constructor.
 * The JUnit test runner will instantiate this class once for every
 * element in the Collection returned by the method annotated with
 * @Parameters.
 */

 public ParameterizedTestExample(int number) {
 this.number1 = number;
 }

 /*
 * Test data generator.
 * This method is called the the JUnit parameterized test runner and
 * returns a Collection of Arrays. For each Array in the Collection,
 * each array element corresponds to a parameter in the constructor.
 */
 @Parameters
 public static Collection<Object[]> data() {

// In this example, the parameter generator returns a List of
// arrays. Each array has two elements: { datum, expected }.
// These data are hard-coded into the class, but they could be
// generated or loaded in any way you like.
 Object[][] data = new Object[][] { { 1 }, { 2 }, { 3 }, { 4 } };

 //convert array to list
 return Arrays.asList(data);
 }

/*
 * The test.
 * This test method is run once for each element in the Collection returned
 * by the test data generator -- that is, every time this class is
 * instantiated. Each time this class is instantiated, it will have a
 * different data set, which is available to the test method through the
 * instance's fields.
 */
 @Test
 public void pushTest() {
 System.out.println( "Parameterized Number is : " + number1);
 }
}

</pre>
Parameterized Number is : 1
Parameterized Number is : 2
Parameterized Number is : 3
Parameterized Number is : 4
<pre>


 

 

References

References

 

 

 

 

 

 

References:

Parameterized (JUnit API)

Link 1 Link 2 Link 3 Link 4 Link 5

What @Rule in jUnit? What is ErrorCollector() in jUnit? How to use ErrorCollector()? Benefits of ErrorCollector()?

 

 

 

 

 

 


Annotation Type Rule
Annotates fields that contain rules. Such a field must be public, not static, and a subtype of TestRule. The Statement passed to the TestRule will run any Before methods, then the Test method, and finally any After methods, throwing an exception if any of these fail. If there are multiple annotated Rules on a class, they will be applied in an order that depends on your JVM’s implementation of the reflection API, which is undefined, in general. For example, here is a test class that creates a temporary folder before each test method, and deletes it after each:

Class ErrorCollector

The ErrorCollector rule allows execution of a test to continue after the first problem is found (for example, to collect _all_ the incorrect rows in a table, and report them all at once):

Example 1:

package myWorkjUnit;

import junit.framework.Assert;

import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ErrorCollector;

public class LearnAssertions {

/*
 * The ErrorCollector Rule allows execution of a test to continue after the
 * first problem is found and report them all at once
 */
 @Rule
 public ErrorCollector errCol = new ErrorCollector();

 @Test
 public void testAdvertisingPrograms(){
 System.out.println("open browser and go to URL");
 System.out.println("click on link");
 System.out.println("click on one Login link");

 String actual = "actual";
 String expected = "Expected";
// if("ElementLocation" == "ElementLocation from abve statement"){
// System.out.println("Pass");
// }else{
// System.out.println("fail");
// report Error
// }

 System.out.println("before Assert.assertEquals(expected, actual)");

 try {
 Assert.assertEquals(expected, actual);
 } catch (Throwable e) {
 System.out.println("Report Error" + e);
 errCol.addError(e);
 }

 System.out.println("After Assert.assertEquals(expected, actual)");

 }

}

&nbsp;

Example 2: Lets collect more errors ……………

package myWorkjUnit;

import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ErrorCollector;

public class UsesErrorCollectorTwice {
 /*
 * The ErrorCollector Rule allows execution of a test to continue after the
 * first problem is found and report them all at once
 */
 @Rule
 public ErrorCollector collector= new ErrorCollector();

@Test
 public void example() {
 collector.addError(new Throwable("first thing went wrong"));
 collector.addError(new Throwable("second thing went wrong"));

 // all lines will run, and then a combined failure logged at the end.
 }

}

ErrorCollector

ErrorCollector

References:

Rule (JUnit API)

ErrorCollector (JUnit API)

Break !!

catch and handle assertion errors

Lets see what happens with lines after assertion statement

Assert.assertEquals(expected, actual);

 

package myWorkjUnit;

import junit.framework.Assert;

import org.junit.Test;

public class LearnAssertions {

@Test
 public void testAdvertisingPrograms(){
 System.out.println("open browser and go to URL");
 System.out.println("click on link");
 System.out.println("click on one Login link");

 String actual = "actual";
 String expected = "Expected";
// if("ElementLocation" == "ElementLocation from abve statement"){
// System.out.println("Pass");
// }else{
// System.out.println("fail");
// report Error
// }

 System.out.println("before Assert.assertEquals(expected, actual)");
 Assert.assertEquals(expected, actual);
 System.out.println("After Assert.assertEquals(expected, actual)");



 }

}

 

check out eclipse console after running above code using junit

 

following line of code is not executed because of assertion

System.out.println(“After Assert.assertEquals(expected, actual)”);

 

Lets handle this

We can use Try Catch block to handle assertion and catch error and continue further program execution.

package myWorkjUnit;

import junit.framework.Assert;

import org.junit.Test;

public class LearnAssertions {

@Test
 public void testAdvertisingPrograms(){
 System.out.println("open browser and go to URL");
 System.out.println("click on link");
 System.out.println("click on one Login link");

 String actual = "actual";
 String expected = "Expected";
// if("ElementLocation" == "ElementLocation from abve statement"){
// System.out.println("Pass");
// }else{
// System.out.println("fail");
// report Error
// }

 System.out.println("before Assert.assertEquals(expected, actual)");

 try {
 Assert.assertEquals(expected, actual);
 } catch (Throwable e) {
 System.out.println("Report Error" + e);
 }

 System.out.println("After Assert.assertEquals(expected, actual)");


 }

}

 

Lets check out console

 

Smart one 🙂

how to use assertions in junit ? part 1

What is assertion?

 

An assertion is a statement in the Java programming language that enables you to test your assumptions about your program. For example, if you write a method that calculates the speed of a particle, you might assert that the calculated speed is less than the speed of light.

Each assertion contains a boolean expression that you believe will be true when the assertion executes. If it is not true, the system will throw an error. By verifying that the boolean expression is indeed true, the assertion confirms your assumptions about the behavior of your program, increasing your confidence that the program is free of errors.

Experience has shown that writing assertions while programming is one of the quickest and most effective ways to detect and correct bugs. As an added benefit, assertions serve to document the inner workings of your program, enhancing maintainability.

 

Lets have a look for simple Example with jUnit:

Condition : expected = actual

LearnAssertions.java

package myWorkjUnit;

import junit.framework.Assert;

import org.junit.Test;

public class LearnAssertions {

@Test
 public void testAdvertisingPrograms(){
 System.out.println("open browser and go to URL");
 System.out.println("click on link");
 System.out.println("click on one Login link");

 String actual = "actual";
 String expected = "actual";

// if("ElementLocation" == "ElementLocation from above statement"){
// System.out.println("Pass");
// }else{
// System.out.println("fail");
// report Error
// }


 Assert.assertEquals(expected, actual);

 }

}

Condition : expected != actual

package myWorkjUnit;

import junit.framework.Assert;

import org.junit.Test;

public class LearnAssertions {

@Test
 public void testAdvertisingPrograms(){
 System.out.println("open browser and go to URL");
 System.out.println("click on link");
 System.out.println("click on one Login link");

 String actual = "actual";
 String expected = "expected";

// if("ElementLocation" == "ElementLocation from above statement"){
// System.out.println("Pass");
// }else{
// System.out.println("fail");
// report Error
// }


 Assert.assertEquals(expected, actual);

 }

}

pAAN sINGH cODER

* Selenium Automation Learning Path *

Selenium learning Path

Selenium learning Path

IMDb Top 250

Learn by examples

Learn by examples

Take this Code from PasteBIN

 

import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
public class TestIMDbTop250movies {

public static String StartString=null;
 public static String EndString=null;
 public static void main(String[] args) {
 WebDriver myTestDriver = new FirefoxDriver();
 myTestDriver.manage().window().maximize();

myTestDriver.navigate().to(&amp;quot;http://www.imdb.com/chart/top&amp;quot;);

 StartString = &amp;quot;//*[@id='main']/table[2]/tbody/tr[&amp;quot;;
 EndString = &amp;quot;]/td[3]/font/a&amp;quot;;

 for(int i=2;i&amp;lt;=251;i++){
 System.out.println(myTestDriver.findElement(By.xpath(StartString + i + EndString)).getText());
 System.out.println(myTestDriver.findElement(By.xpath(StartString + i + EndString)).getAttribute(&amp;quot;href&amp;quot;));;

 }

 myTestDriver.quit();
 }

}

 

Output @ Console:

The Shawshank Redemption
http://www.imdb.com/title/tt0111161/
The Godfather
http://www.imdb.com/title/tt0068646/
The Godfather: Part II
http://www.imdb.com/title/tt0071562/
Pulp Fiction
http://www.imdb.com/title/tt0110912/
The Good, the Bad and the Ugly
http://www.imdb.com/title/tt0060196/
12 Angry Men
http://www.imdb.com/title/tt0050083/
The Dark Knight
http://www.imdb.com/title/tt0468569/
Schindler’s List
http://www.imdb.com/title/tt0108052/
The Lord of the Rings: The Return of the King
http://www.imdb.com/title/tt0167260/
Fight Club
http://www.imdb.com/title/tt0137523/
Star Wars: Episode V – The Empire Strikes Back
http://www.imdb.com/title/tt0080684/
One Flew Over the Cuckoo’s Nest
http://www.imdb.com/title/tt0073486/
The Lord of the Rings: The Fellowship of the Ring
http://www.imdb.com/title/tt0120737/
Inception
http://www.imdb.com/title/tt1375666/
Goodfellas
http://www.imdb.com/title/tt0099685/
Star Wars
http://www.imdb.com/title/tt0076759/
Seven Samurai
http://www.imdb.com/title/tt0047478/
The Matrix
http://www.imdb.com/title/tt0133093/
Forrest Gump
http://www.imdb.com/title/tt0109830/
City of God
http://www.imdb.com/title/tt0317248/
The Lord of the Rings: The Two Towers
http://www.imdb.com/title/tt0167261/
Once Upon a Time in the West
http://www.imdb.com/title/tt0064116/
Se7en
http://www.imdb.com/title/tt0114369/
The Silence of the Lambs
http://www.imdb.com/title/tt0102926/
Casablanca
http://www.imdb.com/title/tt0034583/
The Usual Suspects
http://www.imdb.com/title/tt0114814/
Raiders of the Lost Ark
http://www.imdb.com/title/tt0082971/
Rear Window
http://www.imdb.com/title/tt0047396/
Psycho
http://www.imdb.com/title/tt0054215/
It’s a Wonderful Life
http://www.imdb.com/title/tt0038650/
Léon: The Professional
http://www.imdb.com/title/tt0110413/
Sunset Blvd.
http://www.imdb.com/title/tt0043014/
Memento
http://www.imdb.com/title/tt0209144/
American History X
http://www.imdb.com/title/tt0120586/
Apocalypse Now
http://www.imdb.com/title/tt0078788/
Terminator 2: Judgment Day
http://www.imdb.com/title/tt0103064/
The Dark Knight Rises
http://www.imdb.com/title/tt1345836/
Dr. Strangelove or: How I Learned to Stop Worrying and Love the Bomb
http://www.imdb.com/title/tt0057012/
Saving Private Ryan
http://www.imdb.com/title/tt0120815/
Alien
http://www.imdb.com/title/tt0078748/
City Lights
http://www.imdb.com/title/tt0021749/
North by Northwest
http://www.imdb.com/title/tt0053125/
Spirited Away
http://www.imdb.com/title/tt0245429/
Citizen Kane
http://www.imdb.com/title/tt0033467/
Modern Times
http://www.imdb.com/title/tt0027977/
The Shining
http://www.imdb.com/title/tt0081505/
Back to the Future
http://www.imdb.com/title/tt0088763/
Vertigo
http://www.imdb.com/title/tt0052357/
The Pianist
http://www.imdb.com/title/tt0253474/
American Beauty
http://www.imdb.com/title/tt0169547/
The Departed
http://www.imdb.com/title/tt0407887/
Taxi Driver
http://www.imdb.com/title/tt0075314/
M
http://www.imdb.com/title/tt0022100/
Paths of Glory
http://www.imdb.com/title/tt0050825/
Life Is Beautiful
http://www.imdb.com/title/tt0118799/
Toy Story 3
http://www.imdb.com/title/tt0435761/
Double Indemnity
http://www.imdb.com/title/tt0036775/
Aliens
http://www.imdb.com/title/tt0090605/
WALL·E
http://www.imdb.com/title/tt0910970/
The Lives of Others
http://www.imdb.com/title/tt0405094/
A Clockwork Orange
http://www.imdb.com/title/tt0066921/
Amélie
http://www.imdb.com/title/tt0211915/
Gladiator
http://www.imdb.com/title/tt0172495/
The Intouchables
http://www.imdb.com/title/tt1675434/
The Green Mile
http://www.imdb.com/title/tt0120689/
Lawrence of Arabia
http://www.imdb.com/title/tt0056172/
To Kill a Mockingbird
http://www.imdb.com/title/tt0056592/
The Prestige
http://www.imdb.com/title/tt0482571/
The Great Dictator
http://www.imdb.com/title/tt0032553/
Reservoir Dogs
http://www.imdb.com/title/tt0105236/
Das Boot
http://www.imdb.com/title/tt0082096/
Requiem for a Dream
http://www.imdb.com/title/tt0180093/
The Third Man
http://www.imdb.com/title/tt0041959/
The Treasure of the Sierra Madre
http://www.imdb.com/title/tt0040897/
Eternal Sunshine of the Spotless Mind
http://www.imdb.com/title/tt0338013/
Cinema Paradiso
http://www.imdb.com/title/tt0095765/
Once Upon a Time in America
http://www.imdb.com/title/tt0087843/
Chinatown
http://www.imdb.com/title/tt0071315/
The Lion King
http://www.imdb.com/title/tt0110357/
L.A. Confidential
http://www.imdb.com/title/tt0119488/
Star Wars: Episode VI – Return of the Jedi
http://www.imdb.com/title/tt0086190/
Full Metal Jacket
http://www.imdb.com/title/tt0093058/
Braveheart
http://www.imdb.com/title/tt0112573/
Monty Python and the Holy Grail
http://www.imdb.com/title/tt0071853/
Singin’ in the Rain
http://www.imdb.com/title/tt0045152/
Oldboy
http://www.imdb.com/title/tt0364569/
Some Like It Hot
http://www.imdb.com/title/tt0053291/
Amadeus
http://www.imdb.com/title/tt0086879/
Metropolis
http://www.imdb.com/title/tt0017136/
Rashomon
http://www.imdb.com/title/tt0042876/
Bicycle Thieves
http://www.imdb.com/title/tt0040522/
2001: A Space Odyssey
http://www.imdb.com/title/tt0062622/
Unforgiven
http://www.imdb.com/title/tt0105695/
All About Eve
http://www.imdb.com/title/tt0042192/
Princess Mononoke
http://www.imdb.com/title/tt0119698/
The Apartment
http://www.imdb.com/title/tt0053604/
Indiana Jones and the Last Crusade
http://www.imdb.com/title/tt0097576/
The Sting
http://www.imdb.com/title/tt0070735/
Raging Bull
http://www.imdb.com/title/tt0081398/
The Bridge on the River Kwai
http://www.imdb.com/title/tt0050212/
The Hobbit: An Unexpected Journey
http://www.imdb.com/title/tt0903624/
Die Hard
http://www.imdb.com/title/tt0095016/
Witness for the Prosecution
http://www.imdb.com/title/tt0051201/
A Separation
http://www.imdb.com/title/tt1832382/
Batman Begins
http://www.imdb.com/title/tt0372784/
Grave of the Fireflies
http://www.imdb.com/title/tt0095327/
Pan’s Labyrinth
http://www.imdb.com/title/tt0457430/
Downfall
http://www.imdb.com/title/tt0363163/
Mr. Smith Goes to Washington
http://www.imdb.com/title/tt0031679/
Yojimbo
http://www.imdb.com/title/tt0055630/
The Great Escape
http://www.imdb.com/title/tt0057115/
Snatch.
http://www.imdb.com/title/tt0208092/
For a Few Dollars More
http://www.imdb.com/title/tt0059578/
Up
http://www.imdb.com/title/tt1049413/
Inglourious Basterds
http://www.imdb.com/title/tt0361748/
The Elephant Man
http://www.imdb.com/title/tt0080678/
On the Waterfront
http://www.imdb.com/title/tt0047296/
The Seventh Seal
http://www.imdb.com/title/tt0050976/
Toy Story
http://www.imdb.com/title/tt0114709/
Heat
http://www.imdb.com/title/tt0113277/
The Maltese Falcon
http://www.imdb.com/title/tt0033870/
The General
http://www.imdb.com/title/tt0017925/
Gran Torino
http://www.imdb.com/title/tt1205489/
Rebecca
http://www.imdb.com/title/tt0032976/
Blade Runner
http://www.imdb.com/title/tt0083658/
Wild Strawberries
http://www.imdb.com/title/tt0050986/
The Avengers
http://www.imdb.com/title/tt0848228/
Fargo
http://www.imdb.com/title/tt0116282/
The Kid
http://www.imdb.com/title/tt0012349/
Scarface
http://www.imdb.com/title/tt0086250/
The Big Lebowski
http://www.imdb.com/title/tt0118715/
Touch of Evil
http://www.imdb.com/title/tt0052311/
Ran
http://www.imdb.com/title/tt0089881/
The Deer Hunter
http://www.imdb.com/title/tt0077416/
Cool Hand Luke
http://www.imdb.com/title/tt0061512/
Sin City
http://www.imdb.com/title/tt0401792/
The Gold Rush
http://www.imdb.com/title/tt0015864/
Strangers on a Train
http://www.imdb.com/title/tt0044079/
No Country for Old Men
http://www.imdb.com/title/tt0477348/
It Happened One Night
http://www.imdb.com/title/tt0025316/
Jaws
http://www.imdb.com/title/tt0073195/
Lock, Stock and Two Smoking Barrels
http://www.imdb.com/title/tt0120735/
The Sixth Sense
http://www.imdb.com/title/tt0167404/
Hotel Rwanda
http://www.imdb.com/title/tt0395169/
Platoon
http://www.imdb.com/title/tt0091763/
High Noon
http://www.imdb.com/title/tt0044706/
The Thing
http://www.imdb.com/title/tt0084787/
Butch Cassidy and the Sundance Kid
http://www.imdb.com/title/tt0064115/
The Wizard of Oz
http://www.imdb.com/title/tt0032138/
Casino
http://www.imdb.com/title/tt0112641/
Trainspotting
http://www.imdb.com/title/tt0117951/
Kill Bill: Vol. 1
http://www.imdb.com/title/tt0266697/
Warrior
http://www.imdb.com/title/tt1291584/
Annie Hall
http://www.imdb.com/title/tt0075686/
Notorious
http://www.imdb.com/title/tt0038787/
The Secret in Their Eyes
http://www.imdb.com/title/tt1305806/
Good Will Hunting
http://www.imdb.com/title/tt0119217/
Gone with the Wind
http://www.imdb.com/title/tt0031381/
The King’s Speech
http://www.imdb.com/title/tt1504320/
The Grapes of Wrath
http://www.imdb.com/title/tt0032551/
Into the Wild
http://www.imdb.com/title/tt0758758/
Life of Brian
http://www.imdb.com/title/tt0079470/
Finding Nemo
http://www.imdb.com/title/tt0266543/
V for Vendetta
http://www.imdb.com/title/tt0434409/
How to Train Your Dragon
http://www.imdb.com/title/tt0892769/
My Neighbor Totoro
http://www.imdb.com/title/tt0096283/
Dial M for Murder
http://www.imdb.com/title/tt0046912/
The Big Sleep
http://www.imdb.com/title/tt0038355/
Ben-Hur
http://www.imdb.com/title/tt0052618/
The Terminator
http://www.imdb.com/title/tt0088247/
Network
http://www.imdb.com/title/tt0074958/
Million Dollar Baby
http://www.imdb.com/title/tt0405159/
There Will Be Blood
http://www.imdb.com/title/tt0469494/
The Night of the Hunter
http://www.imdb.com/title/tt0048424/
Stand by Me
http://www.imdb.com/title/tt0092005/
Black Swan
http://www.imdb.com/title/tt0947798/
Donnie Darko
http://www.imdb.com/title/tt0246578/
Groundhog Day
http://www.imdb.com/title/tt0107048/
Dog Day Afternoon
http://www.imdb.com/title/tt0072890/
Twelve Monkeys
http://www.imdb.com/title/tt0114746/
Amores Perros
http://www.imdb.com/title/tt0245712/
The Bourne Ultimatum
http://www.imdb.com/title/tt0440963/
Mary and Max
http://www.imdb.com/title/tt0978762/
The 400 Blows
http://www.imdb.com/title/tt0053198/
Persona
http://www.imdb.com/title/tt0060827/
The Graduate
http://www.imdb.com/title/tt0061722/
Gandhi
http://www.imdb.com/title/tt0083987/
The Killing
http://www.imdb.com/title/tt0049406/
Howl’s Moving Castle
http://www.imdb.com/title/tt0347149/
The Princess Bride
http://www.imdb.com/title/tt0093779/
The Artist
http://www.imdb.com/title/tt1655442/

http://www.imdb.com/title/tt0056801/
Slumdog Millionaire
http://www.imdb.com/title/tt1010048/
Argo
http://www.imdb.com/title/tt1024648/
Who’s Afraid of Virginia Woolf?
http://www.imdb.com/title/tt0061184/
La Strada
http://www.imdb.com/title/tt0047528/
The Hustler
http://www.imdb.com/title/tt0054997/
The Manchurian Candidate
http://www.imdb.com/title/tt0056218/
A Beautiful Mind
http://www.imdb.com/title/tt0268978/
Rocky
http://www.imdb.com/title/tt0075148/
The Wild Bunch
http://www.imdb.com/title/tt0065214/
Anatomy of a Murder
http://www.imdb.com/title/tt0052561/
Stalag 17
http://www.imdb.com/title/tt0046359/
The Exorcist
http://www.imdb.com/title/tt0070047/
Sleuth
http://www.imdb.com/title/tt0069281/
Rope
http://www.imdb.com/title/tt0040746/
Barry Lyndon
http://www.imdb.com/title/tt0072684/
The Man Who Shot Liberty Valance
http://www.imdb.com/title/tt0056217/
District 9
http://www.imdb.com/title/tt1136608/
Life of Pi
http://www.imdb.com/title/tt0454876/
The Perks of Being a Wallflower
http://www.imdb.com/title/tt1659337/
Stalker
http://www.imdb.com/title/tt0079944/
Infernal Affairs
http://www.imdb.com/title/tt0338564/
Roman Holiday
http://www.imdb.com/title/tt0046250/
The Truman Show
http://www.imdb.com/title/tt0120382/
Pirates of the Caribbean: The Curse of the Black Pearl
http://www.imdb.com/title/tt0325980/
Ratatouille
http://www.imdb.com/title/tt0382932/
Ip Man
http://www.imdb.com/title/tt1220719/
The Diving Bell and the Butterfly
http://www.imdb.com/title/tt0401383/
Harry Potter and the Deathly Hallows: Part 2
http://www.imdb.com/title/tt1201607/
A Fistful of Dollars
http://www.imdb.com/title/tt0058461/
Monsters, Inc.
http://www.imdb.com/title/tt0198781/
In the Name of the Father
http://www.imdb.com/title/tt0107207/
A Streetcar Named Desire
http://www.imdb.com/title/tt0044081/
Star Trek
http://www.imdb.com/title/tt0796366/
Beauty and the Beast
http://www.imdb.com/title/tt0101414/
Rosemary’s Baby
http://www.imdb.com/title/tt0063522/
Nausicaä of the Valley of the Wind
http://www.imdb.com/title/tt0087544/
Harvey
http://www.imdb.com/title/tt0042546/
All Quiet on the Western Front
http://www.imdb.com/title/tt0020629/
The Wrestler
http://www.imdb.com/title/tt1125849/
La Haine
http://www.imdb.com/title/tt0113247/
Rain Man
http://www.imdb.com/title/tt0095953/
Shutter Island
http://www.imdb.com/title/tt1130884/
Nosferatu
http://www.imdb.com/title/tt0013442/
Spring, Summer, Fall, Winter… and Spring
http://www.imdb.com/title/tt0374546/
Battleship Potemkin
http://www.imdb.com/title/tt0015648/
Manhattan
http://www.imdb.com/title/tt0079522/
Mystic River
http://www.imdb.com/title/tt0327056/
Big Fish
http://www.imdb.com/title/tt0319061/
Shadow of a Doubt
http://www.imdb.com/title/tt0036342/
Bringing Up Baby
http://www.imdb.com/title/tt0029947/
Papillon
http://www.imdb.com/title/tt0070511/
3 Idiots
http://www.imdb.com/title/tt1187043/
Castle in the Sky
http://www.imdb.com/title/tt0092067/
The Untouchables
http://www.imdb.com/title/tt0094226/
Jurassic Park
http://www.imdb.com/title/tt0107290/
The Nightmare Before Christmas
http://www.imdb.com/title/tt0107688/
Let the Right One In
http://www.imdb.com/title/tt1139797/
In the Heat of the Night
http://www.imdb.com/title/tt0061811/

Top 35 inspirational movies

Learn by examples

Learn by examples

 

Take this code from PasteBIN

 

import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
public class TestTop35inspirationalmovies {

public static String StartString=null;
 public static String EndString=null;


 public static void main(String[] args) {

 WebDriver myTestDriver = new FirefoxDriver();
 myTestDriver.manage().window().maximize();

myTestDriver.navigate().to("http://www.imdb.com/list/GyzpQ_PZLcg/");

 StartString = "//*[@id='main']/div/div[7]/div[";
 EndString = "]/div[3]/b/a";

 for(int i=1;i<=35;i++){
 System.out.println(myTestDriver.findElement(By.xpath(StartString + i + EndString)).getText());
 System.out.println(myTestDriver.findElement(By.xpath(StartString + i + EndString)).getAttribute("href"));;

 }

 myTestDriver.quit();

 }

}

 

Output:

 

Dead Poets Society
http://www.imdb.com/title/tt0097165/
Rain Man
http://www.imdb.com/title/tt0095953/
Philadelphia
http://www.imdb.com/title/tt0107818/
The Shawshank Redemption
http://www.imdb.com/title/tt0111161/
Forrest Gump
http://www.imdb.com/title/tt0109830/
A Beautiful Mind
http://www.imdb.com/title/tt0268978/
Life Is Beautiful
http://www.imdb.com/title/tt0118799/
Billy Elliot
http://www.imdb.com/title/tt0249462/
The World’s Fastest Indian
http://www.imdb.com/title/tt0412080/
The Straight Story
http://www.imdb.com/title/tt0166896/
Fight Club
http://www.imdb.com/title/tt0137523/
Pulp Fiction
http://www.imdb.com/title/tt0110912/
Magnolia
http://www.imdb.com/title/tt0175880/
Good Will Hunting
http://www.imdb.com/title/tt0119217/
Saving Private Ryan
http://www.imdb.com/title/tt0120815/
One Flew Over the Cuckoo’s Nest
http://www.imdb.com/title/tt0073486/
Big Fish
http://www.imdb.com/title/tt0319061/
Buffalo ’66
http://www.imdb.com/title/tt0118789/
Amélie
http://www.imdb.com/title/tt0211915/
Trainspotting
http://www.imdb.com/title/tt0117951/
What’s Eating Gilbert Grape
http://www.imdb.com/title/tt0108550/
Bunny and the Bull
http://www.imdb.com/title/tt1251725/
Kontroll
http://www.imdb.com/title/tt0373981/
City of God
http://www.imdb.com/title/tt0317248/
Eternal Sunshine of the Spotless Mind
http://www.imdb.com/title/tt0338013/
Gran Torino
http://www.imdb.com/title/tt1205489/
The Pianist
http://www.imdb.com/title/tt0253474/
Groundhog Day
http://www.imdb.com/title/tt0107048/
The Life Aquatic with Steve Zissou
http://www.imdb.com/title/tt0362270/
Children of Men
http://www.imdb.com/title/tt0206634/
Little Miss Sunshine
http://www.imdb.com/title/tt0449059/
My Left Foot
http://www.imdb.com/title/tt0097937/
Cast Away
http://www.imdb.com/title/tt0162222/
Sideways
http://www.imdb.com/title/tt0375063/
Shine
http://www.imdb.com/title/tt0117631/

Top 35 inspirational movies

 

example 3 – Locating dynamic elements – variable class name – Locating by CSS

example 3 – Locating dynamic elements – variable class name – Locating by CSS

Learn by examples

Learn by examples

 

get this code from pasteBIN

Collection LIST

 

import java.util.List;
import java.util.concurrent.TimeUnit;

import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.firefox.FirefoxDriver;
public class TestLocatingDynamicElementsbutton {
 public static void main(String[] args) {
 WebDriver myTestDriver = new FirefoxDriver();
 myTestDriver.get("http://tinyurl.com/buxk9dg");
 myTestDriver.manage().window().maximize();
 myTestDriver.manage().timeouts().implicitlyWait(10,TimeUnit.SECONDS);

List<WebElement> ButtonNamelist = myTestDriver
 .findElements(By
 .cssSelector("span[class^='z-button']"));

System.out.println(ButtonNamelist.size());
 for(int i=0;i<ButtonNamelist.size();i++){
 System.out.println(ButtonNamelist.get(i).getText());
 }


 myTestDriver.quit();

 }

 }

&nbsp;

 

Output

 

5
Left
Right
Above
Below
Big Button

example – Locating dynamic elements – variable class name contains text – Locating by CSS

example – Locating dynamic elements – variable class name contains text – Locating by CSS

Learn by examples

Learn by examples

 

Get this code from PASTEBIN

Output -  example – Locating dynamic elements – variable class name contains text – Locating by CSS

example – Locating dynamic elements – variable class name contains text – Locating by CSS

 

import java.util.List;
import java.util.concurrent.TimeUnit;

import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.firefox.FirefoxDriver;
public class TestLocatingDynamicElementscheckbox {
 public static void main(String[] args) {
 WebDriver myTestDriver = new FirefoxDriver();
 myTestDriver.get("http://tinyurl.com/d7ovu8z");
 myTestDriver.manage().window().maximize();
 myTestDriver.manage().timeouts().implicitlyWait(10,TimeUnit.SECONDS);

List<WebElement> checkboxlist = myTestDriver
 .findElements(By
 .cssSelector("span[class*='checkbox']"));

System.out.println(checkboxlist.size());
 for(int i=0;i<checkboxlist.size();i++){
 System.out.println(checkboxlist.get(i).getText());
 }


 myTestDriver.quit();

 }
 }

&nbsp;

 

example – Locating dynamic elements – variable class name – Locating by CSS

example – Locating dynamic elements – variable class name – Locating by CSS

Learn by examples

Learn by examples

example - Locating dynamic elements - variable class name - Locating by CSS

example – Locating dynamic elements – variable class name – Locating by CSS

 

 

import java.util.List;
import java.util.concurrent.TimeUnit;

import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.firefox.FirefoxDriver;
public class TestLocatingDynamicElementsbutton {
 public static void main(String[] args) {
 WebDriver myTestDriver = new FirefoxDriver();
 myTestDriver.get("http://tinyurl.com/buxk9dg");
 myTestDriver.manage().window().maximize();
 myTestDriver.manage().timeouts().implicitlyWait(10,TimeUnit.SECONDS);

List<WebElement> ButtonNamelist = myTestDriver
 .findElements(By
 .cssSelector("span[class^='z-button']"));

System.out.println(ButtonNamelist.size());
 for(int i=0;i<ButtonNamelist.size();i++){
 System.out.println(ButtonNamelist.get(i).getText());
 }


 myTestDriver.quit();

 }

 }

&nbsp;

Collection LIST

Get this code from PasteBIN

Example and Practise – Print Gmail’s Current space counter on text changed using selenium webdriver?

Learn by examples

Learn by examples

 

import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
public class Gmail_space_Counter {
 public static String before = null;
 public static String after = null;

 public static void main(String[] args) {
 WebDriver myTestDriver = new FirefoxDriver();
 myTestDriver.manage().window().maximize();

myTestDriver.navigate().to("http://www.gmail.com");




 while(true){
 after=myTestDriver.findElement(By.xpath("//*[@id='quota']")).getText();

if(!after.equals(before)){
 System.out.println(after);
 before=after;

 }

 }
 }

}

 

Get this code from PasteBIN

 

Example – get JavaScript countdown using selenium webdriver

Learn by examples

Learn by examples

 

Get this code from PasteBIN

 

Example - get JavaScript countdown using selenium webdriver

 

import java.util.concurrent.TimeUnit;

import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
public class ExampleJavaScriptcountdown {
public static String before = null;
public static String after = null;
 public static void main(String[] args) {
 WebDriver myTestDriver = new FirefoxDriver();
 myTestDriver.manage().window().maximize();

 myTestDriver.manage().timeouts().implicitlyWait(20,TimeUnit.SECONDS);

 myTestDriver.get("http://tinyurl.com/dxwzzf3");



 while(true){
 after=myTestDriver.findElement(By.xpath("//*[@id='javascript_countdown_time']")).getText();

if(!after.equals(before)){
 System.out.println(after);
 before=after;

 }

 }

}

}

 

Example 2 – How to get all links of selected area of webpage with Link title?

Learn by examples

Learn by examples

 

you can get this code from PasteBIN

import java.util.List;

import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.firefox.FirefoxDriver;
public class ExampleQuikrClassifiedAdsonline {
 public static void main(String[] args) {
 WebDriver driver = new FirefoxDriver();
 driver.navigate().to("http://www.quikr.com");

 List<WebElement> link_boxes=driver.findElements(By.xpath("//*[@id='cats']"));
 System.out.println("Number of boxes "+link_boxes.size() );



 for(int j=0;j<link_boxes.size();j++){

 WebElement box = link_boxes.get(j);
 List<WebElement> links = box.findElements(By.tagName("a"));
 System.out.println("Total links for---"+link_boxes.get(j+1)+"---are--- "+links.size() );
 System.out.println("====================================="+j);
 for(int i=1 ; i<links.size();i++){
 System.out.println("*********************************************");
 System.out.println(links.get(i).getText());
 System.out.println(links.get(i).getAttribute("href"));

 }
 }

driver.quit();

}

}

Collection LIST

Pupunzi

For a better web

Tech

News and reviews from the world of gadgets, gear, apps and the web

VentureBeat

News About Tech, Money and Innovation

Digital Inspiration

Tips and tutorials around all things tech.

Thinkwareglobal's Blog

Just another WordPress.com weblog

Kenazari's Blog

Just another WordPress.com weblog

Richfowler1's Blog

Just another WordPress.com weblog

Romaicus's Blog

Just another WordPress.com weblog

botlaguduri

Just another WordPress.com site

chandanag89

Just another WordPress.com site

meghshetty

Just another WordPress.com site

digitalmediaexpert

digital media expert blog

Thinking in Silverlight

Silverlight/WPF/Windows 8 Store App

Different Journeys

Let's make life easier!

LAW RESOURCE INDIA

LEGAL RESOURCE CENTRE / COURT JUDGMENTS / LEGAL ARCHIVES

BookConnect

Promoting Indian language Books

Actively Lazy

Software, crafted with passion

SAPonPower

An ongoing discussion about SAP infrastructure

SAP Career

Your Career Mentor

hrsapcertification

Just another WordPress.com site

The secret product manager

Thoughts about product management, SUSE, Linux, ARM processors, Cloud, AIX, Power Systems, and other things that interest me

Sap Certification Material . Com

Quality store for sap software and courses

Simon Les Flex's Blog

SAP Process Integration Specialist - NOW WE CAN DO BETTER!

Oracle Technologies Primer

An Oracle Fusion Middleware and iPaaS blog!

Gilberto Holms

Java, Middleware, SOA Architecture Blog

The Skeleton

Java code skeletons, tips and pointers

J@n van Zoggel

integration, innovation & random technology stuff

The Pragmatic Integrator

Hints and tips from a pragmatic integration specialist

briskwalk

The pace of life..

Optimalbg's Blog

Just another WordPress.com site

IT Jobs in USA

Keep the track of this Blog if you are looking out for some good Opportunities to work in USA....

Referral Jobs | Right Place to Get a Job

Hurry you are one Click away to get a job - Fresher Jobs for 2012, 2013 fresher’s and also high paid jobs for well Experienced IT professionals on Referal jobs.

eccinternational.wordpress.com/

ISO Consulting | ISO 27001 | ISO 20000 | CMMI | BCM | GRI Sustainability Reporting & Assurance | eLearning | Trainings | Philippines

Michael Korn's Blog

Musings on Life, Career, Faith and Technology

WORKINGWITHQTP

Just another WordPress.com weblog

Solutions365

.net, WCF, Unity, IOC, SQL

SQA and Testers Blog

Just another WordPress.com weblog

Expertqtp's Weblog

Just another WordPress.com weblog

Sai Chamarthi

Experienced Testing Professional

saxenavinay

A great WordPress.com site

Suresh4qtp's Blog

Just another WordPress.com site

jonah95hill

This WordPress.com site is the cat’s pajamas

It's always something...

Just another WordPress.com weblog

Faculty of Information Technology - Lê Ngọc Tiến

Be Yourself! Simplify Our Goals! Nothing is Impossible!

Anti-Malware Testing

Thoughts on security product testing past and present

Methods & Tools

Practical knowledge for the software developer, tester and project manager