Question 1
Question
Identify the appropriate option to be used to ensure that the Selenium scripts stops if a check fails and doesnot run any subsequent checks.
i. Verify()
ii. Assert()
Answer
-
a. I and II
-
b. II
-
c. I
-
d. Neither I nor II
Question 2
Question
To run on Firefox browser, you must have which of the following?
Answer
-
a. FirefoxDriver is installed, similar to IEDriver and ChromeDriver Setup
-
b. Only Firefox browser is installed
-
c. Firefox plug-ins are installed
-
d. Both FirefoxDriver and Firefox browser are installed
Question 3
Question
Which of the following is the correct option to close all the opened browser sessions at one step?
Answer
-
a. driver.exit()
-
b. driver.quit()
-
c. driver.closeAll()
-
d. driver.close()
Question 4
Question
Which of the following is the best option for selenium to test an asynchronous webpage?
Answer
-
a. Sleep
-
b. Explicit Wait
-
c. Fluent Wait
-
d. Implicit Wait
Question 5
Question
Identify the correct command which “verifies an expected UI element, as defined by its HTML Tag and checks for its presence alone rather than its content.”
Answer
-
a. Verify Text
-
b. VerifyTextPresent
-
c. VerifyElementPresent
-
d. All the Listed option
Question 6
Question
6. Which of the Following functionality is NOT supported by Selenium IDE?
Question 7
Question
Firefox Driver is capable of being run and is tested on which of the following operating Systems?
Question 8
Question
Identify the Correct XPath for the Submit button
Answer
-
a. //div[(contains(@class ‘submit’))]
-
b. //div[contains(@class, ‘submit’)]
-
c. //div[@contains(class, ‘submit’)]
-
d. //div[contains(@class ‘submit’)]
Question 9
Question
In WebDriver, which of the following is valid select statement that selects a value from a drop down element?
Question 10
Question
Identify the correct code snippet to switch between different windows
Answer
-
a. driver.switchTo().window(Integer);
-
b. driver.switchTo().window(Array);
-
c. driver.switchTo().window(String);
-
d. driver.switchTo().window(ArrayList);
Question 11
Question
We generally use Listener to generate log events. Identify the correct selenium component that support listeners.
Question 12
Question
Which of the following is used to toggle a checkbox in a web form? Select One or More:
Answer
-
a. Element.set();
-
b. Element.click();
-
c. Element.toggle();
-
d. Element.Select();
Question 13
Question
13. Identify the correct code snippet which cannot refresh the webpage from the following options:
i. driver.get(driver.getCurrentURL());
ii. driver.navigate().to(driver.getCurrentURL());
iii. driver.findElement(By.xpath(“//h1[@class=’title’]”)).sendkeys(keys.F5);
iv. driver.open(driver. getCurrentURL());
Select One:
Answer
-
a. I and II
-
b. IV
-
c. III
-
d. I,II,III and IV
Question 14
Question
Which of the following is the correct “Webdriver” Command to “delete all cookies in the browser”?
Answer
-
a. driver.manage().deleteAllCookies();
-
b. driver. deleteCookies();
-
c. driver.deleteAllCookies();
-
d. driver.manage().deleteCookies();
Question 15
Question
Identify the correct statements about “Desired Capabilities” from the following. Select one or more
Answer
-
a. To execute multiple test cases on multiple systems with different browsers with different version and different operating System
-
b. Desired Capabilities class is used while working with Selenium Grid
-
c. Desired Capabilities class is used to handle page synchronization
-
d. All of the listed options
Question 16
Question
16. Which command should be used to ensure Selenium applies wait time of all UI elements in the scripts?
Answer
-
a. Sleep
-
b. Explicit Wait
-
c. Fluent Wait
-
d. Implicit Wait
Question 17
Question
Which of the following Selenium API enables running Selenium 1.0 test in Web driver?
Question 18
Question
Identify the appropriate Test Frameworks supported by Selenium Webdriver
Question 19
Question
How to retrieve Text from Alert pop up window?
Answer
-
a. Alert alert = driver.switchalert(); String alerttext = alert.getvalue(text);
-
b. Alert alert = driver.switchTo().alert; String alerttext = alert.getText(text);
-
c. Alert alert = driver.alert; String alerttext = alert.getText(text);
-
d. Alert alert = driver.switchalert; String alerttext = alert.getText(text);
Question 20
Question
20. Identify the correct code snippet to parameterize the Xpath:
“//*[@id=xxxxx]/a[2]/span/span[2]”. So that the “xxxxx” can be parameterize and the test can be executed with multiple test data
Answer
-
a. //*[@id=”+paraValue+”]/a[2]/span/span[2]
-
b. //*[starts-with(@id=”+paraValue+”)]/a[2]/span/span[2]
-
c. //*[contains(@id=”+paraValue+”)]/a[2]/span/span[2]
-
d. //*[@id=+”””+paraValue+”]”/a[2]/span/span[2]
Question 21
Question
21. Which of the following should be used to distribute tests on multiple machines, so that test can be run parallel to each other?
Answer
-
a. Selenium Webdriver
-
b. Selenium RC
-
c. Selenium IDE
-
d. Selenium Grid
Question 22
Question
22. Identify the correct code snippet to execute java script through Selenium webdriver
Answer
-
a. JavaScriptExecutor js = (JavaScriptExecutor)driver; String title = (string)js.executeScript(“Pass your Java Script”);
-
b. JavaScriptExecutor js = (JavaScriptExecutor)Webbrowser; String title = (string)js.executeScript(“Pass your Java Script”);
-
c. JavaScriptExecutor js = (JavaScriptExecutor)Webbrowser; String title = (string)js.execute(“Pass your Java Script”);
-
d. JavaScriptExecutor js = (JavaScriptExecutor)driver; String title = (string)js.execute (“Pass your Java Script”);
Question 23
Question
Identify the incorrect statement about “Implicit wait” from the following options:
Answer
-
a. An implicit wait is the code you define to wait for a certain condition to occur before proceeding further in the code
-
b. Once set, the implicit wait is the set for the life of the WebDriver object instance
-
c. To instruct WebDriver to poll the DOM for a certain amount of time when trying to find an element.
-
d. The default implicit wait setting is 0
Question 24
Question
Which of the following is the correct WebDriver statement to retrieve the row count of a table?
Answer
-
a. driver.findElements(By.xpath(“//table[@id=’tableD’]/tr”)).getrowcount();
-
b. All the Listed options
-
c. driver.findElements(By.xpath(“//table[@id=’tableD’]/tr”)).getcount();
-
d. Driver.findElements(By.xpath(“//table[@id=’tableD’]/tr”)).size();
Question 25
Question
25. Identify the correct code about the following code snippet:
MyClass c1,c2,c3;
C1 = new MyClass();
C3 = new MyClass();
Select One:
Answer
-
a. Only 3 objects are created c1,c2 and c3
-
b. Only 2 objects are created c1 and c3. The reference C2 is initialized
-
c. Only 2 objects are created c1 and c2. The reference C3 is only declared and not initialized
-
d. Only 2 objects are created c1 and c3. The reference C2 is only declared and not initialized
Question 26
Question
If you want to automate workflow that have to go through windows authentication dialog box, which additional libraries would you choose?
Question 27
Question
Identify the correct code snippet to double click an element using selenium, from the following:
Answer
-
a. WebElement el = driver.findElement(by.id(“ElementID”));Actions builder = new Actions(driver); builder.doubleclick(el).build();
-
b. WebElement el = driver.findElement(by.id(“ElementID”));Actions builder = new Actions(driver); builder.doubleclick().build().perform();
-
c. WebElement el = driver.findElement(by.id(“ElementID”));Actions builder = new Actions(driver); builder.doubleclick().build();
-
d. WebElement el = driver.findElement(by.id(“ElementID”));Actions builder = new Actions(driver); builder.doubleclick(el).build().perform();
Question 28
Question
Identify the incorrect URL related to Grid console, from the following
Answer
-
a. http://localhost.portno/console/grid
-
b. http://localhost.portno
-
c. http://localhost.portno/ grid
-
d. http://localhost.portno/grid/console
Question 29
Question
Identify the correct statement from the following
I. “Wait” is called an object, not a thread
II. “Sleep” sends the current thread into “not runnable” state for some time
Answer
-
a. I
-
b. I and II
-
c. II
-
d. Neither I nor II
Question 30
Question
Identify the steps to instantiate the chrome driver in correct sequence:
Answer
-
a. 1.Using System Property set method get the path of the Chrome Driver2.Set the Capabilities of the Chrome browser3.Open a URL4. Initialize chrome driver object with capabilities object as argument
-
b. 1.Using System Property set method get the path of the Chrome Driver2.Set the Capabilities of the Chrome browser3. Initialize chrome driver object with capabilities object as argument4.Open a URL
-
c. 1. Set the Capabilities of the Chrome browser2. Initialize chrome driver object with capabilities object as argument3. Using System Property set method get the path of the Chrome Driver4.Open a URL
-
d. 1.Using System Property set method get the path of the Chrome Driver2. Initialize chrome driver object with capabilities object as argument 3.Open a URL4. Set the Capabilities of the Chrome browser
Question 31
Question
Identify the command which is used to pause execution until the page is loaded completely
Answer
-
a. WaitForWindowToLoad
-
b. waitForPage
-
c. WaitForElementPresent
-
d. waitForPageToLoad
Question 32
Question
32. Which of the following is correct command to enter a value in a textbox?
Answer
-
a. None of the listed options
-
b. WebElement element = driver.findElement(By.name(“q”));element.sendkeys(“Cheese!”);
-
c. WebElement element = driver.findElement(By.name(“q”));element.setval(“Cheese!”);
-
d. WebElement element = driver.findElement(By.name(“q”));element.type(“Cheese!”);
Question 33
Question
What is the keyword used in Selenium for dealing with Regular Expressions?
Answer
-
a. RegularExp
-
b. RegEx
-
c. @regular
-
d. Regexp
Question 34
Question
Identify the correct statements about the code snippet given below:
Wait<WebDriver> wait = new FluentWait<WebDriver>(driver)
.withTimeouts(30, SECONDS)
.pollingEvery(30, SECONDS)
WebElement foo = wait.until(new function<WebDriver,WebElement>()
{
Public WebElement apply (WebDriver, driver)
{
Return driver.findElement(By.id(“foo”));
}
});
Select One or More
Answer
-
a. NosuchElementException is ignored automatically
-
b. Checks for the object once every 5 seconds
-
c. A combination of fluent wait and Implicit wait
-
d. Additional step needed to ignore NosuchElementException
Question 35
Question
You are writing scripts for web application automation using Selenium WebDriver. When you try to close the browser you get a popup saying “Are You Sure? The page is asking you to confirm that you want to leave – data entered will be lost. “The page has two buttons, Leave page and stay on page. Which function from the Alert API needs to be called if leave page needs to be selected?
Answer
-
a. alert.accept();
-
b. alert.close();
-
c. alert.Submit();
-
d. alert.click(1);
Question 36
Question
A script requires that you open the home page url, right click on a link, choose a context menu item in New tab. Which method will be useful for this operation?
Answer
-
a. ARROW_DOWN and ENTER with sendkeys
-
b. CONTEXT_CLICK method in sendkeys
-
c. RIGHT_CLICK with sendkeys
-
d. SELECT_ITEM(n) in sendkeys
Question 37
Question
Which building a JAR, what is/are the role(s) of a manifest file? Select One Or More
Answer
-
a. Setting an application’s entry point
-
b. Sealing packages within a JAR File
-
c. Enhancing security with manifest attributes
-
d. Setting package version information
Question 38
Question
Exception handling is targeted at:
Answer
-
a. Compile time error
-
b. logical error
-
c. Run time error
-
d. logging error
Question 39
Question
What is the method to simulate the right click event on an element in the application under test using C#.Net implentation?
Answer
-
a. ContextClick method
-
b. KeyPress method
-
c. Rightclick method
-
d. Keydown method
Question 40
Question
An application developed needs to be checked in multiple browsers for compatibility. Which annotation would you use in TestNG to achieve this in parallel, and save time?
Answer
-
a. @BeforeTest
-
b. @Test
-
c. @BeforeSuite
-
d. @Parameters
Question 41
Question
Which is the folder in which default test reports are created by TestNG?
Answer
-
a. Test-output
-
b. Testoutput
-
c. Testout
-
d. TestNG-Testoutput
Question 42
Question
Which of the following Junit is recommended to declare the implicit wait statement?
Question 43
Question
Which of the following Junit annotation do we declare the command “driver.quit”
Answer
-
a. “@Test”
-
b. “@Before”
-
c. “@try”
-
d. “@After”
Question 44
Question
What happens when the application creates a Java Script alert during test case paly?
Question 45
Question
What should be used in Selenium to wait for some conditions such as “ElementsToBeClickable”
Answer
-
a. Sleep
-
b. Explicit Wait
-
c. Implicit Wait
-
d. Fluent Wait
Question 46
Question
The client environment has multiple operating system implementations and regression testing has to be done on all of them.What tool would you use for this scenario?
Answer
-
a. Selenium RC
-
b. Selenium Grid
-
c. SeleniumIDE
-
d. WebDriver
Question 47
Question
Which statement used to make selenium script to wait for page loading?
Answer
-
a. Elementstobepresent
-
b. PagetoLoad
-
c. PageExist
Question 48
Question
Which statement used to verify element is present rather than verifying its content
Answer
-
a. ElementToBePresent
-
b. TextToBePresent
-
c. VerifyText