Thursday, 25 June 2020

Top 30 Interview Questions on Automation Testing - Selenium for SDET/Automation QA?


Check Selenium Interview questions from 1 to 10 below:


Check Selenium-SDET-UIAutomation Questions set 11 to 20:
Qus Set - 11 to 20

Check Selenium-SDET-UIAutomation Questions set 21 to 30:
 
Check Selenium-SDET-UIAutomation Questions set 31 to 40:

 Question Set 31-40  

Check Selenium-SDET-UIAutomation Questions set 41-50:

Q&A Set 41-50

Check Selenium-SDET-UIAutomation Questions set 51-70:

Q&A Set 51-70


21. What are the element validation methods in selenium?

•    isEnabled() — determines if an element is enabled or not, returns a boolean.
•    isSelected() — determines if an element is selected or not, returns a boolean.
•    isDisplayed() — determines if an element is displayed or not, returns a boolean.

22. How to handle proxy in selenium for chrome?

ChromeOptions options = new ChromeOptions();// Create object Proxy class - Approach 1
Proxy proxy = new Proxy();
proxy.setHttpProxy("username:password.myhttpproxy:3337");
options.setCapability("proxy", proxy);
ChromeDriver driver = new ChromeDriver(options);

23. How to set the size of the window in selenium?

driver.manage().window().setSize(new Dimension(1024, 768));

24. How to fetch the size of window in Selenium?

Dimension size = driver.manage().window().getSize();
int width = size.getWidth();
int height = size.getHeight();

25. How to maximize the window in selenium?


driver.manage().window().maximize();

What are the new features in Selenium 4? VERY IMP 

Click Here For Detail Answer


26. How to drag and drop from source to destination?

      WebElement source = driver.findElement(By.xpath("//div[@id='draggable']"));
      WebElement destination = driver.findElement(By.xpath("//div[@id='droppable']"));
      Actions builder = new Actions(driver);
      builder.dragAndDrop(source,destination);
     
27. How to perform keyboard actions in selenium?

By using Robot class as below:
Robot robo = new Robot();
robo.keyPress(KeyEvent.VK_ENTER);

28. How to get all cookies and with name of the cookie?

driver.manage().getCookies();
driver.manage().getCookieNamed("APISID");

29. How to delete all cookies and with name of the cookie?

driver.manage().deleteCookieNamed("APISID");
driver.manage().deleteAllCookies();

30. How to add a cookie?

 Cookie cookie1 = new Cookie("test2", "cookie2");
 driver.manage().addCookie(cookie1);

REVISION:

73. What is the use of Driver in Selenium?


Responsible for controlling the actual browser. Most drivers are created by the browser vendors themselves. Drivers are generally executable modules that run on the system with the browser itself, not on the system executing the test suite.

74.What are the new features in Selenium 4? VERY IMP 

Click Here For Detail Answer

75. Explain some of the strategy to handle CAPTCHA?

There are two primary strategies to get around CAPTCHA checks:

  • Disable CAPTCHAs in your test environment
  • Add a hook to allow tests to bypass the CAPTCHA

76. What is page load strategy in Selenium?

Click Here For Answer


****************************************

TOP 15 BDD - CUCUMBER Interview Q&A


************************************************

✍️AUTHORLinkedIn Profile

************************************************

Learn (API-Microservice)Testing+ Selenium UI Automation-SDET with Self Paced Videos prepared by FAANG employees and LIVE Doubt Session 

SDET TRANING VIDEOS AVAILABLE with Live Doubt Session(course-1 below,API TRaining Videos With Class Notes and Coding Set) and (API+UI, both course-1 & 2 below) Check Training Page for Course Content or reach out @whatsapp +91-9619094122. 
This includes classnotes, 300+ interview questions, 3 projects, Java Coding question set for product companies along with career guidance from FAANG employees for Automation and SDET.

For more details whatsapp : https://lnkd.in/dnBWDM33

*************************************************

SeleniumWebdriver Automation Testing Interview Questions:

https://automationreinvented.blogspot.com/search/label/SeleniumWebdriver

API Testing Interview Question Set:

https://automationreinvented.blogspot.com/2022/03/top-80-api-testing-interview-questions.html

DevOps Interview Q&A:

https://automationreinvented.blogspot.com/2021/11/top-11-devops-interview-questions-and.html 

Kubernetes Interview Question Set

https://automationreinvented.blogspot.com/search/label/Kubernetes

Docker Interview Question Set

https://automationreinvented.blogspot.com/Docker

Linux Interview question Set

