How to handle Webtable in Selenium

Simple way to handle Webtable in Selenium Web Automation

Steps/coding/dom inspecting logic:

  1. Right Click and Inspect html for table
  2. Identify the patern for colum 1 of table
  3. Carefully observe the xpath of column 1 row 1 to row 3
  4. Notice that xpath has “tr[1]/td[1]”, “tr[2]/td[1]” , “tr[3]/td[1]” etc for following rows in colmn 1
  5. Use For loop and replace tr[1],tr[2],tr[3] with for loop variable “i”

Python short videos for interview preparations

Python #2 handling file not found error

Python # 15 Lambda function in Python 3 onwards

Python #7 Exceptions | AttributeError — happens when an attribute reference or assignment fails

Paython #8 Exception |IOError — happens when I/O operation open() function fails like file not found

Python #9 Exception | ImportError happens when import statement cannot locate the module definition

Python # 10 Exception | IndexError  happens when a sequence subscript is out of range

Python #11 Exception KeyError :happens when a dictionary key isn’t found in the set it existing keys

Python # 12 Exception | NameError happens when a local or global name can’t be found

Python # 14 Nested If statements to check multiple conditions

Python # 16 How to find highest value in an array

Python #13 What is if __name__ == “__main__”: in python

Python # 6 if elif else condtion code example for python | code logic

Python #5 How to define own function code example | python automation | programming

Python #4 argparse standard library for taking commandline arguments into python program

Python #1 for looping  | Python programming

Python #3 logging usage | import logging

Python # 19 Python 3.9 features | new features in Python 3.9

What’s QA Architect and what are the responsibilities

WHAT’S QA ARCHITECT AND WHAT ARE THE RESPONSIBILITIES

QA Architect role for a team or organization is critical for success. QA Architect roles can be following based on the what the team’s immediate needs and objectives,

  1. Could be a thinker to bring innovations especially for a matured agile team.
  2. Could be a trainer for a team which is not so matured with technology. QA Architect would help accelerate automation delivery here.
  3. Could be leader who gives technical direction and build strategy in selecting right tools , techniques and technologies
  4. A short term problem solver or a facilitator for long term process improvement.

Apart from Web and API automation skills, QA Architect must need to have following skills and technology knowledge,

  1. Experience in any of the cloud Techonologies like AWS, Azure or any similar one in market. Please refer AWS articles
  2. Experience in DevOps toolchain, please refer
    1. Jenkins, Jenkins pipeline creation, Jenkinsfile maintenance etc,
    2. Dockerfile creation, maintenance, container review, debugging knowledge
    3. Ansible, AWX console usage, playbook maintenance,
    4. SonarQube report analysis, rules settings, etc
    5. Jira, Confluence usages for automation results integration
    6. Gatling performance or similar performance test integration to Jenkins pipeline to make sure the workflow includes performance stage as well.
  3. Kibana visualization, ELK stack building and integration. This will help real time reporting on automation results and metrics.
  4. AI, Machine learning knowledge, experience on AI , ML tools and framework or libraries like Tensorflow
  5. Programming skills in Java, powershell, Python, R, Database experience, web development experience etc

What is Selenium Grid Extras

WHAT IS SELENIUM GRID EXTRAS

Selenium Grid Extras is the enhanced Selenium Grid having more features like auto upgrade of browsers and Video recording enabled for error debugging purposes. Following Additional benefits due to Selenium Grid extras,

  • Explicitly kills browsers after the test
  • Increased stability for the automation
  • Better support for IE on nodes
  • JVM clearing is done by restarting the Java process on the Nodes by Grid Extras, this happens periodically whenever Node is not in use.
  • Extras can restart the OS after 15 – 20 tests which boosts the performance on Nodes.

What is interpolation vs property binding in angular

WHAT IS INTERPOLATION VS PROPERTY BINDING IN ANGULAR

Data binding makes the angular applications development very easy.

Data binding helps to do the data synchronization between the template(view/html) and class(typescript code)

There are 4 types of data binding in Angular and are following,

  • Event binding
  • Two way data binding
  • Interpolation
  • Property binding

