Sunday 28 April 2013

Selenium Training and Selenium Tutorial


Selenium Webdriver - How to Know if Checkbox is Checked / Set or Not

Selenium Webdriver - How to Know if Checkbox is Checked / Set or Not

Below are the posts to help you find out if a checkbox is checked or not with the help of Selenium Webdriver. You can also go through an earlier post on checking multiple checkboxes.

1. Webdriver Check if Checkbox is Set and Set it if Not.
2. Selenium checkbox attribute “checked”.
3. How can I check if a checkbox is checked in Selenium Python Webdriver?
4. I am using Selenium Webdriver. How do I write code for following use-cases: - check whether Checkbox is Enabled or Disabled - check whether Checkbox is Checked or UnChecked.
5. Selenium – Use Assertions to Verify the Test Output.
6. verify if checkbox is checked or if select box has selected specific option.
7. How to assert a checkbox is checked when it is coded as a div using Selenium2/Webdriver.
8. Selenium – Use Assertions to Verify the Test Output.
9. Find out if a checkbox is selected.
10. How to check if extjs checkbox is selected in selenium?
11. Handling check boxes and radio buttons using Selenium WebDriver.

Selenium Assertions

What is an assertion in Selenium?

Assertions in Selenium verify that the state of the application conforms to what is required or expected [i.e. the expected thing is actually present]. For example make sure that a particular text is showing on a page or make sure that checkbox is checked etc.

As per Seleniumhq, all Selenium Assertions can be used in 3 modes: "assert", "verify", and "waitFor". For example, you can "assertText", "verifyText" and "waitForText". When an "assert" fails, the test is aborted. When a "verify" fails, the test will continue execution, logging the failure. This allows a single "assert" to ensure that the application is on the correct page, followed by a bunch of "verify" assertions to test form field values, labels, etc.

Examples of Selenium Assertions

1. Selenium – Use Assertions to Verify the Test Output. [Link]
2. Implementing soft assertion with selenium. [Link]
3. Using assertions in Selenium. [Link]
4. Using soft assertions in TestNG. [Link]
5. Common Assertions using WebDriver. [Link]
6. Selenium WebDriver, Selenium Server and PageObjects by Example. [Link]
7. Quicker way to assert that an element does not exist. [Link]
8. Assert/VerifyElementPresent with Python and WebDriver? [Link]
9. Using assertTrue in Selenium Webdriver. [Link]
10. Selenium Webdriver - Wait for an element to load. [Link]
11. how can I check if some text exist or not in the page? [Link]

Scrolling a Page - Webdriver

Scrolling a Page - Webdriver

Below links will try to answer your questions like how to scroll the page using Webdriver, page scroll up or down in WebDriver, how to scroll to element using WebDriver, how to recognize scrollbar etc.

1. Scrolling using Selenium-WebDriver. [Link]
2. Scroll Element into View with Selenium. [Link]
3. Scrolling on pages using Selenium. [Link]
4. Vertical Scroll down and scroll up in WebDriver with java. [Link]
5. Selenium 2: How to scroll to element using WebDriver. [Link]
6. How to recognize scrollbar and scroll up/down using Selenium2, C#. [Link]
7. Page scroll up or down in WebDriver (Selenium 2) using java. [Link]
8. How to Scroll the page. [Link]
9. Selenium webdriver can't click on a link outside the page. [Link]
10. Handle scrollbar in selemium2. [Link]
11. How to scroll to bottom of page in Selenium IDE? [Link]
12. How to Scroll the page. [Link]

How to send a mail - Selenium Webdriver

How to send a mail - Selenium Webdriver

Sending a mail using Webdriver / Selenium is one of the hot topics and below are the links which I have collected to help you with the same. I hope these links will give you atleast a starting point (if not extremely helpful) on the topic How to send a mail - Selenium Webdriver.

1. Using Selenium Web Driver to send e-mail with GMail. [Link]

2. Send a Mail to Friend from Gmail. [Link]

3. Verify Email Confirmation Using Selenium. [Link]

4. How to automated gmail to send email by using Selenium? [Link]

5. WebDriver Automation on verifying an email. [Link]

