Top 10 Pro Level Selenium Automation Interview Questions 2

Selenium Automation Interview Questions for 4+ years of experience.

Q1 - How to navigate to 3rd window to 7th window in selenium?

Answer - Code example:

Case 1:
 // Create a Set and store all window handle ids in it
 Set AllWindowHandles = driver.getWindowHandles();
 String window1 = (String) AllWindowHandles.toArray()[0];
 String window2 = (String) AllWindowHandles.toArray()[1];

 // Switch to window with id 2
 driver.switchTo().window(window2);

Case 2 :
 /* Moving Between all Windows
  */
 for (String handle : driver.getWindowHandles()) {
  driver.switchTo().window(handle);
 }


Q2 - How to read the text of a cell in a dynamic web table?
Answer - We can read text from a dynamic web table by preparing dynamic xpath of table at runtime.
Read details - Handle Dynamic Table


Q3 - How to check the text is selected or not on page?


Q4 - How to handle ajax call in Selenium?
Answer - When we do Google search and a list of options matching to our keyword displayed on it's own without refreshing the page, is an example of ajax search. We can handle ajax elements using Explicit Wait in Selenium.


Q5 - How to handle synchronization in selenium?


Q6 - What types of waits we have and which is best in Selenium?
Answer - There are three types of wait in Selenium:

  1. Implicit Wait
  2. Explicit Wait
  3. Fluent Wait


Q7 - Syntax for both implicit and explicit wait?
Answer - Code example:
// Implicit wait - Set wait of 10 seconds
 driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);

 // Explicit Wait
 WebDriverWait wait = new WebDriverWait(driver, 10); 
 wait.until(ExpectedConditions.alertIsPresent());


Q8 - Why we aren't recommended  to use Thread.sleep() in selenium?


Q9 - How to implement oops concepts  in selenium?


Q10 - What are the different types of automation frameworks?
Answer - 
  • Linear Framework
  • Keyword Driven Framework
  • Modular Framework
  • Data Driven Framework
  • Page Object Model
  • Hybrid Framework



You can answer the questions in comments to help others. We will showcase the best answers on our website with user's name.

For list of  Selenium tutorials click here: Selenium Webdriver Tutorials Series

Guest Author
Barri Siva
Quality Engineer II
sivaeswar111@gmail.com

Subscribe FB Group Techlistic.com
Join Telegram channel at https://t.me/techlistic
Feel free to ask queries or share your thoughts in comments or email me.

Comments

  1. do you have answer, ? pls share iftekerahmed@gmail.com

    ReplyDelete
    Replies
    1. Hi, Some of the answers are updated here.

      Thanks!

      Delete
  2. Do you have Answers of all these question. Please share
    swapnil.bodade88@gmail.com

    ReplyDelete
    Replies
    1. Hi Swapnil,

      Some of the answers are updated here.

      Thanks!

      Delete
  3. Kindly answers for these questions. Could you send them to my mail? It's hareesharunoday@gmail.com

    ReplyDelete
    Replies
    1. Hi Hareesh,

      Some of the answers are updated here.

      Thanks!

      Delete

Post a Comment

Popular Posts

Top 10 Demo Websites to Practice Selenium Webdriver Online

Top 25 Must to know Selenium Webdriver Commands List

Assignment 5: Automate "Buy Product" Functionality for E-commerce Website using Selenium

Selenium IDE - Sample Script With Most Commonly Used Commands

Assignment 6: Automate "User Registration" Process for E-commerce Website using Selenium