What is Interpolation?

For interpolation, double curly braces are used in the template as below,

// app.html is the example for interpolation

<p>{{ name }}</p>  

and it stores the variables, then angular checks for the variable and updates the value assigned to the text.

The Typescript app.ts as below to display the name value to app.html.

// app.ts

@Component({
  templateUrl: 'app.html',
  selector: 'app-test',
})
export class AppComponent {
  name = 'Sharath C';
}

What is Property binding?

Property binding helps to set the property of a view element and it uses [] syntax as below

// app.html is the simple for the property binding.

<button [disabled]="buttonIsDisabled"></button>

TypeScript has to be coded as below to pass the property binding to view template. refer the app.ts as example for Typescript passing the property value

// app.ts
@Component({
  templateUrl: 'app.html',
  selector: 'app-test',
})
export class Component {
  buttonIsDisabled = true;
}

Selenium tutorials

Selenium Tutorials 

Selenium and Jenkins

Protractor 

RobotFramework

Selenium features as below

 Selenium supports Cross Browser Testing. The Selenium tests can be run on multiple browsers and multiple machines and multiple Operating systems.

Supports several scripting languages like Java, Python, C#, and PHP.

Selenium uses Browser native commands. It locates and actions applied on UI elements,

Reporting are very easy and extensible.

TestNG quick summary:

 TestNG’s is Selenium + reporting features. It is easy to generate reports using Listeners and Reporters in TestNG

 Features of TestNG includes the following,

1)      Annotations – please refer my annotation blogAnnotation – TestNG’s test case priority

2)      Supports parameterization/ data driven testing

3)      Test cases can be grouped and parallel testing is allowed.

Automaton testing using Cucumber – Behavior driven development (BDD)

Application behavior is the main focus on BDD. The requirements are written in English which gives more readability and understandability of the requirement.

So any roles in the company (Tester, developer, end user, and techno functional person) can read it and understand it. Also this will reduce the complication in terms of missing requirement or misrepresenting or misunderstanding requirements between different roles (Developer /tester / end user)

Gherkin is a business readable language – refer below for an example. Below feature file is integrated with Selenium and are having user stories as below.

Please refer below – “feature, Scenario, Given, When, And, Then “are the Keywords below to understand on how to write a feature file.

Selenium jenkins integration steps are as below:

  Jenkin related steps:
