Q91
Q91 How do you skip a test case conditionally in TestNG?
@Ignore
skipTest()
throw SkipException()
ignoreTest()
Q92
Q92 A TestNG test case runs even though it should be skipped. What is likely missing?
@BeforeClass
SkipException
@Test(enabled=false)
@BeforeTest
Q93
Q93 A test with multiple dependencies fails. What can be used to manage test order in TestNG?
@AfterTest
dependsOnMethods
@TestGroup
SequentialExecution
Q94
Q94 What is the main purpose of the Page Object Model (POM) design pattern?
To store data in pages
To centralize web elements and methods
To handle web services
To improve test data management
Q95
Q95 How does POM improve test maintenance?
By reducing the number of test cases
By consolidating element locators
By adding extra code
By enabling faster execution
Q96
Q96 In POM, where are the page elements and actions defined?
Directly in the test script
In a separate Page class
In the test configuration file
In the data source file
Q97
Q97 What is a disadvantage of using POM for small test suites?
It increases execution time
It adds complexity and overhead
It uses more test data
It requires more storage
Q98
Q98 How would you initialize a Page Object class in Selenium?
new Page(driver)
driver.getPage()
driver.load(Page.class)
Page page = new Page(driver)
Q99
Q99 In POM, which annotation is used in Selenium to initialize WebElements?
@DataProvider
@FindBy
@Test
@Locator
Q100
Q100 How do you use the PageFactory in Selenium POM?
PageFactory.load()
PageFactory.initElements(driver, pageClass)
Page.load(driver)
driver.init(pageClass)
Q101
Q101 A test script fails to interact with elements in a POM class. What could be the issue?
Incorrect URL
Page not initialized
Wrong test order
Low network speed
Q102
Q102 A test fails due to a "NullPointerException" in a POM class. What is a likely solution?
Set an Implicit Wait
Initialize the Page Object class
Restart WebDriver
Disable page caching
Q103
Q103 What is the primary purpose of Selenium Grid?
To execute tests on mobile applications
To enable parallel testing on multiple machines
To run tests on a single browser
To create test data
Q104
Q104 Which component acts as the central server in a Selenium Grid setup?
Node
Client
Hub
WebDriver
Q105
Q105 What is a "Node" in Selenium Grid?
A central server
A connected machine to execute tests
A test data storage location
A WebDriver configuration
Q106
Q106 Which file format is used to configure nodes in a Dockerized Selenium Grid setup?
.xml
.properties
.json
.yml
Q107
Q107 How do you specify a remote URL for the WebDriver in Selenium Grid?
driver.remote(url)
new RemoteWebDriver(url, capabilities)
driver.startRemote()
new WebDriver(url)
Q108
Q108 Which capability is required to specify the browser type in a Selenium Grid test?
browserName
platform
version
nodeName
Q109
Q109 How do you limit the number of concurrent sessions in a Selenium Grid node configuration?
Set maxSessions parameter
Use maxNodes parameter
Configure in hub
Limit browser count
Q110
Q110 A Selenium Grid test fails with a "SessionNotCreatedException." What could be a likely cause?
Incorrect URL
Unsupported browser version
Invalid test case
Hub is down
Q111
Q111 A node fails to register with the hub in Selenium Grid. What should you check?
Verify the test case
Ensure network connectivity
Test browser compatibility
Run without Grid
Q112
Q112 Which method is used to switch to an alert in Selenium WebDriver?
driver.switchTo().frame()
driver.switchTo().window()
driver.switchTo().alert()
driver.getAlert()
Q113
Q113 Which method would you use to accept a browser alert in Selenium?
alert.dismiss()
alert.accept()
alert.confirm()
alert.click()
Q114
Q114 What does the driver.switchTo().frame(int index) method do in Selenium?
Closes a frame
Switches to a frame based on index
Switches to the parent window
Opens a new frame
Q115
Q115 In Selenium, which method is used to switch back to the main window from a frame?
switchTo().defaultContent()
switchTo().mainWindow()
switchTo().parentWindow()
switchTo().root()
Q116
Q116 How do you close the current window in Selenium WebDriver?
driver.quit()
driver.close()
driver.dismiss()
driver.switchTo().window()
Q117
Q117 How do you switch to a new window by its title in Selenium?
switchTo().title()
switchTo().window(title)
switchTo().alert(title)
switchTo().frame(title)
Q118
Q118 How do you dismiss a confirmation alert in Selenium WebDriver?
alert.accept()
alert.confirm()
alert.dismiss()
alert.ignore()
Q119
Q119 A Selenium test fails due to an "UnhandledAlertException." What is a likely cause?
Alert is already handled
Alert is ignored
An unexpected alert is present
WebDriver is not initialized
Q120
Q120 A test fails to switch to a frame. What could be a common cause?
The frame does not exist
The frame is hidden
The frame is minimized
WebDriver is outdated