Run Selenium WebDriver Tests on Chrome Browser against MAC,LINUX,WINDOWS



Selenium automates browsers like Firefox,Chrome and Internet Explorer.
Selenium WebDriver Scripts run against multiple Platforms MAC,Windows and Linux.
In this tutorial, we will discuss about Running Selenium WebDriver Scripts on Chrome Browser.

Steps to be Followed to Execute Tests on Chrome Browser
1. Access the URL http://seleniumhq.org and navigate to the Downloads tab.

seleniumhq.org

seleniumhq.org


2. Click on the Download Link the Latest version of Selenium Jars.
Selenium Webdriver Latest Version

Selenium Webdriver Latest Version


3. Unzip the selenium-java-3.xx.0.zip file and view the contents of the Jar files.
Selenium WebDriver & Library Jar Files

Selenium WebDriver & Library Jar Files


4. Open Eclipse->Right Click on Java Project->Build Path->Configure Build Path.
ConfigureBuildPath

ConfigureBuildPath


5. Click on ‘External Jars’ button and navigate to the directory where the Selenium Webdriver jars are unzipped in previous Step 3.
AddExternalJars

AddExternalJars

6. Add the External Jar – client-combined-3.xx.0.jar.

client-combined-3.13.0.jar

client-combined-3.13.0.jar

7. Add the External Jars available under lib folder unzipped in Step 3.

Selenium WebDriver Lib Jars

Selenium WebDriver Lib Jars




Update Chrome Browser
1. On your computer, open Chrome browser.
2. At the top right, click More as shown in the below screenshot.

Chrome Browser - Update Chrome

Chrome Browser – Update Chrome


3. Click Update Google Chrome. If you don’t see this button, you’re on the latest version.
Chrome Latest - Version

Chrome Latest – Version


4. Click Relaunch and verify the Chrome Browser updated to the Latest version.




Download the chromedriver.exe and copy to Java Project.
1. Download the Latest Version of Chrome Driver Executable File from this link.
http://chromedriver.chromium.org/downloads
2. Download the Zip file according the Operating System-Windows,MAC,Linux.
Note: For Windows, 64 bit version is not available.

Chrome Latest Version-MAC,WINDOWS,LINUX

Chrome Latest Version-MAC,WINDOWS,LINUX


3. Unzip the File and look for chromedriver.exe.
Unzip the  file and look for chromedriver.exe

Unzip the file and look for chromedriver.exe


4. Right Click and copy the chromedriver.exe downloaded.
Copy chromedriver.exe

Copy chromedriver.exe


5. Open Eclipse and Right Click on the project in the package explorer and copy the Executable file in
the Java Project.
Selenium WebDriver PRoject

Selenium WebDriver PRoject


Example Program

Console Output

ConsoleOutput

ConsoleOutput