1) start jenkins by running command in DOS prompt (detailed steps in here )
2) then make sure you are able to access url : localhost:8080
3) then you need to configure jenkins to run the selenium scripts – for that click on “Manage Jenkins”
4) then click on Configure systems
5) Find out the jdk files are installed (usually in C:\ program files … folder path) and copy paste the path in JDK section “JDK Installations” in ” Configure systems” which you are already in.
6) Give JDK name “JAVA_HOME” and provide Java path below in the next field. Selenium related steps:
3) Open eclipse IDE and start new Java project
4) make sure you added selenium jars (Selenium server standalone jar file which you can download add to new project) to support selenium framework for your automation testing.
5) then create a simple selenium script – make sure it is running and completing successfully in Eclipse.
6) Also create a xml file give a name “Xml1.xml”  Make sure Run “Xml1.xml” as “TestNG Suite” is working fine in Eclipse. Also notedown the xml file path in selenium project. create a lib folder in that and add all jar files which are required. Commmand prompt:
7) navigate to that project folder in command prompt and set all required classpath like bin and lib etc which are already in xml file folder in selenium project which you got from selenium project in eclipse.
8) then type command “Java org.testng.testNG Xml1.xml” which will display results in command prompt/DOS screen
9) now create a batch file “Batch1.bat” which contains the above command and also a command for compiling as e.g “java -cp bin;lib/* org.testng.testNG Xml1.xml” Jenkins setup to build and run the file:
10) in Jenkins, create a “new item” with selection of “Freestyle project”
11) then select “Advance options” and put the Selenium project home directory path in there.
12) the build trigger section, select Batch file execution option in there, then put the batch file name “Batch1.bat”
13) click and save the new item
14) click on “Build Now” and verify the “Console output”

How to configure Hub & Node machines for selenium parallel test execution
Configuring Hub machine

1) Start the command prompt/DOS prompt

2) Navigate to the folder location where the Selenium server jar file is kept.

3) Type java –jar selenium-server-standalone-[VERSION].jar –role hub

Note: [VERSION] is the one your downloaded version of selenium-server-standalone Jar file.

Your will see the below screen

Selenium Hub
Selenium Hub

4) Now type: http://localhost:4444 in browser

Your will see the below screen

5) Now type: http://localhost:4444/console in browser

You will see the below screen

Console

Configuring Node machines

Follow the same steps 1 to 2 in node machines

Then type,

Java –jar selenium-server-standalone-[VERSION].jar –role node –hub http://yourHUBmachineIP:4444/grid/register

Selenium Node

What is TestRunner in Cucumber

In order to link Cucumber with Selenium WebDriver, you need to start a Java project in eclipse IDE.

Then, add both Cucumber and Selenium jar files

Write test runner code and execute the same . Please refer BDD testing details on Selenium Cucumber

RaspberryPi projects for kids

RASPBERRYPI PROJECTS FOR KIDS

Stay@home projects for kids – implementing many fun programming options using RaspberryPi. Here is how I was able to successfully engage my 9 year old to fun programming that helps her code interactive stories, animations and games using Scratch programming plus other few RaspberryPI projects. Implementation steps include,

  1. OS installation on RaspberryPi : Installing Raspbian on RaspberryPi needs downloading Raspbian image and write that to microSD card.
  2. Setting up RaspberryPI: insert the miscroSD card to RaspberryPi and then connect the basic peripherals like mouse, keyboard, TV screen, and power source.
  3. Now all set to enjoy RaspberryPi during Stay@home time !!!

4. Select the Programming Menu to start Scratch from TV monitor

5. About Scratch – It is block based visual programming language primarily targeted for children. Ref – https://scratch.mit.edu/

6. Other RaspberryPi development options – refer https://shalimatech.com/what-is-docker-file-image-container/

How to configure Sonarqube Jenkins integration

How to configure sonarqube in jenkins?

SonarQube is code quality checker and that can be integrated to Jenkins workflow to deliver continuous inspection.
Configuration steps as follows:SonarQube:1. Do a SonarQube docker image pull from docker hub 2. Then use docker run command to run the image to build SonarQube container.(Assumption JDK is already setup on the machine) if not , we need to docker containerized JDK.3. Now that step 2 allows us to run the SonarQube as a standalone server under localhost port 9000. (Type localhost:9000 on browser)4.login to SonarQube web app using admin as user I’d and admin as password.5. The go to Admin tab , Market place of SonarQube and install the plugins you wanted (SonarPython, Java, Groovy etc)6. You may need to restart SonarQube app after applying plugin installation.
Jenkins integration with Sonar1. Now that Sonar Server is ready, you may need to integrate Jenkins with Sonar.2. Login on to Jenkins, and go to Manage plugin section to install Sonar plugin.3. After restarting Jenkins, go the Configure system in Manage Jenkins section.4. Enable injection of Sonarserver,  add Sonar server auth token etc.
Now, Enable Analysis with Sonar scanner by defining the SonarQube server on Global configuration Then configure Jenkins build

What is contract testing

What is contract testing?

Contract testing is famous in microservices world. When we consider less numbers of microservices,  then contract testing is not so necessary.However when you look at the Amazon or Netflix microservices mesh, it is countless. Such cases it is extremely difficult for developer or tester to maintain unit/automation test suite as per the microservices development chnages.
Contract testing is the best possible solution currently offered for this situation. In contract testing, a mocked service is created to represent the provider.  There are commercial or opensource tools available to stimulate this. In short, contract is set of predefined requests and responses created by automation or developer team to do their testing.

How to read pdf content in java for automation project

How to read pdf content in java?

Apache PDFBox and FontBox jar available can be useful here. Add these two libraries to your Maven Pom.xml or build.gradle dependencies.
Then write java code to parse your PDF files to create POJOs.
What is POJO in javaPOJO stands for Plain java object and it has not restrictions or class path dependency.