Tag Archives: with Firefox

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("http://www.imdb.com/chart/top");

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

 for(int i=2;i<=251;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 @ 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

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

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

Learn by examples

Learn by examples

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 ExampleOLXClassifieds {
 public static void main(String[] args) {

WebDriver myTestDriver = new FirefoxDriver();

 myTestDriver.manage().window().maximize();

 myTestDriver.navigate().to("http://www.olx.in/");

 List<WebElement> link_boxes= myTestDriver.findElements(By.xpath("//div[@id='home']/div[@class='column']"));
 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---"+(j+1)+"---are--- "+ links.size() );

 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"));

 }
 }

myTestDriver.quit();
 }

}

Collection LIST

 

Take above code from PasteBIN

 

Free classifieds in India, Classified ads in India, Online Classified Advertising

Example 2 – string manipulation for Selenium automation

Learn by examples

Learn by examples

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

 myTestDriver.navigate().to("http://tinyurl.com/desylo");
 String xpath_start="//*[@id='content']/form[";
 String xpath_end="]/fieldset/input[6]";

 for(int i=1;i<=3;i++){
 myTestDriver.findElement(By.xpath(xpath_start+i+xpath_end)).click();
 Thread.sleep(5000L);
 }
 String cart_items = myTestDriver.findElement(By.xpath("//*[@id='jcart']/form/fieldset/table/thead/tr/th")).getText();
 System.out.println(cart_items);
 String tem[] = cart_items.split(" ");
 System.out.println(tem[2]);
 String temp[] = tem[2].split("\\(");

 System.out.println(temp[1]);

myTestDriver.quit();
 }

}

jCart - Free PHP-Ajax shopping cart downloaded over 63,000 times

Example – string manipulation for Selenium automation

 

take this code from Pastebin

Pupunzi

For a better web

Tech

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

Digital Inspiration

Technology, Software and Internet

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

Different Journeys

Let's make life easier!

Thinking in Silverlight

Silverlight/WPF/Windows 8 Store App

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, Linux, Arm processors, Embedded OS, Photography, Scouts BSA, Cloud, and other things that interest me

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

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 and High paid jobs for well Experienced IT professionals on Referal jobs.

Michael Korn's Blog

Musings on Life, Career, Faith and Technology

WORKINGWITHQTP

Just another WordPress.com weblog

Topics

.Net Core, AspNetCore, Entity Framework, Entity Framework Core, AspNetIdentity, AspNetIdentityCore, Unit Test, WCF, Workflows

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

Mindscripts Software Testing Training Institutes In Pune

Software Testing In Pune, Software Testing Training In Pune, Software Testing Training Institute,Software Testing Training Institutes In Pune ,Software Testing Training Centers,Software Testing Classes In Pune,,Software Testing Courses Pune, Software Testing Certification In Pune,,software testing certification course in pune,software testing certification institutes in pune

edington associates

Working with organizations to develop sustainable and thriving workplaces and people.

Main Admin Site for the WPVIP multisite

This multisite hosts public sites for Parse.ly and WordPress VIP

WORK Online

Virtual Office at HOME

SysfoData

Software Development, Web Development and Internet Marketing Service Available here.

Birth Pangs of a Startup

Virtual Assistance, Startups, Technology, Online Work and More