6. Automatically Email the reports after Selenium test execution. [Link]

Verify Broken Links / 404 Not-found - Webdriver

Verify Broken Links / 404 Not-found - Webdriver

There are cases when you need to find the broken links on a webpage or website. Below are some of the links which can help you with the task of finding broken links in webpage using Webdriver / Selenium.

1. How to check URL for 404 using Selenium WebDriver? [Link]
2. Webdriver and Image Verification. [Link]
3. Link Checking in Selenium without using Webdriver. [Link]
4. Broken links on webpage - Webdriver. [Link]
5. Finding the broken links in a webpage using Selenium. [Link]
6. Selenium IDE: Verify broken link 404 not found? [Link]
7. On this post "How To Download Files With Selenium And Why You Shouldn’t" go to paragraph which starts with "Checking that links are valid". [Link]

WebDriverWait, ImplicitlyWait & ExplictlyWait

WebDriverWait, ImplicitlyWait & ExplictlyWait

An explicit waits is code you define to wait for a certain condition to occur before proceeding further in the code.

An implicit wait is to tell WebDriver to poll the DOM for a certain amount of time when trying to find an element or elements if they are not immediately available. [Go for more at Seleniumhq]

Some of the best links which will help further your knowledge on WebDriverWait, ImplicitlyWait & ExplictlyWait.

1. Selenium Tests: When to Wait with Webdriver [Link]

2. Selenium Webdriver - Wait for an element to load [Link]

3. WebDriver Wait is easier after using implicitlyWait() [Link]

4. What is Selenium's default timeout for page loading? [Link]

5. WebDriverWait or ImplicitlyWait or ExplictlyWait nothing works [Stackoverflow Link]

6. WebDriverWait or ImplicitlyWait or ExplictlyWait nothing works [Stackxchange Link]

7. One Useful Class for WebDriver - A Package Class for WebDriverWait [Link]

8. WebDriver’s implicit wait and deleting elements [Link]

9. Testing asynchronous applications with WebDriverWait [Link]

10. How to set Selenium Webdriver get timeout [Link]

11. Difference between WebDriver Wait timeout and implicitlyWait timeout? [Link]
12. ImplicitlyWait - Selenium 2 Webdriver C Sharp example [Link]

WebDriver - Open new tab

WebDriver - Open a new tab instead of a new browser window

These below links show you how to open a new tab using WebDriver (Selenium 2) instead of new window in a browser.

1. WebDriver open new tab [Link]

2. Java – How to open a new tab in the same browser by using Webdriver [Link]

3. Selenium web driver: Open new tab instead of a new window [Link]

4. Selenium 2: Open link in new tab and close tabs [Link]

5. Switch tabs using selenium Webdriver [Link]

6. Links opening in new windows all of a sudden [Link]

7. How to force Google Chrome to Open a New Window rather than a New Tab with Webdriver’s Chromedriver [Link]
This above post will show you how to force Google Chrome to open a new window rather than a new tab for the purposes of testing web applications using Webdriver’s fork for Chrome, Chromedriver.

Selenium WebDriver Click Link / Button

Selenium WebDriver Click Link / Button

If you are facing Selenium WebDriver Click Link or Click Button issue then read on. These below posts will help you in-case you are finding it hard to click a link or button using Selenium WebDriver:

1. Click a link / button [Link]

2. Selenium WebDriver – How to click on a hidden link or Menu [Link]

3. How to click in a specific part of a Button using Selenium, for the list of options to be displayed? [Link]

4. Selenium WebDriver Click() fails with IE9 [Link]

5. Click command in selenium WebDriver does not work [Link]

6. WebDriver: Click on button's part for open color chooser [Link]

7. Python/Selenium - Chrome Web Driver, Click Action [Link]

8. How to click a link / button implemented as a div or span element with WebDriver [Link]
9. Selenium WebDriver IE button issue [Link]

WebDriver - Download a File

WebDriver - Download a File

If you looking for information on "How to download a file using Selenium's WebDriver?" then below you can go through some of the finest links on web which cover topic on - downloading a file using Selenium WebDriver.

