InterviewSolution
This section includes InterviewSolutions, each offering curated multiple-choice questions to sharpen your knowledge and support exam preparation. Choose a topic below to get started.
| 1. |
What are the Selenium suite components? |
|
Answer» Selenium is a package of several testing tools and is therefore often referred to as a Selenium Suite with each of these tools designed to cater to a different testing requirement. Following are the different components of Selenium Suite:
|
|
| 2. |
In Selenium, how will you wait until a web page has been loaded completely? |
|
Answer» There are two methods of making sure that the web page has been loaded completely in Selenium. They are as follows : 1. Immediately after creating the webdriver instance, set an implicit WAIT: temp = driver.Manage().TIMEOUTS().ImplicitWait;On every page navigation or RELOAD, this will try to wait until the page is fully loaded. 2. Call JavaScript RETURN document.readyState till "complete" is returned after page navigation. As a JavaScript executor, the web driver instance can be USED. Code example: new WebDriverWait(firefoxDriver, pageLoadTimeout).until( webDriver -> ((JavascriptExecutor) webDriver).executeScript("return document.readyState").equals("complete")); |
|
| 3. |
Differentiate between findElement() and findElements() in the context of Selenium with proper examples. |
||||||||
|
Answer» Following table lists the differences between findElement() and findElements() in SELENIUM :
Explanation - In the above code, first of all, we import all the necessary headers and then set up the driver for the chrome browser. We use the findElements() method to find all the values present in the 2nd row of a table in the given URL web page using the XPath of the element.
Explanation - In the above code, first of all, we import all the necessary headers and then set up the driver for the chrome browser. We use the findElement() method to find an input element having an id attribute set as search. |
|||||||||
| 4. |
What is the difference between the commands "type" and "typeAndWait" in the context of Selenium? |
|
Answer» The "type" command is used to enter keyboard key values into a software web application's TEXT box. It can also be used to CHOOSE values from a COMBO box, WHEREAS the "typeAndWait" command is used when you FINISH typing and the software web page begins to reload. This command will wait for the page of the software program to reload before proceeding. You must use a basic "type" command if there is no page reload event when typing. |
|
| 5. |
In Xpath, what is the difference between "/" and "//"? |
|
Answer» Single Slash "/" - A single slash is used to CREATE an XPATH with an absolute PATH, i.e. the XPath will begin with the document node/start node. For example, Absolute XPath: /html/body/div/div/form/inputHere, /html is the root html node. Double Slash "//" - The double slash is used to CONSTRUCT an Xpath with a relative path, which means the XPath can start selection from anywhere on the page. For example, Relative XPath: //input[@id = 'email']Here, we can LOCATE an input having id = ‘email’ present anywhere in the document object model (DOM). |
|
| 6. |
What is meant by XPath in Selenium. Explain XPath Absolute and XPath Relative. |
|
Answer» XPath, also defined as XML-Path (Extensible MARKUP Language Path), is a language used to QUERY XML documents and provide functionalities like locating elements in Selenium by ITERATING through each ELEMENT in a webpage. In XPath, DATA is stored in a key-value pair format similar to an HTML tag. It uses a single slash, i.e. ‘ / ’ for creating an absolute path, and a double slash, i.e. ‘ // ’ for creating a relative path for an element to be located on a webpage. |
|
| 7. |
What is meant by an exception test in Selenium? |
|
Answer» An EXCEPTION test is a test that expects an exception to be thrown INSIDE a test CLASS. It expects a @Test annotation followed by the expected exception name in the brackets. Eg: @Test(EXPECTEDEXCEPTION = NoSuchElementException.class) is an exception test for missing elements in Selenium. |
|
| 8. |
State the major difference between “assert” and “verify” commands in Selenium. |
|
Answer» Both “ASSERT” and “VERIFY” commands check whether the given CONDITION is true or false and the only difference between them is that: |
|
| 9. |
What is meant by a locator and name a few different types of locators present in Selenium. |
|
Answer» A locator is an address for UNIQUELY identifying web elements within a web page. There are DIFFERENT types of locators present in Selenium to IDENTIFY web elements uniquely and accurately like:
|
|
| 10. |
What is meant by Selenese? Explain different types of Selenium commands. |
|
Answer» The LANGUAGE used for writing test scripts in Selenium IDE is called Selenese. It is a set of commands used to test your web application or system. Selenium commands could be DIVIDED into 3 major categories:
|
|
| 11. |
Can selenium be used to launch web browsers? |
|
Answer» Yes, Selenium provides good support to launch web BROWSERS like Google Chrome, Mozilla Firefox, Internet Explorer, etc. The FOLLOWING COMMANDS can be used to launch web browsers using Selenium:
|
|
| 12. |
Why should Selenium be selected as a testing tool for web applications or systems? |
|
Answer» SELENIUM provides the following advantages, which make it an excellent automated testing framework:
|
|
| 13. |
What are the disadvantages of using Selenium as a testing tool? |
|
Answer» The following are the disadvantages of USING Selenium as a testing TOOL:
|
|
| 14. |
What are the advantages of using Selenium as an automation tool? |
|
Answer» Following are the ADVANTAGES of using Selenium for automated testing :
|
|
| 15. |
What is automation testing, and what are its advantages? |
|
Answer» Automation testing or Test Automation is a process of automating the manual testing process of an application or a SYSTEM by using testing tools that ALLOW you to create scripts that can be executed repeatedly, generating detailed test reports of the application or system under test. Advantages of Automated Testing are:
|
|
| 16. |
What is meant by Selenium Suite and what are its different components? |
|
Answer» Selenium is a package of several testing tools and is therefore often referred to as a Selenium Suite with each of these tools designed to CATER to a different testing requirement. Following are the different components of Selenium Suite:
|
|