• +91 9723535972
  • info@interviewmaterial.com

Selenium Interview Questions and Answers

Selenium Interview Questions and Answers

Question - 21 : - What are the features of TestNG and list some of the functionality in TestNG which makes it more effective?

Answer - 21 : -

TestNG is a testing framework based on JUnit and NUnit to simplify a broad range of testing needs, from Unit Testing to Integration Testing. And the functionality which makes it efficient testing framework are

  • Support for annotations
  • Support for data-driven testing
  • Flexible test configuration
  • Ability to re-execute failed test cases

Question - 22 : - Mention what is the difference between Implicit wait and Explicit wait?

Answer - 22 : -

Implicit Wait: Sets a timeout for all successive Web Element searches. For the specified amount of time it will try looking for element again and again before throwing a NoSuchElementException.  It waits for elements to show up.

Explicit Wait :  It is a one-timer, used for a particular search.

Question - 23 : - Which attribute you should consider throughout the script in frame for “if no frame Id as well as no frame name”?

Answer - 23 : -

You can use…..driver.findElements(By.xpath(“//iframe”))….

This will return list of frames.

You will need to  switch to each and every frame and search for locator which we want.

Then break the loop

Question - 24 : - Explain what is the difference between find elements () and find element () ?

Answer - 24 : -

find element ():

It finds the first element within the current page using the given “locating mechanism”.  It returns a single WebElement

findElements () : Using the given “locating mechanism” find all the elements within the current page.  It returns a list of web elements.

Question - 25 : - Explain what are the JUnits annotation linked with Selenium?

Answer - 25 : -

The JUnits annotation linked with Selenium are

  • @Before public void method() – It will perform the method () before each test, this method can prepare the test
  • @Test public void method() – Annotations @Test identifies that this method is a test method environment
  • @After public void method()- To execute a method before this annotation is used, test method must start with test@Before

Question - 26 : - Explain what is Datadriven framework and Keyword driven?

Answer - 26 : -

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.

Question - 27 : - Explain how you can login into any site if it’s showing any authentication popup for password and username?

Answer - 27 : -

Pass the username and password with url

  • Syntax-http://username:password@url
  • ex- http://creyate:tom@www.gmail.com

Question - 28 : - Explain how to assert text of webpage using selenium 2.0 ?

Answer - 28 : -

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);

Question - 29 : - What is Object Repository ?

Answer - 29 : -

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.

Question - 30 : - Explain how Selenium Grid works?

Answer - 30 : -

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.


NCERT Solutions

 

Share your email for latest updates

Name:
Email:

Our partners