1. How do I download a file using Selenium's WebDriver? [Link]

2. File Downloads With Selenium - Mission Impossible? [Link]

3. Downloading files with WebDriver [Link]

4. How To Download Files With Selenium And Why You Shouldn’t. [Link]

5. An Android Love Affair [Link]

6. Dealing with File Downloads with Selenium [Link]

7. How to Download and Save Images with Selenium RC [Link]

8. JavaScript simulate right click through code [Link]
9. Ardesco / Ebselen [Link]

Selenium Webdriver Exception Handling



Exception Handling: Selenium Webdriver

Below are some of the links on web which can help you in case you are looking for something related to error handling or exception handling in Selenium Webdriver.

1. The remote WebDriver protocol has two levels of error handling, one for invalid requests, and one for failed commands. An example of an invalid request is for a resource that doesn't exist on the server, or perhaps for a verb that the resource doesn't understand (such as sending a DELETE command to the the resource used for dealing with the URL of the current page) In those cases, a normal HTTP 4xx response is sent. For a failed command, the responses error code is set to 500 ("Internal Server Error") and the returned data contains a more detailed breakdown of what went wrong. [More on this at Selenium WebDriver]

2. Exception Handling in Selenium Webdriver [Link]

3. Selenium::WebDriver::Error::UnhandledError (NS_ERROR_ILLEGAL_VALUE) [Link]

4. How to capture the errors handling in Selenium WebDriver [Link]

5. How to Debug Selenium WebDriver Actions? [Link]

6. How to capture the errors handling in Selenium WebDriver [Link]

7. Selenium Webdriver/Java- Wait function and error handling [Link]

8. Selenium 2/Webdriver JavaScript exception handling: error message is null most of the time (Java API) [Link]

9. Problem catching Selenium Webdriver NoSuchElementException [Link]

10. Handling Element not visible exception in Selenium [Link]

11. How to handle handle exceptions with webdriver? [Link]

12. Problem catching Selenium Webdriver NoSuchElementException [Link]

13. NoSuchElementException after click() in Selenium 2 [Link]
14. Handling "Selenium (WebDriver) Exception: this.getWindow() is null" [Link]

Select / Check Check-box Webdriver

Select / Check Check-box Webdriver

Below posted links will help you to select or check multiple checkbox options in Selenium 2 / Webdriver. So go ahead and check / uncheck checkbox / checkboxes using selenium 2 or webdriver.

1. Check radio buttons and checkboxes [Link]

2. Click Check-box from the list of Check boxes via Selenium/Webdriver [Link]

3. Verify the check box checked or not [Link]

4. select or check multiple checkbox python selenium [Link]

5. Selenium checkbox attribute "checked" [Link]

6. Checking and Unchecking Web Checkbox [Link]

7. Find out if a checkbox is selected [Link]

8. Selenium verify checkbox is checked by text [Link]

9. Moving to Selenium 2 on WebDriver, Part No.2 [Link]

10. How to uncheck multiple check boxes at the same time in Selenium WebDriver (Java) [Link]
11. What is the correct way to select an option using Selenium's Python WebDriver [Link]

     

WebDriver Popup Alert

WebDriver Popup Alert


Here in this post you will learn more about modal dialog and how to handle the same with Selenium WebDriver. Below links will guide you on - How to handle modal dialogs with WebDriver:

1. Selenium Webdriver - Support for window.showModalDialog [Link]

2. How do I handle modal dialogs with selenium 2 [Link]

3. Selenium/WebDriver script gets interrupted by exception "Message: u'Modal dialog present'" [Link]

4. How do I handle the login modal dialog created by onLoad in a WebDriver & Java based test automation [Link]

5. Popup handling in Selenium 2x [Link]

6. Handling a javascript popup occurring on a keyup event [Link]

7. Modal dialog present (Selenium::WebDriver::Error::UnhandledAlertError) after dismissing confirm popup [Link]

8. Selenium WebDriver – Handling Javascript Popups [Link]

9. NoAlertPresentException - WebDriver [Link]

10. Deal with Modal Dialog in my WebDriver test [Link]