https://automationreinvented.blogspot.com/search/label/Linux

Automation Testing/SDET Framework Design

https://automationreinvented.blogspot.com/search/label/FrameworkDesign

Java Related Interview Question Set

https://automationreinvented.blogspot.com/search/label/Java

GIT Interview Question Set:

https://automationreinvented.blogspot.com/2021/09/top-40-git-interview-questions-and.html

Coding Interview Question Set:

https://automationreinvented.blogspot.com/search/label/Coding%20Questions

Mobile Testing Interview Question Set:

https://automationreinvented.blogspot.com/search/label/Mobile%20Testing

Python Interview Question Set for QAE - SDET - SDE:

https://automationreinvented.blogspot.com/search/label/Python


 


Thursday, 18 June 2020

Top 20 API Interview questions and answers with code for automation using Rest Assured SET-02? Automation of GET-PUT-POST-PATCH


 

 
Check below link for question SET-01:
Top API Interview Question 1-10
 


WHAT IS AN API?

Imagine we are sitting at a table in a restaurant with a menu of choices to order from. The kitchen is the part of the “system” that will prepare your order. What is missing is a critical link to communicate your order to the kitchen and deliver your food back to your table. That’s where the waiter or API comes in. The waiter is the messenger – or API – that takes your request or order and tells the kitchen – the system – what to do. Then the waiter delivers the response back to you; in this case, it is the food.

Here is a real-life API example. We may be familiar with the process of searching for flights online. Just like the restaurant, you have a variety of options to choose from, including different cities, departure and return dates, and more. Let us imagine that you’re booking you are flight on an airline website. 

We choose departure city and date, return city and date, cabin class, as well as other variables. In order to book your flight, you interact with the airline’s website to access their database and see if any seats are available on those dates and what the costs might be.

However, what if we are not using the airline’s website? What if we are using an online travel service, such as Kayak or Expedia, which aggregates information from a number of airline databases?

The travel service, in this case, interacts with the airline’s API. The API is the interface that, like your helpful waiter, can be asked by that online travel service to get information from the airline’s database to book seats, baggage options, etc. The API then takes the airline’s response to your request and delivers it right back to the online travel service, which then shows you the most updated, relevant information.

 

11. Automate GET method and validate the status code?

 

@Test(description="Verify status code for GET method-users/2 as 200")
public static void verifyStatusCodeGET() {

Response resp = given()
                                        .when()
        .get("https://reqres.in/api/users/2");

assertEquals(resp.getStatusCode(),200);

}


 

12.  Automate GET method and fetch response body?

 
 @Test(description="Verify status code for GET method-users/2 as 200")
 public static void verifyStatusCodeGET() {
     
     Response resp=given().when().get("https://reqres.in/api/users/2");
     assertEquals(resp.getBody().asString(),200);
     
 }

Define API Authenticationmethod automation with Rest Assured for basic, Pre-emptive, Digest?

 
Click here for Answers with Scripts

 
 13. Automate GET method and verify value from response body?(validate that total number pages =12)
 

@Test(description="Verify status code for GET method-users/2 as 200")
public static void verifyStatusCodeGET() {

Response resp=given().when().get("https://reqres.in/api/users");

System.out.println(resp.path("total").toString());

assertEquals(resp.getStatusCode(),200);
assertEquals(resp.path("total").toString(),"12");
}




     
 14. How to pass query param with GET method in Rest Assured?

API Query parameters can be defined as the optional key-value pairs that appear after the question mark in the URL. Basically, they are extensions of the URL that are utilized to help determine specific content or action based on the data being delivered. Query parameters are appended to the end of the URL, using a '?

@Test
public void validateQueryParamInGiven() {
 
Response resp = given().queryParam("page", "2").
when().get("https://reqres.in/api/users");

assertEquals(resp.getStatusCode(),200);

System.out.println(resp.getBody().asString());
}



How to Setup API automation framework from scratch using Rest Assured, Gradle with code?


   
15. How to pass header for GET method in Rest Assured?

@Test
public void validateGivenHeader() {
 
Response resp = given().header("Content-Type", "application/json").
when().get("https://gorest.co.in/public-api/users");

assertEquals(resp.getStatusCode(),200);
System.out.println(resp.getBody().asString());
}


16. How to automate PATCH method in rest Assured?

The HTTP PATCH method can be used when a resource needs to be updated. This method is especially useful if a resource is large and the changes being made are small.

