Skip to main content

Important Selenium Interview Questions - #2


Complete Selenium Topics to be a Professional Selenium Tester 





Previous Post: Important Selenium Questions Set #1

1) Explain what is Datadriven framework and Keyword driven?

Datadriven framework:  
In this framework, the test data is separated and kept outside the Test Scripts, while test case logic resides in Test Scripts.  Test data is read from the external files ( Excel Files) and are loaded into the variables inside the Test Script.  Variables are used for both for input values and for verification values.

Keyworddriven framework: 
The keyword driven frameworks requires the development of data tables and keywords, independent of the test automation.  In a keyword driven test, the functionality of the application under test is documented in a table as well as step by step instructions for each test.

2) Explain how you can login into any site if it’s showing any authentication popup for password and username?

Pass the username and password with url

  • Syntax-http://username:password@url
  • ex- http://creyate:tom@www.gmail.com
3) Explain how to assert text of webpage using selenium 2.0 ?

WebElement el = driver.findElement(By.id(“ElementID”))
//get test from element and stored in text variable
String text = el.getText();
//assert text from expected
Assert.assertEquals(“Element Text”, text);


5) What is Object Repository ?

An object repository is an essential entity in any UI automations which allows a tester to store all object that will be used in the scripts in one or more centralized locations rather than scattered all over the test scripts.

Useful Resources: 


6) Explain how Selenium Grid works?

Selenium Grid sent the tests to the hub. These tests are redirected to Selenium Webdriver, which launch the browser and run the test.  With entire test suite, it allows for running tests in parallel.

7) Can we use Selenium grid for performance testing?

Yes. But not as effectively as a dedicated performance testing tool like Loadrunner.

8)  List the advantages of Webdriver over Selenium Server?


  • If you are using Selenium-WebDriver, you don’t need the Selenium Server as it is using totally different technology
  • Selenium Server provides Selenium RC functionality which is used for Selenium 1.0 backwards compatibility
  • Selenium Web driver makes direct calls to browser using each browsers native support for automation, while Selenium RC requires selenium server to inject Javascript into the browser

9)  Mention what are the capabilities of Selenium WebDriver or Selenium 2.0 ?


  • WebDriver should be used when requiring improvement support for
  • Handling multiple frames, pop ups , multiple browser windows and alerts
  • Page navigation and drag & drop
  • Ajax based UI elements
  • Multi browser testing including improved functionality for browser not well supported by Selenium 1.0
10)  While injecting capabilities in webdriver to perform tests on a browser which is not supported by a webdriver what is the limitation that one can come across?

Major limitation of injecting capabilities is that “findElement” command may not work as expected.

11)  Explain how you can find broken images in a page using Selenium Web driver ?

To find the broken images in a page using Selenium web driver is
Get Xpath and get all the links in the page using tag name
In the page click on each and every link
Look for 404/500 in the target page title

12)  Explain how you can handle colors in web driver?

To handle colors in web driver you can use
Use getCssValue(arg0) function to get the colors by sending ‘color’ string as an argument

13)  Using web driver how you can store a value which is text box?

You can use following command to store a value which is text box using web driver
driver.findElement(By.id(“your Textbox”)).sendKeys(“your keyword”);

14)  Explain how you can switch between frames?

To switch between frames webdrivers [ driver.switchTo().frame() ] method takes one of the three possible arguments

A number:  It selects the number by its (zero-based) index
A number or ID: Select a frame by its name or ID
Previously found WebElement: Using its previously located WebElement select a frame

15)  Mention 5 different exceptions you had in Selenium web driver?

The 5 different exceptions you had in Selenium web drivers are

  • WebDriverException
  • NoAlertPresentException
  • NoSuchWindowException
  • NoSuchElementException
  • TimeoutException
16)  Explain using Webdriver how you can perform double click ?

You can perform double click by using
Syntax- Actions act = new Actions (driver);
act.doubleClick(webelement);

17) How will you use  Selenium to upload a file ?

You can use “type”command to type in a file input box of upload file. Then, you have to use “Robot” class in JAVA to make file upload work.

18) Which web driver implementation is fastest?

HTMLUnit Driver implementation is fastest, HTMLUnitDriver does not execute tests on browser but plain http request, which is far quick than launching a browser and executing tests

19) Explain how you can handle frames using Selenium 2.0 ?

  • To bring control on HTML frame you can use “SwitchTo” frame method-
  • driver.switchTo().frame(“frameName”);
  • To specify a frame you can use index number
  • driver.switchTo().frame(“parentFrame.4.frameName”);
  • This would bring control on frame named- “frameName” of the 4th sub frame names “parentFrame”

20) What is the difference between getWindowhandles() and getwindowhandle() ?


  • getwindowhandles(): It is used to get the address of all the open browser and its return type is iterator<String>
  • getwindowhandle(): It is used to get the address of the current browser where the control is and return type is string

21) Explain how you can switch back from a frame?

To switch back from a frame use method defaultContent()
Syntax-driver.switchTo().defaultContent();

22) List out different types of locators?

Different types of locators are

  • By.id()
  • By.name()
  • By.tagName()
  • By.className()
  • By.linkText()
  • By.partialLinkText()
  • By.xpath
  • By.cssSelector()
23) What is the command that is used in order to display the values of a variable into the output console or log?

