Thursday 22 March 2018

General Selenium Automation Interview Questions

Selenium Automation is very popular trends in software testing industry. I have seen many articles in internet for interview questions. There is no any sure interview questions. It is all depends on interviewer.

I have prepared some interview questions for Selenium Automation only. If I am interviewer then i will ask that types of questions for sure.

I have added answers of question if I already added in my blog. If not then I will add later once I added in my blog.


1. Explain basic idea of selenium.
Ans : Selenium Basics


2. Explain me selenium automation project you worked. 



3. How to create hybrid framework using Data Driven and Keyword Driven framework?



4. How to use POM in selenium?
Ans : Page Object Model (POM) Framework in Selenium



5. Write java program for below definition.

If I enter number 5 then output should be as below.

5*5 - 4*4 + 3*3 - 2*2 + 1*1

If I enter 4 then

4*4 - 3*3 + 2*2 - 1*1

Ans : Java Program For Number Series

6. Write java program for below definition.

If I enter String 'aabbccddefgh' the output should be as below.

Output = 2a2b2c2d1e1f1g1h

Ans : Java Program For String Example

7. Explain difference between Implicit Wait and Explicit Wait.
Ans : Implicit Wait Vs. Explicit Wait Vs. Fluent Wait

8. How many element locators is there in selenium.
Ans : Different Locators in Selenium

9. Write Xpath for select element highlighted span tag in below HTML code.

<div>
 <span>Test</span>
  <span>Test1<span>
</div>
<span>ABC</span>
<div>
 <span>Test</span>
  <span>Test2<span>
</div>
<span>ABC</span>
<div>
 <span>Test</span>
  <span>Test3<span>
</div>
<span>ABC</span>
<div>
 <span>Test</span>
  <span>Test4<span>
</div>
<span>ABC</span>

Ans : 
Xpath = "//div[span/span[text() = 'Test3']]/following::span[text() = 'ABC']" 

10. How to maximize chrome browser directly when you initiate Webdriver instance. It should be open in maximize mode.
Ans : 
You can open chrome browser directly using capabilities when initiate webdriver instance. Please go to below link for how to use capabilities.
How to Set Capabilities and Proxy Setting for Webdriver

11. How to initiate Firefox browser for Firefox version grater than 48.
Ans : 
You have to use 'GeckoDriver' for Firefox version grater than 48. It means you have to set System property same as chrome browser with GeckoDriver.

System.setProperty("webdriver.gecko.driver", "Path of Gecko Driver");
WebDriver driver = new FirefoxDriver();


12. What is Maven in selenium?

13. Did you ever integrate Jenkins with selenium? If yes then explain how to integrate.

14. How many ways you can generate test result report?
Ans : There is many ways to generate test result report in selenium. Below is different ways to generate result report.

  • TestNG report (Auto generate when you use TestNG)
  • JUnit Report
  • Ant report
  • Excel report (You have to write code for this)
  • CSV report (You have to write code for this)
  • HTML Report using Extent report) - Go to this link Extent Report for Extent Report.

15. How to Handle browser based Popup in selenium?
Ans : How to Handle PopUp in Selenium

16. How to Handle Windows in selenium?
Ans : How to Handle Windows in Selenium

17. How to Handle Windows based Popup in selenium?
Ans : Handle Windows Based Popup

18. How to do SQL database connection in selenium?

Ans : How to Do Database Connection in Selenium

19. How to handle below scenario without using Implicit and Explicit wait. You can use Thread.sleep() function.

Scenario : I have one element on page and every time it will take different time to load on page. some time 1 sec, some time 5 sec and some time 8 sec. I want to click on that element. Maximum time you have to wait for that element is 10 sec. If element do not appear after 10 sec than throw exception otherwise click on that element.

Ans : How Handle Wait Without Using Explicit and Implicit Wait in Selenium

20. How to Highlight Element when you perform click on that element.
Ans : How to Highlight Element in Selenium


Please add comment if you have any questions.


No comments:

Post a Comment

Popular