@Test(description="validate with jsonpath and json object and pass post body as json file")
public void MethodValidationPUT() throws IOException, ParseException {
 
FileInputStream file = new FileInputStream(new File (System.getProperty("user.dir")+"\\TestData\\put.json"));

Response resp =
given().header("Content-Type" , "application/json").body(IOUtils.toString(file,"UTF-8")).
        when().patch("https://reqres.in/api/users/2");

assertEquals(resp.getStatusCode(),200);
assertEquals(resp.path("job"),"tester");
 
}



17. How to automate PUT method in Rest Assured?

A PUT method puts or places a file or resource precisely at a specific URI. In case a file or a resource already exists at that URI, the PUT method replaces that file or resource. If there is no file or resource, PUT creates a new one.
 

@Test(description="validate with jsonpath and json object and pass post body as json file")
public void MethodValidationPUT() throws IOException, ParseException {
 
FileInputStream file = new FileInputStream(new File (System.getProperty("user.dir")+"\\TestData\\put.json"));

Response resp =
given().header("Content-Type" , "application/json").body(IOUtils.toString(file,"UTF-8")).
        when().put("https://reqres.in/api/users/2");

assertEquals(resp.getStatusCode(),200);
assertEquals(resp.path("job"),"tester");
 
}





18. How to automate POST method in Rest Assured?

 POST requests are used to send data to the API server to create or update a resource. The data sent to the server is stored in the request body of the HTTP request

@Test(description="validate with jsonpath and json object and pass post body as json file")
public void MethodValidationPOST() throws IOException, ParseException {
 
FileInputStream file = new FileInputStream(new File (System.getProperty("user.dir")+"\\TestData\\put.json"));

Response resp =
given().header("Content-Type" , "application/json").body(IOUtils.toString(file,"UTF-8")).
        when().post("https://reqres.in/api/users");

assertEquals(resp.getStatusCode(),201);
assertEquals(resp.path("job"),"tester");
 
}



Check below link for SET-1 interview question on API Testing 1 to 10:

To check API related topics and interview tips check below and keep reading:

    

************************************************

✍️AUTHORLinkedIn Profile

************************************************

Learn (API-Microservice-Automation)Testing + Selenium UI Automation + SDET with Self Paced Videos prepared by FAANG employees and LIVE Doubt Session 

SDET TRANING VIDEOS AVAILABLE with Live Doubt Session. Check out the Training Page for Course Content or reach out @whatsapp +91-9619094122. 

This includes class-notes, 400+ interview questions, 3 projects, 20+ Java Coding question set for product companies along with career guidance from FAANG employees for Automation and SDET. We provide full support in clearing doubts & it is paid with very minimal amount.

We will also help you to design the best utility package and framework for your next project. Any doubts then reach out to us at the below whatsapp link.

Learning is directly proportional to earning so keep learning....

For more details whatsapp: https://lnkd.in/dnBWDM33


Check below link for question and answers with the code:

Top API Interview Question 1-10

Top API INterview Questions 11-20 

Top API AUTOMATION Interview Q&A - 21-30

*************************************************

SeleniumWebdriver Automation Testing Interview Questions:

https://automationreinvented.blogspot.com/search/label/SeleniumWebdriver

API Testing Interview Question Set:

https://automationreinvented.blogspot.com/2022/03/top-80-api-testing-interview-questions.html

DevOps Interview Q&A:

https://automationreinvented.blogspot.com/2021/11/top-11-devops-interview-questions-and.html 

Kubernetes Interview Question Set

https://automationreinvented.blogspot.com/search/label/Kubernetes

Docker Interview Question Set

https://automationreinvented.blogspot.com/Docker

Linux Interview question Set

https://automationreinvented.blogspot.com/search/label/Linux

Automation Testing/SDET Framework Design

https://automationreinvented.blogspot.com/search/label/FrameworkDesign

Java Related Interview Question Set

https://automationreinvented.blogspot.com/search/label/Java

GIT Interview Question Set:

https://automationreinvented.blogspot.com/2021/09/top-40-git-interview-questions-and.html

Coding Interview Question Set:

https://automationreinvented.blogspot.com/search/label/Coding%20Questions

Mobile Testing Interview Question Set:

https://automationreinvented.blogspot.com/search/label/Mobile%20Testing

Python Interview Question Set for QAE - SDET - SDE:

https://automationreinvented.blogspot.com/search/label/Python


 

All Time Popular Posts

Most Featured Post

Introduction to Web Testing with Playwright

  Introduction to Web Testing with Playwright 📌  Telegram Group:  https://t.me/+FTf_NPb--GQ2ODhl 📌  YouTube channel:  https://lnkd.in/gGUG...