In order to display a constant string, command can be used is echo <constant string>
If order to display the value of a variable you can use command like echo ${variable name>>
Above is using PHP. If you are using Java, replace echo with System.out.println

24)   Explain how you can use recovery scenario with Selenium?

Recovery scenarios depends upon the programming language you use.  If you are using Java then you can use exception handling to overcome same.  By using “Try Catch Block” within your Selenium WebDriver Java tests

25) Explain how to iterate through options in test script?

To iterate through options in test script you can loop features of the programming language, for example to type different test data in a text box you can use “for” loop in Java
// test data collection in an array
String[ ] testData = { “test1” , “test2” , “test3” } ;
// iterate through each test data
For  (string s: test data) { selenium.type ( “elementLocator”, testData) ; }

26) How can you prepare customized html report using TestNG in hybrid framework ?

There are three ways

  • Junit: With the help of ANT
  • TestNG: Using inbuilt default.html to get the HTML report. Also XST reports from ANT, Selenium, TestNG combinations
  • Using our own customized reports using XSL jar for converting XML content to HTML
27) From your test script how you can create html test report?

To create html test report there are three ways

  • TestNG:  Using inbuilt default.html to get the HTML report. Also XLST reports from ANT, Selenium, TestNG combination
  • JUnit: With the help of ANT
  • Using our own customized reports using XSL jar for converting XML content to HTML
28)  Explain how you can insert a break point in Selenium IDE ?

In Selenium IDE to insert a break point
Select “Toggle break point” by right click on the command in Selenium IDE
Press “B” on the keyboard and select the command in Selenium IDE
Multiple break points can be set in Selenium IDE

29)  Explain in Selenium IDE how can you debug the tests?

Insert a break point from the location from where you want to execute test step by step

  • Run the test case
  • At the given break point execution will be paused
  • To continue with the next statement click on the blue button
  • Click on the “Run” button to continue executing all the commands at a time
30)  What is Selenese and what are the types of Selenese ?

Selenese is a selenium set of command which are used for running the test
There are three types of Selenese

  • Actions: It is used for performing the operations and interactions with the target elements
  • Assertions: It is used as a check points
  • Accessors: It is used for storing the values in a variable
31)  Explain what are the limitations of Selenium IDE?

The limitations of Selenium IDE

  • Exceptional handling is not present
  • Selenium IDE uses only HTML languages
  • External databases reading is not possible with IDE
  • Reading from the external files like .txt, .xls is not possible
  • Conditional or branching statements execution like if,else,  select statements is not possible
32)  What are the two modes of views in Selenium IDE ?

Either Selenium IDE can be opened as a pop up window or in side bar

33)  In selenium IDE what are the element locators that can be used to locate elements on web page?

In selenium there are mainly 4 locators that are used

  • X-path locators
  • Css locators
  • Html id
  • Html name
34)  In Selenium IDE how you can generate random numbers and dates for test data ?

In Selenium IDE you can generate random numbers by using Java Script
type
css=input#s
javascript{Math.random()}
And for
type
css=input#s
javascript{new Date()}

35)  How you can convert any Selenium IDE tests from Selenese to another language?

You can use the format option of Selenium IDE to convert tests into another programming language

Comments

Popular posts from this blog

Important Update from the National Software Testing Conference 2018..!

Hello friends, Happy to see you all after a gap! This time I came with an important & interesting information regarding Software Testing…! Here is the Kicker; Here I have listed down the latest update in software testing which every software testers must know about. Automation Testing Market – Forecast 2025 National Software Testing Conference 2018 Automation Testing Market Overview 2025 Also Read: Complete Guide to Choose Software Testing as Your Career All the information below is collected from the report of the recent National Level Software Testing Conference 2018 held in London. Automation Testing Market Report provides thorough backdrop investigation of Automation Testing business, with an evaluation of the previous years. The Automation Testing Market Reports provides data on Automation Testing patterns and improvements, and target business sectors and materials, limits and advancements.  The report broadly provides the m...

Choosing Software Testing as a Career -- Complete Guide

Complete Guide: What is Software Testing? Why Software Testing? Types of Software Testing Careers Software Tester Skills Manual Testing Manual Testing Skill Set Manual Testing Payscale in India Automation Testing Automation Testing Tools List Automation Tester Skill Set Automation Tester Career Path Automation Tester Job Opportunities Read Here:  Why Choose Software Testing as your Career?  You may also Like: Simple Tips to be the Best Automation Tester Top 3 Common Mistakes Testers Make - Solutions How to be the Big Boss of Selenium Automation

Top 10 Websites every Software Tester must Bookmark in 2018

For all the software testers, test automation experts and QA enthusiasts out there, we have compiled a list of 10 websites that you should bookmark in 2017. No matter, whether you want to solve a bug, get latest updates, find answers to the interview questions or anything else, this list of 10 websites will cover everything about QA and software testing. 1.  http://www.softwaretestinghelp.com Software Testing Help is a popular website focusing on Software Testing and Quality Assurance topics. With 1 million+ monthly views, the website caters to a wide range of testing professionals who are looking updates related to software testing tutorials, methodologies, manual testing, automation testing,  testing tools , interview questions, web testing, testing templates, quality assurance, testing certifications, books, career guidance, job openings, latest testing trends, news, and much more. 2.  http://www.softwaretestpro.com Software Test Professionals (STP)...