11. How to handle login popup window using selenium webdriver? [Link]

Parameterization / Data-Driven Testing Using Selenium Webdriver

Parameterization / Data-Driven Testing Using Selenium Webdriver

Selenium Data-Driven testing or Selenium Parameterization can be done using number of data sources like database, excel, csv files etc. Among these, Selenium Parameterization from excel is more favorite with testers. Below you can look at various awesome links (e.g. Data-Driven Testing with Selenium webdriver, Parameterization of Selenium Tests with Microsoft Excel etc.) to help you achieve your goal of learning Selenium Data-Driven testing or Selenium Parameterization.

test automation with selenium webdriver data driven testing with selenium

Wednesday 27 March 2013

Wednesday 17 October 2012

Project Training for BCA,MCA,BE Computer,IT,BSC IT,MSC IT,Diploma Students,IGNOU,DOEACC students

Send your email to all IT companies for enquiring about Project Training for BCA,MCA,BE Computer,IT,BSC IT,MSC IT,Diploma Students,IGNOU,DOEACC students using JustDial.com

This is automated form filling system developed using Selenium Webdriver and JAVA.

Its not a rocket science. Its simple. Just follow some instructions.

SETTING UP SELENIUM WEB DRIVER into ECLIPSE

http://selftechy.com/2011/05/31/setting-up-selenium-with-eclipse

http://www.anitpatel.net/2011/12/27/setting-up-selenium-web-driver-eclipse-testng/


Once you are ready with Eclipse and added Selenium webdriver jars in Eclipse then make one new class in eclipse and copy paste following code in that class 