To disable the Information Logs in the console
Firefox:
Add the below statement before instantiating the Firefox Driver instance.
System.setProperty(FirefoxDriver.SystemProperty.BROWSER_LOGFILE,“null");
Chrome Browser
Add the below statements before instantiating driver instance.

ChromeOptions chromeOptions = new ChromeOptions();
chromeOptions.addArguments("--log-level=3");
chromeOptions.addArguments("--silent");
WebDriver driver = new ChromeDriver(chromeOptions);

Integrating GitHub with Jenkins for Continuous Integration and Continuous Delivery



GitHub is a Web-based Git repository hosting service. It offers all of the distributed revision control and source code management (SCM) functionality of Git as well as adding its own features.
Jenkins is an open-source continuous integration software tool written in the Java programming language for testing and reporting on isolated changes in a larger code base in real time. The software enables developers to find and solve defects in a code base rapidly and to automate testing of their builds.
Objective:
In this tutorial we will discuss how to integrate Github with Jenkins and triggering the code.

Steps to follow:
1. Download Jenkins from this link as a service in windows.

Download Jenkins

Download Jenkins


2. Open Windows Service Manager using to start and stop the Jenkins as a service.
services.msc-start and stop the Jenkins service

services.msc-start and stop the Jenkins service


3. Access the Jenkins URL running on the port number 8080->http://localhost:8080 for the first time. Unlock jenkins by providing Initial Admin
Password.
Unlock Jenkins by using InitialAdminPassword

Unlock Jenkins by using InitialAdminPassword





4. Customize the Jenkins by installing the Suggested Plugins.
Customize Jenkins by Selecting the Suggested Plugin

Customize Jenkins by Selecting the Suggested Plugin


5. Create First Admin User. Provide username & password as admin/admin and Click on ‘Save and Continue’ button.
Jenkins First Admin User-admin/admin

Jenkins First Admin User-admin/admin


6. Once the Jenkins Configuration is done. Click on ‘Manage Jenkins->Manage Plugins’ link to install the required plugins.
Manage Jenkins->Manage Plugins->Upload .hpi to download any plugin in Jenkins.

Manage Jenkins->Manage Plugins->Upload .hpi to download any plugin in Jenkins.


7. Download the Plugins manually from this link https://updates.jenkins-ci.org/download/plugins/.
Upload an .hpi

Upload an .hpi


8. Update Global Tool Configuration by updating the Location of the software install by navigating to ‘Manage Jenkins->Global Tool Configuration’. Provide the location of JDK installed in the server/localhost.
Global Tool Configuration

Global Tool Configuration





9. Create Jenkins Job by clicking on New Item.
Jenkins New Item

Jenkins New Item


10. Select the Maven Project option and Provide the Item Name as .
New Item->Maven Project

New Item->Maven Project


11. Click on Configure.
Configure Jenkins

Configure Jenkins


12. Provide the Github Repository URL and select the Branch.
Jenkins-Github Repo->Master branch

Jenkins-Github Repo->Master branch


13.Provide the Location of pom.xml and mention Maven Goals.
Jenkins - Maven pom.xml

Jenkins – Maven pom.xml





14. Click on Build Now.
Jenkins->Build Now

Jenkins->Build Now


15. View the Results in Jenkins->Job Name->Job ID->Console Output.
Jenkins - Job #ID- Console Output- to view Results

Jenkins – Job #ID- Console Output- to view Results


16. To view the Browser running in the back ground. Open the command . Select the Jenkins process.
Perform Right Click and do the steps.
Jenkins->Properties

Jenkins->Properties


Jenkins ->Service>Properties

Jenkins ->Service>Properties


17. During the Execution the following dialog shows select the option ‘View the Message’ then
automatically we can view the execution on Browser.
Interactive Services Detection Dialog

Interactive Services Detection Dialog


18. Viewing the Results in Jenkins JOB.
Jenkins Job->Test Results

Jenkins Job->Test Results




[Solved]Error in Launching Eclipse on a MAC-Failed to find a Main Class

Refer to the below Links for Practise
Collections in Java
Complete List of Selenium Basics
50 Real Time Interview Questions
Real Time Scenario’s
Java Platform Standard Edition 8 Documentation
Java Quiz
Java OOPS Quiz
Selenium Advanced Quiz
Selenium Quiz


1. Once installation of Eclipse Latest Version – Photon on MAC from this Download link
http://www.eclipse.org/downloads/download.php?file=/technology/epp/downloads/release/photon/R/eclipse-java-photon-R-macosx-cocoa-x86_64.dmg
2. Navigate to the Downloads Folder.
3. Click on the the Disk Image File eclipse-java-photon-R-macosx-cocoa-x86_64.dmg file to launch the Eclipse.
The following error shows:

Unable to Launch Eclipse - MAC

Unable to Launch Eclipse – MAC


Solution:
1. Open Terminal type the command “java -version“.
2. Make sure the latest version of Java > 1.8 is installed on a MAC Laptop.
3. Else Install the Java JDK 1.8 from this link on MAC helps to fix the issue.
http://download.oracle.com/otn-pub/java/jdk/8u181-b13/96a7b8442fe848ef90c96a2fad6ed6d1/jdk-8u181-macosx-x64.dmg

Tips on MAC:
Short cuts on MAC refer to the link -> https://support.apple.com/en-in/HT201236

Select the Date from DatePicker in Selenium WebDriver-Example for While loop



In this example we will discuss how to automate the
Date Picker in Selenium WebDriver.
This example also gives details about
the usage of while loop.As we know for and while loop looks
similar in objective. But while loop, helps to execute the
block only when the condition is true.

Difference between for loop and while loop
The for loop is used when you know how many times to execute the block of statements.
In the case of while loop when you are unsure how many iterations are required to
complete the given expression.

DatePicker
The datepicker is tied to a standard form input field. Focus on the input (click, or use the tab key) to open an interactive calendar in a small overlay. Select the date it will display in the input text box.

Real Time DatePicker Example
1. Access the Clear trip website using the following url:
https://www.cleartrip.com/
2. Identify the Input Text box.
3. Provide the Future Date to select the Departs on.

DatePicker.java

DatePicker.java


Selenium WebDriver Program



Test your Knowledge in Java,Selenium,HTML,QTP,CSS by attending Quiz!!!!
Quiz Link

Auto Suggestion & Auto Complete Text Box – visibilityOfAllElementsLocatedBy Example



In this Example we will focus on Handling Auto Suggestion or
Auto Complete Textbox in Web Based Applications like Yahoo in Selenium WebDriver. This Example helps
to understand the usage of Synchronization – Explicit Wait in Real time Scenario’s.
Also usage of the method
ExpectedConditions.visibilityOfAllElementsLocatedBy
in Selenium WebDriver.
Definition of Auto Complete
Autocomplete or Auto Suggestion allows the browser to predict the value. When a user starts to type in a field, the browser should display options to fill in the field, based on earlier typed values. The auto complete works
with the following input types: text, search, url,email and datepickers.

Scenario



1. Open the browser
2. Enter the url https://in.yahoo.com/?p=us
3. Type Selenium in the Search text box
4. It displays the options for Selenium
5. Select the text ‘Selenium Interview Questions’ from the display options.

yahoo.com

yahoo.com


Example

Console Output



Eclipse Console Output

Eclipse Console Output


Search Results
Yahoo Search Results

Yahoo Search Results



Compiling and Running Java Programs without IDE – Online Compiler – Online Editor



In this tutorial we will focus on executing java programs for
practice without using IDE’s like Eclipse,
NetBeans,IntelliJ
and also to run java programs
without installing the JAVA Software and compile
and run using the Online Editors.
Download and install the Java from this link -> Java SE Development Kit 8 Downloads

Executing the JAVA Programs without using IDE’s such as Eclipse,Net-beans, IntelliJ Editors
Make sure the java is installed in the location.

JAVA INSTALLATION DIRECTORY LOCATION

JAVA INSTALLATION DIRECTORY LOCATION

Basic Program in JAVA.

Compiling Java from the Command Line / Terminal on MAC or Linux.
1. To open command line Win + R keys on your keyboard. Then, type cmd or cmd.exe and press Enter

Win + R keys on your keyboard. Then, type cmd or cmd.exe and press Enter to open Command line.

Win + R keys on your keyboard. Then, type cmd or cmd.exe and press Enter to open Command line.





2. Execute the following Command to Compile the Program.
javac HelloWorld.java

javac HelloWorld.java

javac not recognized error:
‘javac’ is not recognized as an internal or external command, operable program or batch file error
comes when you try to compile a Java source file using javac command e.g. javac Helloworld.java
To overcome this you can give the path of the javac available in the program files.

Location of file javac available under the directory java/jdk.

Location of file javac available under the directory java/jdk.


Executing Java from the Command Line / Terminal on MAC or Linux.
open command line and execute the JAVA program using the follow command.
java HelloWorld

java HelloWorld


Executing the JAVA programs using Online Editors without downloading the software.
Practicing the java programs without installing the Java is easy using the below online
editor. This helps to Edit and execute the programs



REST API Automation Testing Tutorial 1 with Rest Assured – Live Example



Rest Assured
Rest Assured API is used to test the REST [Representational State Transfer] methods as such GET,POST,DELETE and UPDATE Methods. REST API Documentation can be referred using the link http://www.javadoc.io/doc/com.jayway.restassured/rest-assured/2.9.0.
In this tutorial we will discuss about the usage of GET Method.
Before Getting into this Example Please follow the links mentioned below for better understanding of Rest Services.
Rest API Basics
REST API – FACEBOOK & GOOGLE API EXAMPLES

Pre-requisites
Follow the Steps in the Link to download the sample REST Application and deploy on
a tomcat Server-> REST API Application Live Example
Implementing the Framework
All the below methods taken care as part of Framework
1. Method Response getServiceResponse(String serviceURL) added as part of the RestLibrary.java class which helps to provide the response based on the end point URL passed as a parameter.


2. Methods used to store the Run time Value in setSysProperty() and fetch the value using getSysProperty().

3. This framework is implemented with Object Properties where the REST Endpoint url’s are
stored in the configuration.properties
.

3. Test case to retrieve all the Customers.


4. Test case to retrieve a particular customer by updating the Customer ID during run time.


5. Test case to retrieve a particular customer by updating the Customer ID using setProperty() and getProperty() Methods.

6. This framework is integrated with Allure as well, so the response can be viewed in the report itself.

REST API Live Example - GET Method Implementation

REST API Live Example – GET Method Implementation




Logic as follows:
RestAssuredExamples.java

RestLibrary.java

APIBaseClass.java

configuration.properties

Attaching the XML Response in Allure Report
1. Refer to complete implementation of Allure Reporting.

Allure Reporting





2. Add the below code in your Base Class.

Attaching the JSON Response in Allure Report
1. Refer to complete implementation of Allure Reporting.

Allure Reporting





2. Add the below code in your Base Class.

CSS Quiz for Beginners & Interview Questions




Total-QA Css Quiz

1. What is the CSS used for representing the heading tags with background color as green?

 
 
 
 

2. What is the property used for background-color for an input Element?

 
 
 
 

3. What is the attribute used to represent in-line style Sheets?

 
 
 
 

4. What is the CSS property used to generate space around an element’s content, inside of any defined borders??

 
 
 
 

5. What is the attribute to represent the Internal Styles??

 
 
 
 

6. What is the syntax for representing multiple styles for an Element?

 
 
 
 

7. What is the correct way of representing the External CSS?

 
 
 
 

8. What is the Correct Syntax for CSS to be mentioned in the style tag in the head section?

 
 
 
 

9. What is the full form of CSS?

 
 
 
 

10. What is the CSS used for the Displaying the body back ground color?

 
 
 
 

Question 1 of 10

Cick this Subscription Link to keep in touch with us!!

HTML Quiz & Interview Questions for Beginners




Please go to HTML Quiz & Interview Questions for Beginners to view the testCick this Subscription Link to keep in touch with us!!

Sorting the Dynamic HTML Table List in Selenium WebDriver & Java



Sorting:
In computer science, a sorting algorithm is an algorithm that puts elements of a list in a certain order. The most frequently used orders are numerical order and lexicographical order or alphabetical order.
In Selenium WebDriver it is important to verify the Sort Functionality of the Dynamic HTML Content
is working as expected.

Sorting the Dynamic HTML Table-Selenium WebDriver & Java

Sorting the Dynamic HTML Table-Selenium WebDriver & Java

Steps to Perform:
1. Retrieve the List from HTML Table.
2. Store the List in an Array
3. Sorting the items in the Array using Swapping.
Swapping is the process of Exchanging the Values.
4. Click on Sort button in the WebPage.
5. Retrieve the List again.
6. Compare the Sorted Array generated in Step 3 with the List generated in Step 5.




Selenium WebDriver Logic




Refer to the below Links for Practise
Collections in Java
Complete List of Selenium Basics
50 Real Time Interview Questions
Real Time Scenario’s
Java Platform Standard Edition 8 Documentation
Complete List of Java Basics
Java Quiz
Java OOPS Quiz
Selenium Advanced Quiz
Selenium Quiz
Selenium WebDriver Resume