Latest selenium Interview Questions and Answers 2024 for Freshers and Experienced

Selenium Test Automation: Frequently Asked Interview Questions and answers. Selenium is a widely used open-source automation tool for testing web applications. It allows developers and testers to automate interactions with web browsers, simulating user behaviour and validating the functionality and behaviour of web applications.


Home->Selenium Interview Questions and Answers

If you're looking for current Selenium interview questions and answers, you've come to the right place! This Latest 2024 Question List will provide you with a comprehensive list of trending Selenium interview questions and answers asked in Top Companies interview round.

Selenium Interview Questions and Answers Play Quiz On Selenium  |  More Q&A Click Here

# Question Options Answer
1 Which of the following does not requires running Selenium-Server?
  • using Selenium-Grid
  • run tests to a remote machine
  • using Selenium-Grid and run tests to a remote machine
  • browser and tests will all run on the same machine
  • browser and tests will all run on the same machine
    2 What is the return value of isDisplayed function, in Selenium Webdriver
  • bool
  • char
  • string
  • None of these
  • bool
    3 What refers to technology related to peer-to-peer connections in HTML5
  • WebSockets
  • IndexedDB
  • Applink
  • WebRTC
  • WebRTC
    4 What is the correct syntax to instantiate a Edge browser session
  • WebDriver driver = new edgedriver();
  • WebDriver driver = new EdgeDriver();
  • WebDriver driver = new Edge();
  • WebDriver driver = new InternetExplorerDriver();
  • WebDriver driver = new EdgeDriver();
    5 What is the name of default profile created by the Firefox driver
  • default
  • system
  • user
  • anonymous
  • anonymous
    6 Which operating system supports Selenium installation and application on Safari web browser version 6
  • Windows
  • Linux
  • MacOS
  • All of these
  • MacOS
    7 Which of the following is not an function for mouse event in Selenium
  • release
  • contextClick
  • dragAndDrop
  • sendKeys
  • sendKeys
    8 Which of the following web browser does not supports HTML5
  • Firefox
  • Safari
  • Chrome
  • None of these
  • None of these
    9 Which Selenium webdrivers method is equivalent to setting the named cookie expiry date to sometime in the past.
  • deleteAllCookies
  • deleteCookieNamed
  • deleteCookie
  • None of these
  • deleteCookieNamed
    10 What is the main feature of Selendroid
  • No modification of app under test required in order to automate it
  • Gestures are supported
  • Same concept for automating native or hybrid apps
  • All of these
  • All of these
    11 Which of the following is not an function for keyboard event in Selenium
  • keyDown
  • keyUp
  • sendKeys
  • release
  • release
    12 When will an cookie becomes inaccessible, if no time for same has been set
  • it will not become inaccessible
  • after the active tab of web browser is closed
  • after the web browser is closed
  • Depends upon AUT
  • after the web browser is closed
    13 What is the valid syntax for locating an element with ID as firstname
  • driver.findElement(id("firstname"));
  • driver.findElement(By("firstname"));
  • driver.findElement(By.Id(firstname));
  • driver.findElement(By.id("firstname"));
  • driver.findElement(By.id("firstname"));
    14 What is the main transport mechanism used by Webdriver
  • JSON
  • AJAX
  • Websocket
  • HTTP
  • HTTP
    15 Which of the following should be used to move to a web element, using javascript
  • moveToElement
  • executeScript
  • Depends upon visibility
  • Depends upon AUT
  • executeScript
    16 Which of the following programming language is not supported by Selenium WebDriver
  • C#
  • JavaScript
  • Python
  • ASP.NET
  • ASP.NET
    17 Which method will close all windows opened by the WebDriver
  • close
  • exit
  • quit
  • shutdown
  • quit
    18 What is the benefit of Selenium Webdriver as compared to Selenium RC
  • WebDriver is a compact object-oriented API.
  • WebDriver drives the browser much more effectively
  • WebDriver overcomes the limitation of single-host origin policy
  • All of these
  • All of these
    19 What is the main benefit of using Remote WebDriver
  • It separates where the tests are running from where the browser is.
  • It allows tests to be run with browsers not available on the current OS
  • It can return exceptions with screenshot.
  • All of these
  • All of these
    20 What is a good reason to automate your testing?
  • It improves the efficiency of testing.
  • It reduces the cost of testing.
  • It increases defect detection ratio.
  • It improves the quality of production code.
  • It improves the efficiency of testing.
    21 Which one of the following is not a benefit of automation testing?
  • It can help in identifying high priority test cases.
  • It is very good for validating functional flows.
  • It is useful for testing end-to-end flows.
  • It can detect high severity or show stopper bugs.
  • It can help in identifying high priority test cases.
    22 Which of the following is not a prerequisite for automation testing?
  • Stable code and application.
  • Skilled and experienced resources.
  • Ready Test Scripts.
  • Ready Test Suite.
  • Ready Test Scripts.
    23 Which skill does not require for automation engineer
  • Troubleshooting
  • coding
  • certification
  • designing
  • designing
    24 Which automation testing is a key area in testing processes.
  • performance testing
  • functional testing
  • load testing
  • stress testing
  • functional testing
    25 which test are important to exercise code functionality without touching any dependency
  • system test
  • code test
  • unit test
  • manual test
  • unit test
    26 Which of the following WebDriver is used for Headless browser testing?
  • HeadLessDriver
  • HtmlUnitWebDriver
  • FireFoxDriver
  • ChromeDriver
  • HtmlUnitWebDriver
    27 Is Implicit wait time applied to all elements in your code?
  • True
  • False
  • no idea
  • none
  • True
    28 Choose the correct option which performs a context-click at the current mouse location.
  • context-Click()
  • context.click()
  • context.Click()
  • contextClick()
  • context.Click()
    29 Which of the following WebDriver class is used to run Selenium tests in Google Chrome?
  • ChromeDriver
  • RemoteWebDriver
  • HtmlUnitDriver
  • InternetExplorerDriver
  • ChromeDriver
    30 Choose the correct option which selects the option at the given index
  • selectIndexes()
  • selectByIndex()
  • selectByIndexes()
  • selectIndex()
  • selectByIndex()
    31 Which is not the type of the locators
  • ID
  • Link Text
  • Type Text
  • Name
  • Type Text
    32 Select the command which is used to check the presence of a web element?
  • verifyElementPresent
  • verifyTextPresent
  • isElementPresent
  • isElementExist
  • verifyElementPresent
    33 The Selenium can
  • access elements outside of the web application under test
  • only test web applications
  • test both web and desktop applications
  • add elements to the inbuilt object repository
  • only test web applications
    34 What are the types of exceptions thrown in web driver?
  • ElementNotVisibleException
  • StaleElementReferenceException
  • ElementNotSelectableException
  • All of the above
  • All of the above
    35 Which statement is correct
  • “/” is used to create an absolute XPath and “//” is used to create relative XPath
  • “/” is used to create relative XPath and “//” is used to create an absolute XPath
  • Both “/” and “//” are used to create absolute XPath
  • Both “/” and “//” are used to create relative XPath
  • “/” is used to create an absolute XPath and “//” is used to create relative XPath
    36 What is default wait time for implicit wait in Selenium WebDriver?
  • 0 sec
  • 15 sec
  • 30 sec
  • None of the above
  • 0 sec
    37 Select the Wait below which is not provided by Selenium WebDriver?
  • Implicit Wait
  • Explicit Wait
  • Fluent Wait
  • Sleep
  • Sleep
    38 Which command you use to retrieve the text using Selenium WebDriver?
  • getText()
  • getElementText()
  • getText(WebElement)
  • None of the above
  • getText()
    39 Running driver.get(“www.softwaretestingmaterial.com”) will:
  • Navigates to a page www.softwaretestingmaterial.com
  • No protocol is specified, so an exception will be thrown
  • Navigates to a page https://www.softwaretestingmaterial.com
  • none
  • No protocol is specified, so an exception will be thrown
    40 What is the difference between WebDriver and RemoteWebDriver?
  • WebDriver is a class and RemoteWebDriver is an interface
  • WebDriver is an interface and RemoteWebDriver is a class
  • WebDriver and RemoteWebDriver is a class
  • WebDriver and RemoteWebDriver is an interface
  • WebDriver is an interface and RemoteWebDriver is a class
    41 Which is the Supermost interface in Selenium WebDriver?
  • WebDriver
  • SearchContext
  • WebElement
  • JavascriptExecutor
  • SearchContext
    42 Select the correct option on how to select an element that contains “SoftwareTestingMaterial”
  • None
  • WebElement element = driver.findElement(By.xpath("//*[contains(text(), ' SoftwareTestingMaterial')]"))
  • WebElement element = driver.findElement(By.xpath("\\*[contains(text(), ' SoftwareTestingMaterial')]"))
  • WebElement element = driver.findElement(By.xpath("//*[text(' SoftwareTestingMaterial')]"))
  • WebElement element = driver.findElement(By.xpath("//*[text(' SoftwareTestingMaterial')]"))
    43 What is the JavaScript method used to scroll to a particular Element?
  • ((JavascriptExecutor) driver).executeScript(“arguments[0].scrollIntoView(true);”, element);
  • ((JavascriptExecutor) driver).executeScript(“arguments.scrollIntoView(true);”, element);
  • ((JavascriptExecutor) driver).executeScript(“arguments[0].scrollTo(true);”, element);
  • ((JavascriptExecutor) driver).executeScript( element);
  • ((JavascriptExecutor) driver).executeScript(“arguments.scrollIntoView(true);”, element);
    44 Which command you use to enter values in a text box?
  • sendKeys()
  • send.Keys()
  • sendKey("text")
  • sendsKeys ()
  • sendKeys()
    45 Identify the option which is not a JAVA class in Selenium.
  • WebDriverWait
  • FirefoxDriver
  • WebDriver
  • ExpectedConditions
  • WebDriver
    46 What is the WebElement method used to get the BackGroud Color of an Element displayed in the WebPage.
  •  getCssValue(“bg-color”)
  • getCssText(“background-color”)
  • getCss(“color)
  • getCssValue(“background-color”)
  • getCssValue(“background-color”)
    47 What is the method used to Change the Focus from an frame/iframe/window/Alert
  • setFocus()
  • changeFocus()
  • redirectTo()
  • switchTo()
  • switchTo()
    48 What is the method used in the Select Java Class to get all the Options
  • getAllValues()
  • getVisibleValues()
  • getAllOptions()
  • getOptions()
  • getOptions()
    49 What are the Wait applicable in Selenium webdriver.
  • implictlyWait
  • WebDriverWait
  • FluentWait
  • All of the above
  • All of the above
    50 Is Selenium Web a component of the Selenium?
  • No
  • Yes
  • No Idea
  • none
  • No
    51 What is the javaScript Function used to enter the text in TextBox
  • document.getElementById(‘what’).setValue(‘Selenium’)
  • document.getElementById(‘what’).setAttribute(‘value’,’Selenium’)
  • document.getElementById(‘what’).setText(‘Selenium’)
  • document.getElementById(‘what’).setAttribute( ‘Selenium’)
  • document.getElementById(‘what’).setAttribute(‘value’,’Selenium’)
    52 What is the abstract class available in Selenium.
  • WebDriver
  • WebElement
  • By
  • Selenium
  • By
    53 What is return type of driver.get(String url) method in Selenium.
  • String
  • void
  • null
  • empty space
  • void
    54 What is the return Type of driver.getTitle() method in Selenium WebDriver.
  • String
  • Character
  • void
  • null
  • String
    55 What is the method used to select a value from Listbox.
  • selectByVisibleText(String)
  • selectByValue(String)
  • selectByIndex(int)
  • All of the above
  • All of the above
    56 What is the method used to check the WebElement is present.
  • .isDisplayed()
  • .isVisible()
  • .isClear()
  • .isPresent()
  • .isDisplayed()
    57 What is the method used to verify the Text present in a WebPage
  • textToBePresent(By, String)
  • textToBePresentInElementLocated(By, String)
  • textToBePresentElementLocated(By, String)
  • textToBeElementLocated(By, String)
  • textToBePresentInElementLocated(By, String)
    58 Select the language which is not supported by Selenium WebDriver
  • Java
  • JavaScript
  • VBScript
  • C#
  • VBScript
    59 which is not a Selenium Component ?
  • Maven
  • Selenium IDE
  • Selenium Grid
  • WebDriver
  • Maven
    60 who doesn’t support programming ?
  • Selenium WebDriver
  • Selenium Grid
  • Selenium RC
  • Selenium IDE
  • Selenium IDE
    61 Which programming languages does not Selenium allow to use?
  • Python, C-Sharp
  • JavaScript, Ruby
  • PHP, Java
  • C++, C
  • C++, C
    62 Which is the most common way to find an element on a page?
  • Id
  • Xpath
  • CSS Selector
  • Name
  • Id
    63 The expression is used for "anything" is -
  • .*
  • **
  • *+
  • *.
  • .*
    64 Which is the odd one using in Selenium ?
  • Id
  • Pattern Matching
  • XPath
  • CSS selector
  • Pattern Matching
    65 What is the full form of Selenium IDE ?
  • Selenium Interrelated Development Environment
  • Selenium Intialization Development Environment
  • Selenium Information Development Environment
  • Selenium Integrated Development Environment
  • Selenium Integrated Development Environment
    66 The Web driver is used for -
  • To design a test using Selenese
  • To quickly create tests
  • To execute tests on the HtmlUnit browser.
  • To test a web application against Firefox only.
  • To execute tests on the HtmlUnit browser.
    67 The command which is not a type of assertion in Selenium IDE.
  • Verify
  • Assert
  • WaitFor
  • Wait
  • Wait
    68 TestNG stands for -
  • TestNextGenerations
  • TestNextGeneration
  • TestNewGeneration
  • TestNewGenerlization
  • TestNextGeneration
    69 which of the following one is Selenium IDE ?
  • Flash Plug-in
  • Firefox Plug-in
  • Windows Software
  • Java Software
  • Firefox Plug-in
    70 Which WebDriver method is used to change focus to an alert, a frame or a browser window?
  • changeFocus()
  • setFocus()
  • switchTo()
  • changeTo()
  • switchTo()
    71 By using __________ function in XPath, we can extract all the elements which matches a particular text value.
  • contains
  • starts-with
  • ends-with
  • parameters
  • contains
    72 Selenium WebDriver is also known as
  • Selenium 2.0
  • Selenium IDE
  • Selenium 1.0
  • Selenium Grid
  • Selenium 2.0
    73 finds the item ending with the value passed in. This is the equivalent to the XPath ends-with.
  • $=
  • ^=
  • *=
  • &=
  • $=
    74 WebDriver method findElement() returns
  • WebElement
  • WebDriver Instance
  • List of WebElement
  • none
  • WebElement
    75 What type of Wait objects keep alive until the WebDriver object dies?
  • Fluent Wait
  • Explicit Wait
  • Implicit Wait
  • All of the above
  • Implicit Wait
    76 The Actions commands
  • are commands that directly interact with page elements.
  • are commands that allow you to store values to a variable.
  • are commands that verify if a certain condition is met.
  • none
  • are commands that directly interact with page elements.
    77 is the commands used to retrieves the text of a html element?
  • getText()
  • getAttributes()
  • getCurrentURL
  • none
  • getText()
    78 is used to enter text in text box in Selenium WebDriver
  • sendKeys("text")
  • sendKey()
  • submit()
  • selectAll("Text")
  • sendKeys("text")
    79 Selenium tests
  • GUI applications
  • Browser-based applications
  • DOS applications
  • None of the above
  • Browser-based applications
    80 Selenium IDE supports which browser?
  • Google Chrome
  • Mozilla Firefox
  • Internet Explorer
  • Safari
  • Mozilla Firefox
    81 Why is the contextClick() used for?
  • It is used to left click.
  • It is used to open popup menu.
  • It is used to right click.
  • It is used to click the hidden element.
  • It is used to right click.
    82 Which of the following WebDriver is used for Headless browser testing?
  • HtmlUnitWebDriver
  • InternetExplorerDriver
  • FireFoxDriver
  • HeadLessDriver
  • HtmlUnitWebDriver
    83 Which of the following WebDriver class is used to run Selenium tests in internet explorer?
  • RemoteWebDriver
  • HtmlUnitDriver
  • InternetExplorerDriver
  • None of these
  • InternetExplorerDriver
    84 Which of the following is the recommended way to handle dynamic elements?
  • By using regular expressions.
  • By using CSS locators.
  • By using relative xpath locators.
  • All of these.
  • By using relative xpath locators.
    85 Which of the following is the default status of JavaScript in HTMLUnitDriver?
  • Disabled
  • None of these
  • Enabled
  • All
  • Disabled
    86 Why is the actions class used for in WebDriver?
  • It controls the actions of web elements.
  • It controls the actions of run-time exceptions.
  • None of these.
  • It controls the actions of mouse.
  • It controls the actions of mouse.
    87 Which of the following is correct in case of WebDriver?
  • WebDriver is a class.
  • WebDriver is an interface.
  • All of the Above
  • None
  • WebDriver is an interface.
    88 Which of the following is a correct statement that describes the keyword driven framework?
  • It is best suited for functional testing and is a functional automation testing framework.
  • It is best suited for unit testing and works like a unit test framework.
  • None of these.
  • It is best suited for white box testing.
  • It is best suited for functional testing and is a functional automation testing framework.
    89 Which Selenium command(s) simulates selecting a link?
  • findElement(By.Link("LinkName"))
  • findElement(By.tagName("LinkName"))
  • findElement(By.xpath("LinkName"))
  • findElement(By.linkText("LinkName"))
  • findElement(By.linkText("LinkName"))
    90 Which of the following command is a “OnEvent Handler”?
  • focus()
  • fireEvent()
  • alert()
  • assertAlert()
  • fireEvent()
    91 Which of the following Selenium WebDriver component does not expose any APIs?
  • Selenium WebDriver
  • selenium RC
  • Selenium Grid
  • None of these.
  • Selenium Grid
    92 Which of the following is not an advantage of Page Object Model?
  • POM solves the problem of duplicate locators for same WebElement.
  • POM reduces the maintenance of the test scripts.
  • POM provides clean separation between test code and page specific code.
  • POM allows to support execution in multiple browsers.
  • POM allows to support execution in multiple browsers.
    93 Why would you like to choose WebDriver over Selenium RC?
  • WebDriver does not need the Selenium RC server to be running.
  • WebDriver has native web browser support and runs faster than RC.
  • All of these.
  • WebDriver supports headless HTMLUnitDriver that enables faster test execution.
  • All of these.
    94 In Selenium terminology, what is the generic name for an argument that starts with “//”?
  • Partial link text
  • Xpath
  • CSS
  • Element id
  • Xpath
    95 Which of the following WebDriver method that supports moving between named windows?
  • driver.switchTo().window("windowName");
  • driver.MoveTo().window("windowName");
  • driver.Activate().window("windowName");
  • None of these.
  • driver.switchTo().window("windowName");
    96 Which type of exception is handled during compile time?
  • Error
  • Checked
  • Unchecked
  • None of the above
  • Checked
    97 Which of the following components is not the part of Selenium suite?
  • SeleniumGrid
  • Selenium Web
  • Selenium RC
  • Selenium IDE
  • Selenium Web
    98 What is the similarity between WebDriver’s close() and quit() methods?
  • closes the active web browser window.
  • closes all opened web browser windows.
  • None of the above.
  • does not accept arguments.
  • does not accept arguments.
    99 Which of the following commands is not a type of assertion in Selenium IDE?
  • Wait
  • Verify
  • Assert
  • WaitFor
  • Wait
    100 Which of the following WebDriver commands is used to check the presence of a web element?
  • isElementPresent
  • isElementExist
  • verifyElementPresent
  • verifyTextPresent
  • verifyElementPresent

    Selenium is a powerful open-source automation testing tool that is widely used in the software industry for testing web applications. It is designed to automate browser interactions, making it an ideal tool for testing the functionality of web applications. With Selenium, developers can automate browser interactions, run tests on different browsers and operating systems, and generate detailed test reports.

    One of the key benefits of Selenium is its flexibility. It supports multiple programming languages, including Java, C#, Python, and Ruby, making it easy for developers to integrate it into their existing testing frameworks. Additionally, Selenium supports various browser platforms, including Chrome, Firefox, Internet Explorer, and Safari, making it a versatile tool for testing web applications across different browsers.

    Another benefit of Selenium is its ability to handle dynamic elements in web applications. Selenium WebDriver allows developers to interact with web elements, such as buttons, links, and forms, in a way that mimics how a human user would interact with them. This makes Selenium an ideal tool for testing web applications that have dynamic elements, such as AJAX and JavaScript.

    In addition to its flexibility and dynamic element handling capabilities, Selenium also provides a robust set of tools for test automation, including Selenium Grid and Selenium IDE. Selenium Grid allows developers to run tests on multiple machines and browsers simultaneously, while Selenium IDE is an integrated development environment that allows developers to record and play back browser interactions in an easy-to-use interface.

    Overall, Selenium is a powerful and versatile tool that is widely used in the software industry for testing web applications. With its flexibility, dynamic element handling capabilities, and robust set of tools for test automation, Selenium is an ideal choice for developers looking to automate browser interactions and improve the quality of their web applications.

     

    This page provides a comprehensive collection of Selenium questions and answers, covering a wide range of topics related to the tool, such as:

    • Locating elements in web pages
    • Selenium WebDriver API and its commands
    • Handling browser windows and pop-ups
    • Automating form submissions
    • Handling dynamic web elements
    • Cross-browser testing
    • TestNG and JUnit integration with Selenium
    • Advanced concepts such as Page Object Model and Data-Driven testing

    Each question is accompanied by a detailed explanation, providing a comprehensive understanding of the topic at hand. The questions are designed to test the knowledge of both beginners and experienced testers, and are suitable for anyone who wants to improve their understanding of Selenium.

    This page also provides sample code snippets and examples to help illustrate key concepts and best practices. Whether you are preparing for a job interview, a certification exam, or simply want to improve your Selenium skills, this page is a valuable resource for anyone looking to learn or refresh their knowledge of Selenium.