public static void main(String[] args) throws InterruptedException {
              WebDriver driver = new FirefoxDriver();
              driver.manage().window().maximize();
             
              // Uncomment following command one by one and run this whole script for all this command
              // this is made for Banglore city
              // you can get more city same way by going and searching on justdialand get links
              // add that link here and run whole script again
             
//            driver.navigate().to("http://www.justdial.com/Bangalore/Computer-Software-Developers-For-Bank");
//            driver.navigate().to("http://www.justdial.com/Bangalore/Computer-Software-Developers");
//            driver.navigate().to("http://www.justdial.com/Bangalore/Computer-Software-Developers-In-Application");
//            driver.navigate().to("http://www.justdial.com/Bangalore/Computer-Software-Developer-ASP-Dot-Net");
//            driver.navigate().to("http://www.justdial.com/Bangalore/Computer-Software-Developers-For-Cellular-Phones");
//            driver.navigate().to("http://www.justdial.com/Bangalore/Computer-Software-Developers-For-Textile-Industry");
//            driver.navigate().to("http://www.justdial.com/Bangalore/Computer-Software-Developer-SAP-ERP");
//            driver.navigate().to("http://www.justdial.com/Bangalore/Computer-Software-Developers-For-Education");
//            driver.navigate().to("http://www.justdial.com/Bangalore/Computer-Software-Developer-Accounting-Management");
//            driver.navigate().to("http://www.justdial.com/Bangalore/Computer-Software-Developer-Distributors");
//            driver.navigate().to("http://www.justdial.com/Bangalore/Computer-Software-Developer-Real-Estate");
//            driver.navigate().to("http://www.justdial.com/Bangalore/Computer-Software-Developers-For-Call-Centre");
//            driver.navigate().to("http://www.justdial.com/Bangalore/Computer-Software-Developers-For-Colleges");
//            driver.navigate().to("http://www.justdial.com/Bangalore/Computer-Software-Developers-For-CRM");
//            driver.navigate().to("http://www.justdial.com/Bangalore/Computer-Software-Developers-For-Departmental-Store");
//            driver.navigate().to("http://www.justdial.com/Bangalore/Computer-Software-Developers-For-Excise");
//            driver.navigate().to("http://www.justdial.com/Bangalore/Computer-Software-Developers-For-Hotels");
//            driver.navigate().to("http://www.justdial.com/Bangalore/Computer-Software-Developers-For-HRD");
//            driver.navigate().to("http://www.justdial.com/Bangalore/Computer-Software-Developers-For-Inventory-Management");
//            driver.navigate().to("http://www.justdial.com/Bangalore/Computer-Software-Developers-For-Invoice");
//            driver.navigate().to("http://www.justdial.com/Bangalore/Computer-Software-Developers-For-Sales-TAX");
//            driver.navigate().to("http://www.justdial.com/Bangalore/Computer-Software-Developers-For-Single-Phase-Motor-Design");
//            driver.navigate().to("http://www.justdial.com/Bangalore/Computer-Software-Developers-For-Three-Phase-Motor-Design");
//            driver.navigate().to("http://www.justdial.com/Bangalore/Computer-Software-Developers-For-Travel-Agents");
//            driver.navigate().to("http://www.justdial.com/Bangalore/Computer-Software-Developers-In-Inventory");
//            driver.navigate().to("http://www.justdial.com/Bangalore/Computer-Software-Developers-In-Power-Builder");
//            driver.navigate().to("http://www.justdial.com/Bangalore/Computer-Software-Development-For-ERP");
//            driver.navigate().to("http://www.justdial.com/Bangalore/Computer-Software-Development-For-Inventory-Management");
//            driver.navigate().to("http://www.justdial.com/Bangalore/Computer-Software-Installation");
//            driver.navigate().to("http://www.justdial.com/Bangalore/Computer-Software-Dealers");
             
              String SearchLinkText = null;
             
             
              // Set variable j based on no of page of the search result of the Justdial.com
              // Click on Next Button 21 times
              for (int j = 1; j <= 21; j++) {
                     System.out.println("Page no" + j);
                     System.out.println("-----------------------------------");
                    
                     for(int i=1;i<=25;i++){
                          
                          
                           try {
                                  String Start = "//*[@id='mainContent']/div[3]/div[";
                                  String End = "]/div[1]/span/a";
                                 
                                  SearchLinkText = driver.findElement(By.xpath(Start+i+End)).getText() ;
                                  System.out.println(SearchLinkText + " --- is opened");
                                  driver.findElement(By.xpath(Start+i+End)).click();
                                 


                                  Thread.sleep(5000L);
                                 
                                  if (driver.findElement(By.linkText("Send Enquiry by Email")).isDisplayed()) {
                                        
                                         // Click on Send Enquiry by Email link
                                         driver.findElement(By.linkText("Send Enquiry by Email")).click();
                                        
                                  } else{
                                         System.out.println(SearchLinkText + " --- Skipping Send Enquiry by Email");
                                        
                                  }
                                 
                                 

                                  //Enter your name in "Your name" in following command
                                  driver.findElement(By.xpath("//*[@id='enqname']")).sendKeys("Your Name");
                                 
                                  //Enter your Mobile no into "Your Mobile no"  in following command
                                  driver.findElement(By.xpath("//*[@id='enqmobile']")).sendKeys("Your Mobile no");
                                 
                                  //Enter your Email ID into "Your Email ID"  in following command
                                  driver.findElement(By.xpath("//*[@id='enqemail']")).sendKeys("Your Email ID");
                                 
                                  //Enter your Email Subject into "Email Subject"  in following command
                                  driver.findElement(By.xpath("//*[@id='enqsub']")).sendKeys("Email Subject [Ex: I am looking for Project & Training in JAVA]");
                                 
                                  ////Enter your one line Email Body into "Email Subject"  in following command
                                  driver.findElement(By.xpath("//*[@id='enqbd']")).sendKeys("Enter oneline email body [Ex: I am looking for training for my 6th sem of BE CE]");
                                 
                                  driver.findElement(By.xpath("//*[@id='Enquiry']/p[9]/input")).click();
                                   
                                  Thread.sleep(10000L);
                                  driver.manage().timeouts().implicitlyWait(3, TimeUnit.SECONDS);

                                 
                                  System.out.println("Email Sent to --- " + i);
                           } catch (Exception e) {
                           System.out.println("Unable to locate ");
                          
                           }
                           driver.navigate().back();
                          
                     }
                    
                     //Click on Next button
                     driver.findElement(By.xpath("//*[@id='srchpagination']/a[13]")).click();
                    
              }
             
             
       }