Posts

How to handle random pop ups

Issue:  In some pages unexpected popup's(ex:ad's) will be displaying. Because of this the script will fail by throwing exceptions like  ElementNotFoundException   and currently  Element is not Interactable  etc.. . Here these ad's are not specific to particular page. It may come at any page.   How to handle? A popup can be an alert or an ad in a iframe or an ad in a new window and all these are treated in different ways. Assuming its an Alert, log_file has already provided you the solution, i.e. to use  alertIsPresent () , and accept or dimiss it as per your requirements. Assuming the ad is in  iframe , follow the below approach: driver .switchTo .frame (driver.findElement(By.id(locatorToIdentifyFrame))); driver .findElement (By.id(locatorToCloseAd)) .click (); //Close Ad driver .switchTo () .defaultContent (); // Return to main window Assuming the ad in the  window , follow the below approach: String mainWinHandle = driver.getWindo...

How to handle downloading of different browser drivers without manual intervention?

 Using WebDriverManager, we can automatically download the driver’s binary files (.exe files) for Web Automation Traditionally the binaries are referred as System.setProperty(""""webdriver.chrome.driver"""", """"D:\\test\\chromedriver.exe"""" ); With WebDriverManager, we can eliminate the downloading of the binaries everytime a new version is released. WebDriverManager.chromedriver().setup(); POM: <dependency>   <groupId>io.github.bonigarcia</groupId>   <artifactId>webdrivermanager</artifactId>     <version>3.0.0</version>   <scope>test</scope> </dependency>""

Docker configuration for selenium tests

Image
Why docker for selenium testers: Usually while configuring the Selenium grid we need to host multiple virtual machines as nodes and we need to connect every single node with the hub. Also, when we set up a normal grid we need to download the Selenium server jar file and run that jar file on each computer in which we are going to set up the Selenium grid. This is costly and sometimes a time-consuming task for the testers. However, Docker helps us to solve cost-related and time-consuming problems. Steps to create a automation project with the help of Docker: -Create a Maven project -Add selenium dependencies -Create a class like below.This will print Google by executing test in container created from docker. -Define and initialize a chromeStandAlone container in 4444 port.Below details gives details of docker. Most used common Docker commands: docker ps : Will give information of all containers running in the machine. Docker Images : will show all current images docker pull <image n...

Most common used Docker Commands for SDETs

Image
Why we need docker for selenium Tests: Selenium grid helps to run our test cases in different operating systems and on different browsers.  Usually while configuring the Selenium grid we need to host multiple virtual machines as nodes and we need to connect every single node with the hub. Also, when we set up a normal grid we need to download the Selenium server jar file and run that jar file on each computer in which we are going to set up the Selenium grid.   This is costly and sometimes a time-consuming task for the testers. However, Docker helps us to solve cost-related and time-consuming problems. By using Docker containers we can set up and pack a software application with all of the contents that are required to build that application, such as databases, libraries, and other dependencies, and finally, you can ship them all out as one package. So with the help docker of we can configure the hub and nodes as images which already built in docker hub. So since Docker is a...

Linux commands 1 : Commonly used FILE AND DIRECTORY COMMANDS for daily use and interview

Image
  Hello Techies, Unix Knowledge required for Software Testers - Manual and Automate the various UNIX / LINUX processes, So that we can achieve end to end test automation (If we have any Unix processes in your application).We use these command when we work on Git Bash too. So here I am listing all the commands which we use frequently. # List all files in a long listing (detailed) format ls -al # Display the present working directory pwd # Create a directory mkdir directory # Remove (delete) file rm file # Remove the directory and its contents recursively rm -r directory # Force removal of file without prompting for confirmation rm -f file # Forcefully remove directory recursively rm -rf directory # Copy file1 to file2 cp file1 file2 # Copy source_directory recursively to destination. If destination exists, copy source_directory into destination, otherwise create destination with the contents of source_directory. cp -r source_directory destination # Rename or ...

Coding Exercise 1

Image
 Coding Exercise 1: int a=4, 5,6,7 Int b=5, 90,31,44,20,32 Declare above array a and b Create 3rd array c which would have data of a and b In above question we can't use array list and sort method of collection. Java: import java.util.Arrays; public class copyonearraytoanother { public static void main(String[] args) { int a[]= {4,5,6,7}; int b[]= {5,90,31,44,20,32}; int[] mergedArray = new int[a.length+b.length];    //resultant array   //int c[]= {}; int pos=0; for(int ele : a) { mergedArray[pos]=ele; pos++; } for(int ele : b) { mergedArray[pos]=ele; pos++; } System.out.println(Arrays.toString(mergedArray)); } } Python: a=[4, 5,6,7] b=[5, 90,31,44,20,32] c=a+b print(c) Meet you in another Exercise!!

Coding challenges on Python and Java

Image
  Hello Guys!! As you aware these days to crack any Automation interview Java or Photon programming skill become mandatory and we are getting questions to write programs in the interview. So I will be posting two coding exercises per day. Solution will be given both in Java and Python. First try yourself without seeing the solution, this will improve your logical thinking. If you are not getting, its not an issue because making a century always starts with one run. So you can look at the solution, analyze and try yourself. See you in the next post!!!💬💬💥