Question :Selenium tests _____________.
DOS applications
Browser-based applications
GUI applications
None of the above
Correct Answer : Browser-based applications
Question :What does the term DOM refers to ?
Dynamic Object Model
Document Object Model
Data Object Model
Document Flow Object Model
Correct Answer : Document Object Model
Question :What is a test suite made of ?
Test packs
Tests
Test blocks
Test pattern
Correct Answer : Tests
Question :Select the Browser which is supported by Selenium IDE
Google chrome
Opera mini
Mozilla Firefox
Internet Explorer
Correct Answer : Mozilla Firefox
Question :Select the operating system which is NOT supported by Selenium IDE.
Unix
Linux
Windows
Solaris
Correct Answer : Unix
Question :The Web driver is used
To execute tests on the HtmlUnit browser.
To design a test using Selenese
To quickly create tests
To test a web application against Firefox only.
Correct Answer : To execute tests on the HtmlUnit browser.
Question :The Selenium IDE is used
To create customized test results.
To deploy your tests across multiple environments using Selenium Grid
To test with HTMLUnit
To test a web application against Firefox only.
Correct Answer : To test a web application against Firefox only.
Question :Select the method which selects the option at the given index.
selectByIndex()
selectIndex()
selectedByIndex()
selectByIndexes()
Correct Answer : selectByIndex()
Question :The Selenium
Provides professional customer support
Test Reports are generated automatically
Comes with a built-in object repository
Cannot access elements outside of the web application under test
Correct Answer : Cannot access elements outside of the web application under test
Question :Which command can be used to enter values onto text boxes?
sendsKeys()
sendKey()
sendKeys
sendKeys()
Correct Answer : sendKeys()
Question :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.
All the above
Correct Answer : are commands that directly interact with page elements.
Question :Select the command which is used to pause execution until the page is loaded completely.
waitForPageToLoad
waitForElementPresent
waitForPage
waitForLoad
waitForPageToLoad
Question :Select the syntax to locate an element using inner text.
css=tag:contains(“inner text”)
css=tag:value(“inner text”)
css=tag:attributes(“inner text”)
css=tag:class(“inner text”)
Correct Answer : css=tag:contains(“inner text”)
Question :What is TestNG?
TestNextGeneration
TestNewGenerlization
TestNewGeneration
TestNextGenerations
Correct Answer : TestNextGeneration
Question :Select the variation which finds elements based on the driver’s underlying CSS selector engine in Web driver Selenium.
By.cssSelected
By.cssSelection
By.cssSelector
By.Selectcs
Correct Answer : By.cssSelector
Question :Select the variation which locates elements by the value of the “name” attribute in Web driver Selenium
By.name
By.nametag
By.tagname
By.nametags
Correct Answer : By.name
Question :Select the variation which locates elements by the value of their “id” attribute in Web Driver Selenium
By.id
By.idno
By.id_no
By.tag_id
Correct Answer : By.id
Question :Select the Get command which fetches the inner text of the element that you specify in Web driver Selenium.
getinnerText()
get_in_Text()
get_inner_Text()
getText()
Correct Answer : getText()
Question :Which Navigate command takes you forward by one page on the browser’s history in Web driver Selenium.
navigate.forward()
navigate().forward()
navigate()_forward()
navigate_forword()
Correct Answer : navigate().forward()
Question :Select the method which clears all selected entries in Web driver Selenium.
dselectAll()
deselect_All()
dselect_All()
deselectAll()
Correct Answer : deselectAll()
Question :Method which selects the option which displays the text matching the parameter passed to it
selectVisibleText()
selectByVisibleText()
select_VisibleText()
select_ByVisibleText()
Correct Answer : selectByVisibleText()
Question :Select the method which performs a context-click at the current mouse location.
click_Context()
context.Click()
contextClick()
context_Click()
Correct Answer : contextClick()
Question :Which command should be used to confirm that test will pass in the future, when new element is added after page loaded?
waitForElementPresent
pause
assertElementPresent
None of these
Correct Answer : waitForElementPresent
Question :Which command is used to extend the time limit of WAITFOR command?
Extend waitFor (time in sec)
waitFor (time in sec) extend
setTimeout (time in sec)
setTimeout.
Correct Answer : setTimeout.
Question :___________ finds the item ending with the value passed in. This is the equivalent to the XPath ends-with. Is concern with?
^=
$=
*=
&=
Correct Answer : $=
Question :In Selenium, Following Axis is related to:
Selects all the siblings after the current element
Selects all elements that follow the closing tab of the current elements.
Selects all of the siblings before the current element
Selects all elements that are before the current element
Selects all elements that follow the closing tab of the current elements.
Question :In regular Expression * quantifier refers to:
0 or more of the preceding character.
1 or more of the preceding character
0 or 1 of the preceding character
All of these
0 or more of the preceding character.
Question :Which regular expression sequence that loosely translates to “anything or nothing?”
.* (dot star)
*. (star dot)
“?
*+The // tells the query that
.* (dot star)
Question :If you wanted to access the element that has the text “This element has an ID that changes every time the page is loaded” in it, then which of the following is used:
//div[contains(@id,’time_’)]
//div[contains(@id_time())]
//div[parameter(@id_time())]
//div[parameter(@id,’time_’)]
Correct Answer : //div[contains(@id,’time_’)]
Question :To delete a cookie we need to call the deleteCookie method, passing in two parameters.
The first parameter is the name of the cookie, and the second parameter is where it was created.
The first parameter is where it was created, and the second parameter is the name of cookie.
None of these
A and B
Correct Answer : The first parameter is the name of the cookie, and the second parameter is where it was created.
Question :What is the default port number used by hub in selenium?
4444
2222
1111
3333
Correct Answer : 4444
Question :Which two commands you use to validate a button?
VerifyTextPresent and assertTextPresent
VerifyElementPresent and assertElementPresent
VerifyAlertPresent and assertAlertPresent
VerifyAlert and assertAlert
Correct Answer : VerifyElementPresent and assertElementPresent
Question :Selects all the parent, grandparent, and so on of the element is related to which axis name in Selenium:
Ancestor
Preceding
Parent
All of these.
Correct Answer : Ancestor
Question :Which command is used to open a web page in Selenium WebDriver?
open()
start()
get()
load()
get()
Question :How can you find an element by its ID using Selenium WebDriver?
findElement(By.id('elementId'))
getElementById('elementId')
findElementById('elementId')
getElement(By.id('elementId'))
findElement(By.id('elementId'))
clear the contents of an input field using Question :Which method is used to submit a form using Selenium WebDriver?
submitForm()
sendForm()
submit()
clickForm()
Correct Answer : submit()
Question :How do you switch to a new window or tab using Selenium WebDriver?
switchToWindow()
switchToTab()
switchToNewWindow()
switchTo().window(handle)
Correct Answer : switchTo().window(handle)
Question :How do you handle alerts in Selenium WebDriver?
handleAlert()
acceptAlert()
switchToAlert()
dismissAlert()
Correct Answer : switchToAlert()
Question :How do you perform mouse hover action using Selenium WebDriver?
hover()
mouseHover()
moveToElement()
moveMouseTo()
Correct Answer : moveToElement()
Question :How do you get the current URL of the web page using Selenium WebDriver?
getCurrentURL()
getURL()
fetchURL()
retrieveURL()
Correct Answer : getCurrentURL()
Question :Which method is used to maximize the browser window using Selenium WebDriver?
maximizeWindow()
maximize()
fullscreen()
setMaximized()
Correct Answer : maximize()
Question :How do you perform the double-click action using Selenium WebDriver?
doubleClick()
clickTwice()
performDoubleClick()
doubleTap()
Correct Answer : doubleClick()
Question :What is the command to refresh the web page using Selenium WebDriver?
refresh()
reload()
update()
navigate().refresh()
Correct Answer : navigate().refresh()
Question :How do you handle frames using Selenium WebDriver?
switchToFrame()
switchFrame()
frameTo()
switchTo().frame()
Correct Answer : switchTo().frame()
Question :Which method is used to get the text of an element using Selenium WebDriver?
text()
getValue()
getText()
innerText()
Correct Answer : getText()
Question :What is the command to close the current window using Selenium WebDriver?
close()
quit()
exit()
end()
Correct Answer : close()
Question :How do you handle multiple windows or tabs using Selenium WebDriver?
getWindowHandles()
getWindowIds()
getWindowNames()
getAllWindowHandles()
Correct Answer : getWindowHandles()
Question :Which method is used to execute JavaScript code using Selenium WebDriver?
executeJS()
runScript()
executeScript()
executeJavaScript()
Correct Answer : executeScript()
Question :How do you scroll down to the bottom of the web page using Selenium WebDriver?
scrollDown()
scrollToBottom()
scrollToEnd()
scrollBy(0, document.body.scrollHeight)
Correct Answer : scrollBy(0, document.body.scrollHeight)
Question :How do you handle keyboard events using Selenium WebDriver?
handleKeyboard()
sendKeys()
typeKeys()
keyboardEvent()
Correct Answer : sendKeys()
Question :Which method is used to drag and drop elements using Selenium WebDriver?
dragAndDrop()
dragDrop()
performDragAndDrop()
dragTo()
Correct Answer : dragAndDrop()
Question :What is the correct way to switch to the default content from a frame using Selenium WebDriver?
switchToDefaultContent()
switchToDefault()
switchToMainFrame()
switchTo().defaultContent()
Correct Answer : switchTo().defaultContent()
Question :Which method is used to get the CSS value of an element using Selenium WebDriver?
getCssValue()
fetchCssValue()
getStyle()
cssProperty()
Correct Answer : getCssValue()
Question :What is the command to navigate to a URL using Selenium WebDriver?
navigateTo()
goTo()
loadURL()
get()
get()
Question :How do you perform right-click context menu action using Selenium WebDriver?
rightClick()
contextClick()
performContextClick()
rightTap()
contextClick()
Question :What is the command to get the title of the web page using Selenium WebDriver?
getTitle()
fetchTitle()
getPageTitle()
getWindowTitle()
getTitle()
Question :Which method is used to select an option from a dropdown using Selenium WebDriver?
selectDropdownOptionByText(element, 'option_text')
selectDropdownOptionByIndex(element, index)
element.selectByVisibleText('option_text')
element.selectByValue('option_value')
element.selectByVisibleText('option_text')
Question :How do you handle multiple windows or tabs in Selenium WebDriver?
driver.switchToNewWindow()
driver.switchToWindow(index)
driver.switchToNextWindow()
driver.switchToWindow(handle)
driver.switchToWindow(handle)
Question :What is the correct way to wait for an element to be visible using Selenium WebDriver?
driver.waitForElementVisible(element)
driver.waitUntilElementVisible(element)
wait.until(ExpectedConditions.visibilityOf(element))
wait.until(elementToBeVisible(element))
wait.until(ExpectedConditions.visibilityOf(element))
Question :How do you handle browser cookies using Selenium WebDriver?
driver.setCookie(cookie)
driver.addCookie(cookie)
driver.updateCookie(cookie)
driver.deleteCookie(cookie)
driver.addCookie(cookie)
Question :What is the correct way to handle basic authentication pop-ups in Selenium WebDriver?
driver.handleAuthentication(username, password)
driver.authenticate(username, password)
driver.switchTo().alert().authenticateUsing(new UserAndPassword(username, password))
driver.switchTo().alert().setCredentials(username, password)
driver.switchTo().alert().authenticateUsing(new UserAndPassword(username, password))
Question :How do you handle mouse hover actions in Selenium WebDriver?
driver.hoverOverElement(element)
driver.moveToElement(element)
actions.moveToElement(element).perform()
actions.hover(element).perform()
Correct Answer : actions.moveToElement(element).perform()
Question :What is the correct way to execute JavaScript code using Selenium WebDriver?
driver.executeScript('javascript_code')
driver.runScript('javascript_code')
driver.executeJavaScript('javascript_code')
driver.runJavaScript('javascript_code')
Correct Answer : driver.executeScript('javascript_code')
Question : How do you handle keyboard key presses in Selenium WebDriver?
actions.keyDown(Keys.ENTER).perform()
actions.sendKeys(Keys.ENTER).release().perform()
actions.sendKeys(Keys.ENTER).perform()
actions.keyDown(Keys.ENTER).release().perform()
Correct Answer : actions.sendKeys(Keys.ENTER).perform()
Question : What is the correct way to simulate browser navigation using Selenium WebDriver?
driver.navigate().to('url')
driver.navigate().back()
driver.navigate().refresh()
driver.navigate().forward()
Correct Answer : driver.navigate().to('url')
Question : How do you handle frames and iframes in Selenium WebDriver?
driver.switchToFrame(frame)
driver.switchTo().frame(frame)
driver.switchTo().frame(index)
driver.switchToFrame(index)
Correct Answer : driver.switchTo().frame(frame)
Question : What is the correct way to take a screenshot using Selenium WebDriver?
driver.takeScreenshot('file_path')
driver.getScreenshotAs('file_path')
driver.saveScreenshot('file_path')
driver.captureScreenshot('file_path')
Correct Answer : driver.getScreenshotAs('file_path')
Question : How do you handle SSL certificate errors in Selenium WebDriver?
driver.acceptSSLCertificate()
driver.handleSSLCertificateError('proceed')
driver.handleSSLCertificateError('cancel')
driver.ignoreSSLCertificateError()
Correct Answer : driver.acceptSSLCertificate()
Question : What is the correct way to simulate mouse double-click using Selenium WebDriver?
actions.doubleClick(element).perform()
actions.mouseDoubleClick(element).perform()
actions.doubleClickAndHold(element).perform()
actions.doubleClickAndHold(element).release().perform()
Correct Answer : actions.doubleClick(element).perform()
Question : What is the correct way to check if an element is present and visible using Selenium WebDriver?
driver.isElementDisplayed(element)
driver.isElementPresent(element)
driver.isElementVisible(element)
element.isDisplayed()
Correct Answer : element.isDisplayed()
Question : How do you handle drag and drop actions in Selenium WebDriver?
actions.dragAndDrop(source, target).perform()
actions.clickAndHold(source).moveToElement(target).release().perform()
actions.dragAndDropByOffset(source, x, y).perform()
actions.clickAndHold(source).moveByOffset(x, y).release().perform()
Correct Answer : actions.dragAndDrop(source, target).perform()
Question : Which type of framework promotes the use of data-driven testing in Selenium?
Keyword-driven framework
Hybrid framework
Data-driven framework
Page Object Model
Correct Answer : Data-driven framework
Question : What is the primary purpose of the Page Object Model (POM) in Selenium?
Managing browser sessions
Creating modular and reusable code
Handling multiple windows
Generating test reports
Correct Answer : Creating modular and reusable code
Question : In the TestNG framework, which annotation is used to mark a method as a test case?
@BeforeMethod
@Test
@AfterClass
@DataProvider
Correct Answer : @Test
Question : Which framework facilitates the parallel execution of test cases in Selenium?
JUnit
TestNG
NUnit
Cucumber
Correct Answer : TestNG
Question : What is the purpose of the "assert" statements in testing frameworks like TestNG or JUnit?
Pause test execution
Generate logs
Verify expected outcomes
Manage browser instances
Correct Answer : Verify expected outcomes
Question : Which type of framework combines the features of both data-driven and keyword-driven frameworks?
Modular framework
Page Object Model (POM)
Hybrid framework
Behavior-Driven Development (BDframework
Correct Answer : Hybrid framework
Question : What is the purpose of a testNG.xml file in TestNG framework?
Define test scenarios
Store test data
Configure test execution settings
Manage page objects
Correct Answer : Configure test execution settings
Question : In Selenium, which design pattern is commonly used to create an instance of a browser driver?
Singleton pattern
Observer pattern
Factory pattern
Builder pattern
Correct Answer : Factory pattern
Question : Which framework facilitates behavior-driven testing in Selenium projects?
JUnit
TestNG
Cucumber
NUnit
Correct Answer : Cucumber
Question : What is the purpose of the "dataProvider" annotation in TestNG?
Manage test data
Perform assertions
Define test scenarios
Handle browser sessions
Correct Answer : Manage test data
Question : Which design pattern is associated with the concept of encapsulating an object's behavior in Selenium?
Singleton pattern
Page Object Model (POM)
Observer pattern
Composite pattern
Correct Answer : Page Object Model (POM)
Question : Which framework allows the execution of test scripts across different browsers and platforms in Selenium Grid?
TestNG
JUnit
Selenium WebDriver
TestNG with parallel execution
Correct Answer : Selenium WebDriver
Question : What is the primary purpose of the "tearDown" method in testing frameworks like JUnit or TestNG?
Set up test data
Close browser sessions
Perform assertions
Define test scenarios
Correct Answer : Close browser sessions
Question : Which annotation is used to mark a method that runs before every test case in TestNG?
@BeforeSuite
@BeforeTest
@BeforeMethod
@BeforeClass
Correct Answer : @BeforeMethod
Question : In the context of Selenium, what does the term "WebDriverEventListener" refer to?
A design pattern for managing browser sessions
A component for handling AJAX calls
An interface for capturing events during test execution
A utility for managing cookies
Correct Answer : An interface for capturing events during test execution
Question : Which design pattern in Selenium promotes the creation of flexible and maintainable test scripts by separating concerns?
Singleton pattern
Observer pattern
Page Object Model (POM)
Factory pattern
Correct Answer : Page Object Model (POM)
Question : Which method is used to take screenshots in Selenium WebDriver?
captureScreenshot()
takeScreenshot()
captureScreen()
getScreenshot()
Correct Answer : takeScreenshot()
Question : In a Selenium project, which framework is commonly used for managing and organizing test data?
JUnit
TestNG
Apache POI
Selenium Grid
Correct Answer : Apache POI
Question : Which design pattern is commonly used to implement the concept of parallel test execution in Selenium Grid?
Observer pattern
Singleton pattern
Factory pattern
Decorator pattern
Correct Answer : Factory pattern
Question : What is the purpose of the "@FindBy" annotation in the Page Object Model (POM)?
Identifying test methods
Locating web elements
Defining test data
Handling test dependencies
Correct Answer : Locating web elements
Question : Which Selenium WebDriver method is used to switch to a different frame within a web page?
switchToFrame()
switchToWindow()
switchToAlert()
switchTo().frame()
Correct Answer : switchTo().frame()
Question : What is the primary purpose of the "SoftAssertions" library in testing frameworks like TestNG?
Handling exceptions
Generating test reports
Performing assertions without stopping the test execution on failure
Managing browser sessions
Correct Answer : Performing assertions without stopping the test execution on failure
Question : In Selenium, which type of locator is used to find web elements by their link text?
CSS selector
XPath
ID
LinkText
Correct Answer : LinkText
Question : Which testing framework is commonly associated with the concept of "test suites" in Selenium projects?
JUnit
TestNG
NUnit
Cucumber
Correct Answer : TestNG
Question : What is the primary purpose of the "WebDriverWait" class in Selenium?
Managing browser sessions
Executing JavaScript code
Explicitly waiting for a certain condition before proceeding with the test
Switching between windows
Correct Answer : Explicitly waiting for a certain condition before proceeding with the test
Question : Which method is used to perform mouse hover actions in Selenium WebDriver?
hover()
moveToElement()
mouseOver()
performHover()
Correct Answer : moveToElement()
Question : What is the purpose of the "TestBase" class in a Selenium project?
Managing test data
Executing test cases
Serving as a base class for common functionalities shared across test classes
Handling browser sessions
Correct Answer : Serving as a base class for common functionalities shared across test classes
Question : Which annotation is used to mark a method that runs after every test case in TestNG?
@AfterSuite
@AfterTest
@AfterMethod
@AfterClass
Correct Answer : @AfterMethod
Question : In Selenium, what is the purpose of the "Actions" class?
Managing browser sessions
Performing advanced user interactions like drag-and-drop
Executing JavaScript code
Switching between frames
Correct Answer : Performing advanced user interactions like drag-and-drop
Question : Which method is used to select an option from a dropdown menu in Selenium WebDriver?
click()
selectByIndex()
setValue()
chooseOption()
Correct Answer : selectByIndex()
Question : Which design pattern is commonly used for creating dynamic and flexible object repositories in Selenium projects?
Factory pattern
Singleton pattern
Prototype pattern
Decorator pattern
Correct Answer : Factory pattern
Question : What is the purpose of the "@BeforeSuite" annotation in TestNG?
Set up test data
Execute test cases
Perform actions before the entire test suite
Configure test execution settings
Correct Answer : Perform actions before the entire test suite
Question : In Selenium WebDriver, which method is used to simulate keyboard actions such as pressing keys?
type()
sendKeys()
setText()
enterKey()
Correct Answer : sendKeys()
Question : What is the purpose of the "extentReports" library in Selenium projects?
Managing test data
Generating test reports
Performing assertions
Handling browser sessions
Correct Answer : Generating test reports
Question : Which Selenium WebDriver method is used to navigate backward in the browser history?
navigateToBack()
goBack()
back()
previousPage()
Correct Answer : back()
Question : What is the purpose of the "Apache POI" library in Selenium projects?
Performing database operations
Managing test data
Generating test reports
Handling Excel files
Correct Answer : Handling Excel files
Question : Which annotation is used to mark a method that runs before the entire test suite in TestNG?
@BeforeSuite
@BeforeTest
@BeforeClass
@BeforeMethod
Correct Answer : @BeforeSuite
Question : Which class in Selenium is used to set browser-specific settings for Chrome?
ChromeSettings
ChromeDriver
ChromeOptions
ChromeBrowserSettings
ChromeOptions
Question : Which of the following methods is used to add an argument to ChromeOptions?
addPreference()
addArguments()
setCapability()
addExtensions()
addArguments()
Question : Which capability in DesiredCapabilities is used to run Chrome in headless mode?
headless
disable-gpu
chromeOptions.headless
chrome.switches
headless
Question : How can you set a custom download directory in Chrome using ChromeOptions?
options.addPreference("download.default_directory", path);
options.setDownloadDirectory(path);
options.addArguments("download.default_directory", path);
options.setExperimentalOption("prefs", prefs);
options.setExperimentalOption("prefs", prefs);
Question : Which method is used to merge ChromeOptions with DesiredCapabilities in Selenium WebDriver?
options.merge(capabilities);
capabilities.setOptions(options);
options.addCapabilities(capabilities);
capabilities.merge(options);
options.merge(capabilities);
Question : What is the purpose of using setCapability() method in DesiredCapabilities?
To set system properties.
To define test data.
To set browser-specific capabilities.
To configure WebDriver timeouts.
To set browser-specific capabilities.
Question : Which of the following is the correct way to disable the "Save Password" prompt in Chrome using ChromeOptions?
options.addArguments("disable-password-manager");
options.setCapability("disable-password-saving", true);
options.setExperimentalOption("prefs", {"credentials_enable_service": false});
options.setPreference("disablePasswordManager", true);
options.setExperimentalOption("prefs", {"credentials_enable_service": false});
Question : Which ChromeOptions argument is used to start Chrome maximized?
--start-maximized
--maximize
--start-fullscreen
--window-size=1920,1080
--start-maximized
Question : How do you add an extension to Chrome using ChromeOptions?
options.setExperimentalOption("extensions", extensionPath);
options.addExtensions(new File(extensionPath));
options.addArguments("--load-extension=" + extensionPath);
options.setCapability("chrome.loadExtension", extensionPath);
options.addExtensions(new File(extensionPath));
Question : Which of the following is a valid DesiredCapabilities property for enabling logging in Chrome?
capabilities.setCapability("loggingPrefs", "ALL");
capabilities.setCapability("goog:loggingPrefs", "ALL");
capabilities.setCapability("chromeOptions.loggingPrefs", "ALL");
capabilities.setCapability("browserLogging", "ALL");
capabilities.setCapability("goog:loggingPrefs", "ALL");
Question :Which statement is TRUE about findElement()?
Returns null if element not found
Returns empty list if element not found
Throws NoSuchElementException if element not found
Throws ElementNotVisibleException
Correct Answer : Throws NoSuchElementException if element not found
Question :Which return type is correct for findElements()?
WebElement
Set
ArrayList
List
Correct Answer : List
Question :Which method belongs to JavascriptExecutor?
executeAsync()
executeJavaScript()
executeScript()
runScript()
Correct Answer : executeScript()
Question :Which is the CORRECT casting?
JavascriptExecutor js = new JavascriptExecutor();
JavascriptExecutor js = (JavascriptExecutor) driver;
WebDriver js = (JavascriptExecutor) driver;
JavascriptExecutor js = driver.executeScript();
Correct Answer : JavascriptExecutor js = (JavascriptExecutor) driver;
Question :Which locator supports both starts-with() and contains()?
CSS Selector
ID
Name
XPath
Correct Answer : XPath
Question :Which wait ignores polling interval configuration?
Implicit Wait
Explicit Wait
Fluent Wait
Thread.sleep()
Correct Answer : Thread.sleep()
Question :What happens if Implicit Wait is set to 10 seconds and Explicit Wait to 20 seconds?
Explicit overrides Implicit
Implicit overrides Explicit
They add up to 30 seconds
Unpredictable wait behavior
Correct Answer : Unpredictable wait behavior
Question :Which method is NOT present in WebDriver.Navigation?
back()
forward()
refresh()
navigate()
Correct Answer : navigate()
Question :Which interface is implemented by RemoteWebDriver?
TakesScreenshot
JavascriptExecutor
WebDriver
All of the above
Correct Answer : All of the above
Question :Which is the correct way to take screenshot?
driver.captureScreenshot()
((TakesScreenshot)driver).takeScreenshot()
((TakesScreenshot)driver).getScreenshotAs(OutputType.FILE)
driver.getScreenshot()
Correct Answer : ((TakesScreenshot)driver).getScreenshotAs(OutputType.FILE)
Question :Which exception occurs when DOM is refreshed?
NoSuchElementException
TimeoutException
StaleElementReferenceException
ElementNotVisibleException
Correct Answer : StaleElementReferenceException
Question :Which method belongs to Select class?
selectVisibleText()
selectByText()
selectByVisibleText()
selectText()
Correct Answer : selectByVisibleText()
Question :Which statement about isDisplayed() is TRUE?
Throws exception if element hidden
Returns null if element hidden
Returns false if element hidden
Returns true if element exists in DOM
Correct Answer : Returns false if element hidden
Question :What is the return type of getCssValue()?
int
boolean
String
Object
Correct Answer : String
Question :Which method switches control to default page from iframe?
switchTo().parent()
switchTo().main()
switchTo().defaultContent()
switchTo().home()
Correct Answer : switchTo().defaultContent()
Question :Which statement about Selenium Grid is TRUE?
Node distributes test cases
Hub executes test cases
Hub controls nodes and distributes tests
Grid only supports Chrome
Correct Answer : Hub controls nodes and distributes tests
Question :Which command is INVALID in Selenium IDE?
open
type
click
getTitle
Correct Answer : getTitle
Question :Which method returns current URL?
getUrl()
getCurrentUrl()
currentUrl()
getURL()
Correct Answer : getCurrentUrl()
Question :Which command fails at compile time?
driver.switchTo().alert().accept();
driver.switchTo().frame(0);
driver.switchTo().window();
driver.navigate().refresh();
Correct Answer : driver.switchTo().window();
Question :What is the return type of driver.switchTo()?
WebDriver
Set of Elements
Options
TargetLocator
Correct Answer : TargetLocator
Question :Which statement causes a compile-time error?
driver.switchTo().alert().accept();
driver.switchTo().frame("frame1");
driver.switchTo().window();
driver.switchTo().defaultContent();
Correct Answer : driver.switchTo().window();
Question :Which class directly implements WebDriver?
ChromeDriver
ChildWebDriver
MyDriver
RemoteWebDriver
Correct Answer : RemoteWebDriver
Question :Which interface allows JavaScript execution?
WebDriver
RemoteWebDriver
JavascriptExecutor
ExecuteScript
Correct Answer : JavascriptExecutor
Question :Which cast is mandatory to execute JavaScript?
(WebDriver) driver
(RemoteWebDriver) driver
(JavascriptExecutor) driver
No casting required
Correct Answer : (JavascriptExecutor) driver
Question :What happens if findElements() finds nothing?
Throws NoSuchElementException
Returns null
Returns empty List
Stops execution
Correct Answer : Returns empty List
Question :Which is TRUE about isDisplayed()?
Checks presence in DOM
Throws exception if hidden
Returns false if hidden
Returns null if not visible
Correct Answer : Returns false if hidden
Question :Which statement about Implicit Wait is TRUE?
Applied per element
Applies only to findElement()
Applied globally for session
Overrides Explicit Wait
Correct Answer : Applied globally for session
Question :What does driver.findElements(By.id("x")).size(); return if nothing found?
Exception
null
0
-1
Correct Answer : 0
Question :Which method belongs to Options interface?
navigate()
switchTo()
manage()
addCookie()
Correct Answer : addCookie()
Question :Which Selenium exception is unchecked?
IOException
SQLException
NoSuchElementException
InterruptedException
Correct Answer : NoSuchElementException
Question :Which WebDriver command closes only the current window?
quit()
close()
end()
stop()
Correct Answer : close()
Question :Which is the correct screenshot syntax?
driver.getScreenshot()
((TakesScreenshot)driver).getScreenshotAs(OutputType.FILE)
driver.capture()
Screenshot.take()
Correct Answer : ((TakesScreenshot)driver).getScreenshotAs(OutputType.FILE)
Question :Which XPath is syntactically INVALID?
//input[@id='x']
//*[@class='a']
//input[@id='x' and]
//div[contains(@id,'a')]
Correct Answer : //input[@id='x' and]
Question :Which Selenium component supports parallel execution across machines?
IDE
WebDriver
Grid
RemoteControl
Correct Answer : Grid
Question :Which returns a Set?
getWindowHandle()
getWindowHandles()
getWindows()
getAllHandles()
Correct Answer : getWindowHandles()
Question :Which call fails at runtime but compiles fine?
driver.switchTo().frame(0);
driver.findElement(By.id("notPresent"))
driver.getTitle();
driver.navigate().back();
Correct Answer : driver.findElement(By.id("notPresent"))
Question :Which statement is TRUE about Selenium IDE?
Supports Java coding
Can handle dynamic waits
Supports record & playback only
Supports Grid execution
Correct Answer : Supports record & playback only
Question :Return type of driver.switchTo()?
WebDriver
Options
TargetLocator
Navigation
Correct Answer : TargetLocator
Question :Which call causes compile-time error?
driver.switchTo().alert().accept();
driver.switchTo().frame(0);
driver.switchTo().window();
driver.switchTo().defaultContent();
Correct Answer : driver.switchTo().window();
Question :Mandatory cast for JavaScript execution?
WebDriver
RemoteWebDriver
JavascriptExecutor
ExecuteScript
Correct Answer : JavascriptExecutor
Question :Which locator is fastest?
XPath
CSS Selector
Name
ID
Correct Answer : ID
Question :What does findElements() return if nothing found?
null
Exception
Empty List
FALSE
Correct Answer : Empty List
Question :Which wait is global?
Explicit
Fluent
Implicit
Thread.sleep()
Correct Answer : Implicit
Question :Which method belongs to Select?
selectByText()
selectByVisibleText()
selectText()
selectVisible()
Correct Answer : selectByVisibleText()
Question :Which exception when DOM refreshes?
NoSuchElementException
TimeoutException
StaleElementReferenceException
ElementNotVisibleException
Correct Answer : StaleElementReferenceException
Question :Which is NOT a WebDriver method?
getTitle()
getCurrentUrl()
open()
close()
Correct Answer : open()
Question :Return type of getWindowHandles()?
String
List
Set
Map<String,String>
Correct Answer : Set
Question :Which statement about Thread.sleep() is TRUE?
Dynamic wait
Conditional wait
Static wait
Polling wait
Correct Answer : Static wait
Question :Which belongs to Options?
navigate()
switchTo()
manage()
addCookie()
Correct Answer : addCookie()
Question :Correct screenshot syntax?
driver.capture()
driver.getScreenshot()
((TakesScreenshot)driver).getScreenshotAs(OutputType.FILE)
Screenshot.take()
Correct Answer : ((TakesScreenshot)driver).getScreenshotAs(OutputType.FILE)
Question :Which is INVALID XPath?
//input[@id='x']
//*[@class='a']
//input[@id='x' and]
//div[contains(@id,'a')]
Correct Answer : //input[@id='x' and]
Question :Which Selenium component supports parallel execution?
IDE
RC
Grid
WebDriver
Correct Answer : Grid
Question :Which method returns page title?
getPageTitle()
title()
getTitle()
pageTitle()
Correct Answer : getTitle()
Question :Which command closes all browser windows?
close()
quit()
end()
stop()
Correct Answer : quit()
Question :Which is NOT Selenium exception?
TimeoutException
NoSuchFrameException
StaleElementReferenceException
ElementNotFoundException
Correct Answer : ElementNotFoundException
Question :Which command is NOT valid in Selenium IDE?
click
type
open
navigate
Correct Answer : navigate
Question :Return type of getCssValue()?
int
boolean
String
Object
Correct Answer : String
Question :Which locator supports contains()?
CSS
ID
Name
XPath
Correct Answer : XPath
Question :Which method switches to main page from iframe?
parentFrame()
switchMain()
defaultContent()
home()
Correct Answer : defaultContent()
Question :Which interface enables screenshots?
WebDriver
TakesScreenshot
Screenshot
Capture
Correct Answer : TakesScreenshot
Question :Which is TRUE about Implicit + Explicit waits together?
They add up
Explicit overrides
Implicit overrides
Unpredictable behavior
Correct Answer : Unpredictable behavior
Question :Which class is used for mouse actions?
Robot
EventFiringWebDriver
Actions
Mouse
Correct Answer : Actions
Question :Which method is NOT in Actions?
doubleClick()
contextClick()
dragAndDrop()
mouseHover()
Correct Answer : mouseHover()
Question :Which returns current URL?
getUrl()
getCurrentUrl()
currentUrl()
getURL()
Correct Answer : getCurrentUrl()
Question :Which wait supports polling interval?
Implicit
Explicit
Fluent
Thread.sleep()
Correct Answer : Fluent
Question :Which Selenium 4 feature is NEW?
Grid
IDE
Relative Locators
XPath
Correct Answer : Relative Locators
Question :Which method belongs to Navigation?
get()
back()
open()
switchTo()
Correct Answer : back()
Question :Which returns WebElement?
findElements()
findElement()
getElements()
locate()
Correct Answer : findElement()
Question :Which is fastest locator?
XPath
Name
CSS
ID
Correct Answer : ID
Question :Which exception when alert not present?
NoSuchElementException
NoAlertPresentException
TimeoutException
AlertNotFoundException
Correct Answer : NoAlertPresentException
Question :Which is NOT Selenium component?
IDE
WebDriver
Grid
JUnit
Correct Answer : JUnit
Question :Which IDE command has two parameters?
open
click
type
assertTitle
Correct Answer : type
Question :Which method checks visibility?
isEnabled()
isSelected()
isDisplayed()
isPresent()
Correct Answer : isDisplayed()
Question :Which call compiles but fails at runtime?
driver.getTitle()
driver.navigate().back()
driver.findElement(By.id("x"))
driver.getCurrentUrl()
Correct Answer : driver.findElement(By.id("x"))
Question :Which locator is dynamic-friendly?
ID
Name
XPath
LinkText
Correct Answer : XPath
Question :Which Grid component executes tests?
Hub
Node
Client
Server
Correct Answer : Node
Question :Which Selenium version removed RC?
Selenium 2
Selenium 3
Selenium 4
Selenium 1
Correct Answer : Selenium 3
Question :Which method clears input field?
delete()
remove()
clear()
reset()
Correct Answer : clear()
Question :Which is NOT valid CSS selector?
#id
.class
tagname
//input[@id='x']
Correct Answer : //input[@id='x']
Question :Which method submits form?
send()
clickSubmit()
submit()
post()
Correct Answer : submit()
Question :Which exception is unchecked?
IOException
SQLException
NoSuchElementException
InterruptedException
Correct Answer : NoSuchElementException
Question :Which method sets browser size?
resize()
setSize()
manage().window().setSize()
windowSize()
Correct Answer : manage().window().setSize()
Question :Which returns dimension?
getLocation()
getSize()
getRect()
getDimension()
Correct Answer : getSize()
Question :Which command maximizes browser?
fullscreen()
manage().window().maximize()
maximize()
setMax()
Correct Answer : manage().window().maximize()