Posts

Showing posts from 2019

Selenium WebDriver - Implicit, Explicit and Fluent Wait

In this post, you will learn about different waits in Selenium. Waits are required to tell Selenium to wait for a specific amount for elements on the web page before throwing "No Such Element Exception". There are three types waits in Selenium Webdriver, out of which first two are the most popular.
Implicit WaitExplicit WaitFluent Wait Implicit Wait Implicit wait is used to set a default wait time (say 30 secs) in your automation script to wait for an  element on the page. Key PointsImplicit wait should be declared in your setup method (at beginning lines of your code).Default wait time for Implicit wait is 0 secs.Once implicit wait is set, it is applicable for the whole automation script.In simple words, you can also say that implicit wait is the maximum time set between two steps/commands of the automation script.Webdriver throws "No Such Element Exception" if element is not found in specified time. Syntax: // Implicit wait - Set wait of 10 seconds driver.manage(…

Top 20 Advanced Selenium Webdriver Coding Interview Questions of 2019

Image
Question 1 -How to handle Alerts or Pop-Ups using Selenium Webdriver?Answer - Alerts or javascript pop-ups can be handled by using commands of org.openqa.selenium.Alert class in Selenium Webdriver.  Read details - Alert Handling


Question 2 -How to Handle Multiple Browser Tabs Using Selenium Webdriver? Answer - Multiple browser tabs can be handled using Keys enumerator and switchTo() method.  Read details - Multiple Browser Tabs Handling


Question 3 -How to Achieve Code Reuseablity & Maintainablility in Selenium Code?Answer - Code re-usability can be achieved by creating page methods (action methods) and use those methods in your test method code instead of direct selenium commands. Read details - Code Re-usability in Selenium




Question 4 -How to Handle Dynamic Web Table in Selenium WebDriver?Answer - We can handle dynamic web table by preparing dynamic xpath of table at runtime.  Read details - Handle Dynamic Table


Question 5 -How to Extract Table Data/Read Table Data Using Selenium WebDrive…

Selenium Essentials - How to become expert in Automation Testing?

Image
You can learn Selenium Webdriver yourself in just 1 month, yes you read it right!

If you want my above statement to work for you, then you would have to come up with a proper study plan and follow it with discipline. Discipline is the key here. Good news is, I am going to help you to make that study plan and also will share very useful blog posts links for the same, later in this post.




First important question is: What all you need to learn to become expert in Selenium Webdriver?
Answer is simple, by learning everything mentioned below:

1. First and foremost thing is Software Testing concepts: You can find Software Testing tutorial series here - Software Testing Tutorials Series


2. Coding concepts - You have to learn coding concepts/skills in any one of the language which Selenium support i.e., Java, Pyhton, Ruby, C#, PHP. Currently java is ahead in the race. Refer this link to learn Java for Selenium - Java Tutorials Series

3. Fundamentals of HTML & CSS - You should have very basic kn…

Java - What are OOPS Concepts?

We used to hear OOPS very often whenever we come across JAVA language. In this post we are going to have a look at the OOPS concepts of the Java. Some of the object oriented languages are: C#, C++, PHP, Java, Python etc.

Main concepts of OOPS are:
ObjectClassInheritancePolymorphismAbstractionEncapsulation1. Object: 
A Java object is a combination of data and procedures working on the available data. An object has a state and behavior. The state of an object is stored in fields (variables), while methods (functions) display the object's behavior. Objects are created from templates known as classes. In Java, an object is created using the keyword "new".
Syntax of creating an object:
MyClass obj = new MyClass();
In above example,  MyClass is class name, 'obj' is the object name (object name can be anything) 'new' is keyword of java which instantiates the object (or in simple language it creates the object'MyClass()'is the constructor of 'MyClass'
2. …

Selenium-TestNG Integration Explained with Coding Example

Image
In this tutorial you will learn the real use of TestNG annotations covered in previous post with Selenium Webdriver scripts.



Selenium - TestNG integration program:

package com.techlistic.selenium; importorg.openqa.selenium.WebDriver; importorg.openqa.selenium.chrome.ChromeDriver; importorg.testng.annotations.AfterMethod; importorg.testng.annotations.BeforeClass; importorg.testng.annotations.BeforeMethod; importorg.testng.annotations.Test; publicclassTestNGAnnotations2 { WebDriver driver; @BeforeClasspublicvoidsetupClass() { // Set Chrome driver property System.setProperty("webdriver.chrome.driver", "D:\\mydir\\chromedriver.exe"); // Launch chrome browser driver = new ChromeDriver(); // Opening Browser URL and maximize it driver.get("http://www.techlistic.com/"); driver.manage().window().maximize(); } @BeforeMethodpublicvoidsetupMethod() { // Webdriver Code for login } @Testpublicvoidtest_HomePage() { // Webdriver c…

Top 10 Demo Websites to Practice Selenium Webdriver Online

Image
In this post you will find links of top demo websites/pages which Automation Professionals can use for practice purpose. Here is the list of demo websites:
1. AUTOMATION PRACTICE FORM Level - BeginnerAbout - This form contains all the important form elements which we come across daily like text box, radio button, check box, select drop downs, multi-select box, button, links, File Upload, Download link.


2. AUTOMATION PRACTICE TABLE Level - IntermediateAbout - This web page contains table data. You can test your Selenium and Java skills. It would require Selenium commands and java loops, conditions to read table data. 

3. PRACTICE WINDOWS & ALERTS Level - IntermediateAbout - This web page contains buttons/ links which produces new web windows, javascript alerts etc. You can practice selenium commands to handle windows/alerts on this page.

4. E-Commerce Practice Website Level - Intermediate/ProAbout - It’s a full featured e-commerce website simulator and my favorite. Here you can test anythi…