Selenium Interview Questions and Answers (2025)
Selenium WebDriver is one of the best automation testing tools in recent years. Therefore, in the IT industry, the demand for Selenium WebDriver based jobs is growing rapidly day by day in the market.
Here, we have listed the best collection of frequently asked Selenium WebDriver Interview Questions with the best possible answers to crack the interviews.
We have also covered the most basic Selenium WebDriver interview questions and answers that will be helpful for freshers. You can also prepare answers of Java interview questions for Selenium automation testing from basic to advanced.
Basic Selenium Interview Questions
1. What is Automation Testing?
Ans: Automation testing is a process of automating manual processes to test applications or systems. It uses separate testing tools in which test script is created and executed repeatedly.
2. What are the benefits of Automation testing?
Ans: There are the following benefits of automation testing. They are as follows:
- Automation testing supports the execution of repeated test cases.
- It supports parallel execution.
- It helps to improve accuracy and reduces human-generated error.
- It saves time and money.
3. What is Selenium? What are the different components of selenium?
Ans: Selenium is a free and open-source browser automation testing tool which is used to test the functionality of web based application. It supports different operating systems and different languages. It is originally developed by Jason Huggins in 2004.
There are four components available in selenium suite to automate the web application.
- Selenium IDE (Integrated Development Environment)
- Selenium Remote Control (RC)
- WebDriver
- Selenium Grid
4. Why should Selenium be selected as a testing tool?
Ans: There are the following reasons to select selenium as a testing tool.
- Selenium is free and open-source.
- It supports different operating systems like Windows, Mac OS, and Linux.
- It supports different programming languages such as Java, C#, Python, Perl, Ruby, and PHP. We can code in Java, Python, C#, etc.
- It supports almost all popular browsers like Chrome, Firefox, Opera, IE, etc.
- Selenium supports cross-browser compatibility (Chrome, Firefox, or IE).
5. What is Selenium 1.0?
Ans: Selenium 1.0 or Selenium Remote Control (popularly known as Selenium RC) is a freeware automated testing tool that allows testers to test web-based applications.
It was developed to extend framework in multiple programming languages. It is composed of Selenium IDE, Selenium Core, Selenium RC, and Selenium Server.
6. What is Selenium 2.0?
Ans: Selenium 2.0 (also known as WebDriver) is the latest, free, and open-source library to automate web applications. It is a pure object-oriented tool.
This powerful tool was developed in 2008 when Selenium RC was merged with another testing framework called WebDriver.
7. What are the types of testing supported by selenium?
Ans: Selenium supports different types of testing. They are as follows:
- Functional Testing
- Regression Testing
- Retesting
- Acceptance Testing
- End-to-End Testing
- Smoke Testing
- Sanity Testing
- Responsive Testing
- Cross Browser Testing
- UI Testing
- Integration Testing
8. What are four parameters that have to pass in Selenium?
Ans: Four parameters that have to pass in selenium, are Host, Port Number, Browser, and URL.
9. What are the limitations of Selenium?
Ans: There are the following limitations of Selenium. They are:
- Selenium supports the testing of only web applications.
- Captcha and barcode cannot be tested by using selenium.
- Mobile applications cannot be tested by using Selenium.
- Test reports can only be generated using third-party tools like JUnit or TestNG.
10. What is the difference between Selenium and QTP?
Ans: There are several differences between Selenium and QTP. They are:
a) Open/Licensed: Selenium is free and open-source whereas, QTP is a licensed tool.
b) Operating system: Selenium supports various operating systems like Windows, Mac OS, and Linux whereas, QTP supports only Windows operating systems.
c) Browser: Selenium supports almost all types of browsers like Firefox, Chrome, IE, Opera, Safari, etc whereas, QTP supports only IE.
d) Testing: Selenium supports only testing web-based applications while QTP can be used for testing of both web-based and window-based applications.
e) Programming language: Selenium supports multiple programming languages like Java, C#, Python, Ruby, etc while QTP supports only VB script.
f) Object repository: Object repository needs to be created in selenium whereas QTP automatically creates and maintains object repository.
Selenium WebDriver Interview Questions
11. What is Selenium WebDriver?
Ans: Selenium WebDriver is a web automation framework that executes tests against different browsers like Firefox, Chrome, IE, etc. It allows the users to create test scripts in different programming languages. It was designed by Simon Stewart while he was working at ThoughtWorks.
12. Is WebDriver interface or class?
Ans: WebDriver is a public interface, not a class. We just define a reference variable (driver) of type WebDriver interface. Now, we can assign an instance of a class (such as FirefoxDriver class) that implements WebDriver interface to use methods provided by WebDriver.
For example:
WebDriver driver = new FirefoxDriver();
13. How WebDriver is an interface?
Ans: Creating WebDriver as an interface is the best way to expose a set of APIs that will provide a lot of capabilities to the Selenium tool. Selenium developers knew that logic will not be the same for all browsers.
Interface is a mechanism that has only abstract methods i.e methods that have no body or logic. Therefore, WebDriver interface allows users to write their logic in abstract methods provided by WebDriver.
RemoteWebDriver class implements WebDriver interface which is extended by Browser drivers.
14. How Selenium WebDriver works?
Ans: Selenium WebDriver works in three steps. They are as follows:
a. The first step is to send commands (programming code and selenese commands) to the Selenium WebDriver server via commands line associated with selenium server.
b. In the second step, Selenium WebDriver Server sends Javascripts commands to Web Browser Driver. The interaction from Selenium WebDriver server to driver elements of web browser is done with the help of Javascript Libraries.
c. In the third step, Selenium Web browser driver elements interact with web application using commands from selenium to perform actions of users like entering text, clicking on button, etc.
15. What is the name of super interface of WebDriver?
Ans: SearchContext is the super interface of Webdriver. It is the top most interface in selenium, which is extended by another interface called WebDriver. It has only two methods named findElement() and findElements().
16. What is RemoteWebDriver?
Ans: RemoteWebDriver is a class that extends object class and implements WebDriver, and JavascriptExecutor interfaces.
17. What are Programming Languages supported by Selenium WebDiver?
Ans: Selenium WebDriver supports multiple programming languages like Java, C#, Python, Ruby, Perl, and PHP. We can write code in any of these languages.
18. What are Operating Systems supported by Selenium WebDriver?
Ans: Selenium WebDriver supports multiple operating systems such as Windows, Linux, Mac OS, IOS, and Android.
19. How many types of WebDriver APIs are available in Selenium?
Ans: There are several types of WebDriver APIs available in Selenium WebDriver. They are FirefoxDriver, GeckoDriver, InternetExplorerDriver, ChromeDriver, HTMLUnitDriver, OperaDriver, SafariDriver, AndroidDriver, iPhoneDriver, and EventFiringWebDriver.
20. What are testing frameworks supported by Selenium WebDriver with Java?
Ans: Selenium WebDriver with Java supports two testing frameworks such as JUnit and TestNG.
21. Is FirefoxDriver a class or an interface?
Ans: FirefoxDriver is a Java class that implements a WebDriver interface.
22. How do we launch a web browser by using Selenium WebDriver?
Ans: WebDriver is an Interface. We create an object of a required driver class such as FirefoxDriver, ChromeDriver, InternetExplorerDriver, etc by assigning WebDriver reference. For example:
a. To launch Firefox Driver:
WebDriver driver = new FirefoxDriver()
b. To launch Chrome Driver:
WebDriver driver = new ChromeDriver();
c. To launch Internet Explorer Driver;
WebDriver driver = new InternetExplorerDriver();
23. Why do we assign Firefox instance to WebDriver reference such as WebDriver driver = new FirefoxDriver();?
Ans: We assign the FirefoxDriver object to WebDriver reference because it allows assigning driver object with different browser drivers.
If we want to switch other browsers in the same program for multiple browser testing, we will have to create multiple objects for different browsers that are the worst kind of programming. Therefore, we create a WebDriver reference and assign an object of class.
24. What is difference between WebDriver and FirefoxDriver?
Ans: WebDriver is an interface whereas, FirefoxDriver is a class that implements WebDriver interface.
25. How to write test cases using Selenium WebDriver?
Ans: We can write test cases using element Locators, Selenium WebDriver methods, and Java programming features. Element locators are used to locating WebElements on the web page.
Selenium WebDriver methods are used to perform operations on WebElement. Java is used to enhance programming features.
There are five basic steps to write test cases that can be applied to any test case and any application under test (AUT). They are as follows:
- Create a WebDriver instance.
- Navigate to a Web page.
- Locate an HTML element on the Web page using locators.
- Perform an action on an HTML element.
- Run tests.
26. What is Firebug?
Ans: Firebug is a Firefox addon which is used to inspect HTML web elements on the web page during a test.
27. What are the limitations/drawbacks of WebDriver?
Ans: There are many limitations or drawbacks of WebDriver. They are:
a. Selenium WebDriver can be used only to test web-based applications. We can not test Windows-based applications or desktop applications and any other software.
b. It is not possible to perform the testing on the image.
c. WebDriver does not generate automatically test result files.
d. WebDriver cannot support new browsers.
28. Which WebDriver implementation is the fastest?
Ans: HTMLUnit Driver is the fastest WebDriver implementation.
29. What is HTMLUnitDriver in Selenium?
Ans: HTMLUnitDriver is the fastest and most lightweight web browser for implementation of WebDriver. It has no GUI (Graphical User Interface).
Since, in HTML unit driver, test runs in the background without any visual interruption, we cannot see test execution on the screen. Hence, test execution becomes faster than other drivers.
30. What is the difference between HTMLUnitDriver and FirefoxDriver?
Ans: There are following differences between HTMLUnitDriver and FirefoxDriver.
- HTMLUnitDriver is a lightweight web browser whereas, FirefoxDriver is a heavyweight browser.
- HTMLUnitDriver has no plugin whereas, FirefoxDriver has plugin.
- HTMLUnitDriver does not GUI whereas, FirefoxDriver has.
- In the HTMLUnitDriver, test execution is fast whereas, slow execution happens in the FirefoxDriver.
31. What are the differences between Selenium IDE, Selenium RC, and WebDriver?
Ans:
Selenium IDE:
- Selenium IDE is a Firefox plugin that supports only Firefox.
- It is a Javascript-based framework.
- It is not an object-oriented tool.
- Selenium IDE supports record and playback features.
- Selenium IDE does not need any server to be started before executing the test script.
- It does not support dynamic finders and listeners.
- Selenium IDE does not support the testing of Andriod/iPhone applications.
Selenium RC:
- Selenium RC supports various types of browsers like Mozilla Firefox, Google Chrome, Internet Explorer and Opera.
- It is a Javascript-based framework.
- Selenium RC is a semi-object-oriented tool.
- It does not support record and playback feature.
- Selenium RC requires server to be started before executing the test scripts.
- Selenium RC also not support dynamic finder and listener.
- Selenium RC does not support the testing of iPhone/Android applications.
WebDriver:
- WebDriver supports almost all popular browsers like Mozilla Firefox, Google Chrome, Internet Explorer, Opera, etc.
- It is a pure object-oriented tool.
- It does not support record and playback features.
- It does not need any server to be started before execution of test scripts.
- WebDriver supports dynamic finders and the implementation of listeners.
- WebDriver is faster than Selenium RC.
- WebDriver supports testing of iPhone/Android applications by the available tool.
WebDriver Commands Interview Questions
In this section, we have covered some important interview questions based on Selenium WebDriver commands.
32. How to open a Website using Selenium WebDriver?
Ans: The get() method is used to open the specified URL in the current browser window. The URL must be in the form of http://www.xyz.com.
If the HTTP is not included then it will throw a message “Cannot navigate to invalid URL”. The syntax is as follows:
WebDriver driver = new FirefoxDriver(); driver.get("https://www.xyz.com")
33. How to click on a button on the web page?
Ans: click() method is used to click on a button on the web page. The syntax is given below:
driver.findElement(By.id("submit")).click();
34. How to get Page Title of web page using Selenium WebDriver?
Ans: getTitle() method of WebDriver is used to get page title of any web page. The syntax is as follows:
String pageTitle = driver.getTitle(); System.our.println(pageTitle);
35. How to get a text from a specified element or object on web page?
Ans: The getText() method is used to retrieve inner text of specified element on web page. The syntax is given below:
driver.findElement(By.locatorName("Specified Element")).getText();
36. How to compare page title on web page with expected title in Selenium WebDriver using Java?
Ans: We will verify or compare the title of the web page in Selenium WebDriver using the String concept of Java. Let’s see the main source code.
String actualTitle = driver.getTitle(); String expectedTitle="Facebook – log in or sign up"; // Use equalsIgnoreCase() method of String class to verify actual title with expected title. if(actualTitle.equalsIgnoreCase(expectedTitle)) { System.out.println("Verification is success" ); System.out.println("Home page title is:" + actualTitle ); } else { System.out.println("Verification is failed, Matched not found"); }
37. What is the difference between driver.get() and driver.navigate() method?
Ans: The difference between get() and navigate() methods of Selenium WebDriver are as follows:
a) The driver.get() method is used to open a specified URL of web application and wait until the whole page gets loaded whereas,
driver.navigate().to() method is used to navigate a specified URL of web application and it does not wait till the whole page gets loaded.
b) driver.get() method does not maintain the browser history and cookies whereas, driver.navigate() method maintains the browser history and cookies.
c) We can not go forward or backward between the pages using the driver.get() whereas, we can easily navigate between the pages forward, back, and refresh using driver.navigate().
38. What is the difference between close and quit methods of Selenium WebDriver?
Ans: The close() method is used to close only the browser window that WebDriver is currently controlling whereas, the quit() method is used to close all windows opened by WebDriver.
39. What are Navigation commands in Selenium WebDriver?
Ans: Navigation commands are those commands in Selenium that are used to perform different operations such as backward, forward, refresh, wait, etc in the browser’s history.
The navigation commands available in Selenium WebDriver are back, forward, refresh, navigate, and to.
40. How to move forward and backward on the web page?
Ans: forward() method is used to move forward by one page on the browser’s history.
back() method is used to move back by one page on the browser’s history.
41. What is WebElement? Is WebElement class or interface?
Ans: The elements that are present on a web page are called WebElement. It represents an HTML element. Text boxes, links, buttons, dropdown buttons, radio buttons, labels, and forms are called WebElement. It is an interface.
42. How many methods have been provided by Selenium WebDriver to find WebElement?
Ans: There are two methods available in Selenium WebDriver to find WebElement.
a. findElement(): This method is used to locate one web element in the current web page using the locator provided in the parameter list.
b. findElements(): This method is used to find a list of web elements (i.e. multiple elements) on the current web page using the locator provided in the parameter list.
43. What is the return type of findElement and findElements?
Ans: The return type of findElement() method is a WebElement object whereas, findElements() method returns a list of WebElements.
44. Which input parameter does findElement() method take?
Ans: The findElement() method takes an input parameter of type By. By is an instance of By class.
45. Which exception is thrown by WebDriver when it is unable to find an element on web page?
Ans: Runtime exception named NoSuchElementException.
46. What is the difference between findElement and findElements?
Ans: Refer to answer 11 and 12.
47. How will you find more than one WebElement on the list?
Ans: findElements() method of WebDriver can be used to find more than one web element and save them into a list.
48. How to clear text in the text box using Selenium WebDriver?
Ans: The clear( ) method provided by Selenium WebDriver is used to clear the text entered or displayed in the text box.
49. How to submit a form using Selenium WebDriver?
Ans: The submit() method is used to submit a form with <form> tag. It accepts nothing as a parameter and returns nothing. It will throw NoSuchElementException if the current element is not present within a form.
50. How to send user input in the text box using Selenium WebDriver?
Ans: The sendKeys() method of Selenium WebDriver is used to type or send text input in the text box. It accepts text or any sentence as a parameter and returns nothing.
51. How will you identify/verify that element is present/displayed/visible on the web page or not?
Ans: Selenium WebDriver provides a method isDisplayed() that can be used to check the visibility of the certain element on web page.
This method will return true if the element is present on the web page. Otherwise, it will throw NoSuchElementFound exception if the element is not present on the page.
52. How to verify whether a certain element is present on web page or not?
Ans: The isEnabled() method is used to check or verify whether a certain element is enabled or not on web page.
53. How to verify whether checkbox, radio button or option in the drop-down is selected on web page or not?
Ans: The isSelected() method is used to verify whether a certain checkbox, radio button, or option in the drop-down box is selected or not. It takes nothing as a parameter and returns a boolean value.
Selenium Locators Questions
In this section, we have covered all the important interview questions based on Selenium locators.
54. What is locator in Selenium? What is the use of locators in Selenium WebDriver?
Ans: Locator in selenium is like an address that is used to identify the web element uniquely within the web page.
The basic use of locators is to identify the element or object on the webpage accurately. Selenium WebDriver uses locators to interact with elements present in a web page.
55. What are the types of locators available in Selenium WebDriver?
Ans: There are eight types of locators to locate an element on the web page. They are as follows:
- ID locator
- Name locator
- ClassName locator
- TagName locator
- LinkText locator
- Partial LinkText Locator
- CSS Selector
- XPath
For more details, go to this tutorial: Locators in Selenium WebDriver
56. Which is the best locator in Selenium WebDriver?
Ans: ID locator is king! It is the safest and fastest locator in Selenium WebDriver. It should always be your first choice.
57. There is ID, name, CSS, or XPath locator, which one should I use?
Ans: If there is a constant ID/name available, you should be used instead of CSS and XPath locator. If not, the CSS locator should be used instead of XPath because it is faster than XPath in the modern browser.
58. Write a complete general syntax to find an element by locator in Selenium WebDriver.
Ans: Selenium WebDriver provides two WebElement commands such as findElement, and findElements. Both commands take an input parameter By object and return an object of type WebElement.
By is an object of By class which can be used with various locator strategies such as ID, Name, Class Name, Tag Name, Link Text, Partial Link Text, and XPATH.
General Syntax:
WebElement elementName = driver.findElement(By.locatorName("Attribute value")); // Identify one web element within web page. List<WebElement> elementName = driver.findElements(By.locatorName("Attribute value")); // Identify list of web elements within web page.
59. How to find links on the web page?
Ans: Selenium WebDriver provides two special methods to search links on a web page.
a) Finding a link by its text:
By class of Selenium WebDriver provides linkText() method to locate the link using text displayed for link. The syntax to locate Gmail link on the Google Home page is as follows:
WebElement gmailLink = driver.findElement(By.linkText(“GMail”));
b) Finding a link by partial text:
By class of Selenium WebDriver also provides an additional method partialLinkText() to locate links using partial text. This method is useful to locate link using a fixed or known portion of the link text.
The general syntax to locate a link using the partialLinkText() method is as follows:
WebElement inboxLink = driver.findElement(By.partialLinkText(“Gmail”));
Selenium XPath Interview Questions
Here, we have covered all the important interview questions based on Selenium XPath, which is often asked in the interview. So, be prepare of answers of these interview questions with nicely.
60. What is XPath in Selenium WebDriver?
Ans: XPath stands for XML (Extensible Markup Language) Path language. It is a query language that is used to search and select nodes in an XML document. It is used for the identification of any element in an HTML or a web page.
61. Write the general syntax to find an element by XPath on web page.
Ans: The general syntax for XPath is as follows:
XPath = //tagname[@Attribute = ‘Value’]
62. What are the types of XPath in Selenium WebDriver?
Ans: There are two types of XPath in Selenium WebDriver. They are:
- Absolute XPath
- Relative XPath
63. What is Absolute XPath in Selenium WebDriver?
Ans: XPath that begins with a single forward-slash (/) and selects an element from the root HTML node is called absolute XPath.
It is the easiest and direct way to find an element but if any changes happen in the path of element, this XPath gets failed. So, this is the main disadvantage of using absolute XPath.
The general syntax to find an element using absolute XPath is as:
WebElement username = driver.findElement(By.xpath("/html/body/div/div/form/input"));
64. What are the advantages and disadvantages of absolute XPath in Selenium?
Ans: The advantage of using absolute XPath is that it identifies an element very fast.
The disadvantage of using absolute XPath is that if anything goes wrong or some other tag is added in between, this path will no longer work.
65. What is Relative XPath in Selenium WebDriver?
Ans: XPath that starts from double forward-slash (//) and selects elements from anywhere on the webpage is called relative XPath. It is the best practice to find elements through relative XPath because it helps us to reduce the chance of “ElementNotFoundException”.
The general syntax to locate an element using relative XPath is as follows:
Relative XPath: //tag-name[@Attribute = 'Value']
66. What are the advantages and disadvantages of relative XPath in Selenium WebDriver?
Ans: The advantage of using relative XPath is that you don’t have to create long XPath. You can also start from the middle.
The disadvantage of using relative XPath is that it takes more time in identifying the element as we specify the partial path, not the exact path.
67. How to find elements using attribute values in XPath?
Ans: We can search for elements using their attribute values in the XPath. Let’s take an example where we will identify username field using ID attribute.
WebElement username = driver.findElement(By.xpath("//input[@id = 'username']"));
68. What is a dynamic web element in web page?
Ans: An element whose attributes dynamically change on refresh or any other operations on the web page is called dynamic web element.
69. What are XPath axes in Selenium?
Ans: XPath axes in selenium are methods to identify those dynamic elements which are not possible to find by normal XPath method such as ID, Classname, Name, etc.
70. What are commonly useful XPath axes methods used in Selenium WebDriver?
Ans: The commonly XPath axes methods used in Selenium WebDriver are child, parent, ancestor, sibling, preceding, self, namespace, attribute, etc.
71. What is atomic values?
Ans: The node which has no parents or children is called atomic values. For example, Automation Testing, TestNG, POM.
72. What is Siblings?
Ans: The node that has the same parent is called siblings. In the above XML document, title and body elements both are siblings.
For more practice on XPath axes methods, go to this tutorial: XPath Axes in Selenium
73. How to handle Complex and Dynamic Elements in Selenium using XPath?
Ans: There are following ways by which we can handle complex and dynamic element in selenium. They are as follows:
- Basic XPath
- XPath Contains
- XPath Starts-with
- XPath Ends-with
- Using “OR” Statement
- Using “AND” Statement
- XPath Text
For more detail and Practice, go to this tutorial: XPath Contains Text
Interview Questions based on Select Class
74. What is Select in Selenium WebDriver?
Ans: Select is a class provided by Selenium which is used to work with a dropdown element. The select class allows us to select an element from the drop-down and lists that are created with the HTML <select> element.
75. What is the super class of Select class?
Ans: Object class is the super class of Select class.
76. Which interface is implemented by Select class?
Ans: Select class implements ISelect interface.
77. How to create Object of Select Class in Selenium?
Ans: Since the select is an ordinary class, its object is created by using the new keyword. After creating object, we will have to pass the dropdown WebElement as parameter to its constructor.
The syntax to create an object of select class is as follows:
Select select = new Select( WebElement element);
78. Which exception is thrown by Select class when the element is unable to be selected?
Ans: UnexpectedTagNameException will throw, when the element is not a SELECT.
79. How many types of methods are provided by Select class to select an element from the dropdown list?
Ans: The select class provides three methods to select an element from the dropdown list. They are as follows:
- selectByValue
- selectByIndex
- selectByVisibleText
For more details, go to this tutorial: Select Class in Selenium
80. What is the use of deselectAll(), deselectByIndex(), and deselectByValue, and deselectByVisibleText() methods?
Ans: a) deselectAll(): It is used to clear all selected entries.
b) deselectByIndex(): This method is used to deselect or clear an option at the specified index.
c) deselectByValue(): It is used for deselecting all the options whose “value” attribute matches the specified argument.
d) deselectByVisibleText(): It is used to deselect all options that display text matching the parameter.
81. Which method of Select class is used to get the first selected option from the list?
Ans: getFirstSelectedOption() method is used to get the first selected option in the list.
82. Which method should be used to check that the list supports multiple options or not?
Ans: isMultiple() method.
83. How to select dropdown value by visible text, value, and index in Selenium WebDriver?
Ans: Refer to this tutorial for coding: How to select dropdown value in Selenium.
84. How to select Multiple values in Dropdown using Selenium Webdriver?
Ans: Refer to 10.
85. How to get Selected values from Dropdown in Selenium?
Ans: getAllSelectedOptions() of select class. For coding, go to tutorial: how to select dropdown value.
86. How to deselect dropdown value in Selenium WebDriver?
Ans: For coding, go to this tutorial: Deselect dropdown value in Selenium.
Interview Questions based on Alert
Here, we have collected all the interview questions based on Selenium alert topic.
87. What is an Alert?
Ans: Alert is a small dialogs message box that displays an important notification on the screen to give certain kinds of information to users or ask for permission to perform a certain kind of operation.
88. Is Alert class or Interface?
Ans: Alert is an interface.
89. What are the methods provided by Alert interface in Selenium?
Ans: Alert interface provides four methods to handle modal dialog box. They are:
a) dismiss(): It is used to clicking on the ‘Cancel’ button of the alert.
b) accept(): It is used to clicking on the ‘Ok’ button of the alert.
c) getText(): This method is used to capture alert messages.
d) sendKeys(String stringToSend): It is used to send or input data to the alert box.
90. How to handle simple JavaScript, Confirmation, and Prompt Alert boxes in Selenium?
Ans: For coding step by step, go to this tutorial: How to handle Alert in Selenium WebDriver.
Recommended Selenium Interview Questions
- Java Interview Questions for Selenium Automation Testing
- Top 30+ Selenium Framework Interview Questions
- Top 50+ TestNG Interview Questions and Answers
Hope that these Selenium interview questions will help you to crack interviews in the different companies. For more important interview questions, follow all links provided.
All the best!!!