Review 40 CSE practice questions with answer explanations and community insights.
Question 1
ExpectedCondition interface in WebDriver is compatible with which of the following waiting options?
Explicit Wait.
Thread.sleep of 10 seconds.
Thread.sleep for >= 20 seconds.
Implicit Wait.
Question 2
Which of the following statements is FALSE about Selenium?
XPaths cannot be used in finding nested elements.
For a complex webpage, one can simplify automation, using nested element finding.
CSS Selectors can be used in finding nested elements.
Nested element finding uses XPaths that are relative to the parent element rather than root of HTML page.
Question 3
How do we get the HTML of a webpage in Selenium? (Assume driver as a WebDriver object.)
driver.getPageSource
driver.getHtml
driver.get
driver.getDom
Question 4
Which of the following is the PREFERABLE locator strategy, assuming all of them work for a given web element?
ID.
CSS Selector.
Class Name.
XPath.
Question 5
What is the outcome of the following Java code snippet for Selenium? (Assume that userName is a text box WebElement and driver is a WebDriver object.)JavaScriptExecutor js = (JavaScriptExecutor) driver;js.executeScript(“arguments[0].value=‘test’”, userName);
Value of userName text field is set to ‘test’.
Value of userName text field remains unchanged.
An exception is thrown.
Value of userName text field is matched with ‘test’.
We are moving to a new platform
CertificationTest is being migrated. Some pages may be slow or briefly unavailable; everything will be back to normal within a few hours. If you run into any issue, email support@certificationtest.net.