Wednesday 4 September 2013

SeleniumQuestions..


  1. Which of these WebDriver interface methods is used to open a URL in the browser?
    A)get
    b)navigate().to
    c)Any of the above
    d)None of the above
    ans c
  2. What is the difference between WebDriver close and quit methods?
    a)Nothing, these methods are interchangeable.
    b)close method clears the browser memory and the quit method closes the browser window.
    c)close method closes the browser but the quit method additionally removes the connection to the server.
    d)close method closes the main browser window but the quit method closes all the browser windows including popups.
    Ans :d


  1. When invoked on a web element, what does the submit method do?
a)It is used to submit a form and it works on any web element.
b)It is used to submit a form but it works only on the web element whose type is "submit".
c)It is the same as the click method.
d)There is no submit method for a web element.
Ans:a
4. Which WebDriver method is used to change focus to an alert, a web element or a browser window?
a)changeFocus
b)switchTo
c)goTo
d)setFocus
Ans:b
5 . What functionality does WebDriver support on browser cookies?
a)add and delete an individual cookie
b)delete all cookies
c)any of the above
d)none of the above
ans:c
6. What is the scope of an implicit wait?
a)All instances of WebDriver
b)Current WebDriver instance
c)Current expected condition
d)Current web element
ans:b
7. What kind of application is the Selenium IDE?
a)Windows application
b)Web application
c)Firefox add-on
d)None of these
ans:c

8. A Selenium IDE test case has three columns, Command, Target and Value. What data is stored in the Target column?
a)Element or location where the command is executed
b)Test step execution result
c)[Optional] purpose of the test step
d)None of these
ans: a
9. By default, in which format does the Selenium IDE save a test case?
a)In proprietary format
b)As HTML
c)As Java source code
d)As Ruby or Python or C# code depending on user options selected during installation
ans:b
9. What features are available in Selenium IDE to debug an automated test case?
a)Toggle Breakpoint
b)Pause/ Resume
c)Step
d)All of these
ans:d
10. What is the Selenium print command?
a)echo
b)print
c)alert
d)System.out.println()
ans: a
11. What is the difference between a command and the same command with "AndWait" (e.g. click and clickAndWait commands)?
a)Selenium waits indefinitely for the result of the "AndWait" command.
b)It waits for the result of the "AndWait" command but only for 30 seconds (default timeout).
c)It waits for the result of the "AndWait" command but only up to a maximum of 30 seconds (default timeout).
d)Some commands do not have an "AndWait" command, so this question is incorrect.
Ans: c
12. What is the correct syntax to access the value of a Selenium variable called name?
a)name
b)$name
c){name}
d)${name}
ans:d
13. What is the difference between assert and verify commands?
a)Assert commands are more uncommon than verify commands.
b)Typically, an assert command is followed by verify command(s).
c)A failed assert command stops the test but a failed verify command does not do so.
d)All of the above
ans: d
14. In which associative array does Selenium store all of a test case's variables and their respective values?
a)Array
b)storedVars
c)var
d)There is no such array in Selenium.
Ans b

15. Where can you create your own Selenium commands?
a)This is not possible.
b)In user-extensions.js file
c)In any JavaScript file, but the preferred name is user-extensions.js for consistency
d)In any Java, C#, Python, Ruby, PHP or Perl file
ans:c
16. What URLs does the Selenium open command allow?
a)Only the base URL
b)Any URL relative to the base URL
c)Any absolute URL
d)Any of the above
ans: d
17. What is the purpose of the Find button?
a)Highlight the element that is given in the locator
b)Search the appropriate command for the given target
c)Find the current value of the target
d)None of the above
ans:a
18. Which one of the following statements is incorrect?
a)Breakpoint and Start point cannot both exist on the same command.
b)The shortcut key for Breakpoint is B and for Start point is S.
c)A Breakpoint or a Start point cannot be put on a comment line.
d)Both Breakpoint and Start point are used in debugging the test case.
Ans:c

19. Which add-on is commonly used with Selenium IDE to identify individual elements on a web page?
a)FirePath
b)Firebug
c)XPath
d)No add-on is required. You can view the Page Source and locate any element within the HTML code easily.
Ans b(Firebug is the required add-on. FirePath is only a Firebug extension that shows XPath.)

20. Why are relative XPaths preferred over absolute XPaths as locators?
a)For non-root elements, absolute XPaths are longer and slow down the test automation.
b)Absolute XPaths fail if any part of the path changes even slightly.
c)Relative XPaths are the default in Selenium.
d)None of the above
ans: b

21. Which of the following is an incorrect target for pattern matching as in verifyTextPresent command?
a)glob:Customer*Subscriber
b)You entered the character, ?
c)regexp:[JFM]
d)exact:* Summary
ans:D(The exact pattern does not use any special character for patterns.)

22. What is the best way to handle asynchronous data retrieval from the server as in AJAX applications?
a)Run the test case at the slowest speed.
b)Use the pause command.
c)Use the "AndWait" commands.
d)Use the "waitFor" commands.
Ans:d

23. What happens when the application creates a JavaScript alert during test case play?
a)The alert is suppressed by Selenium..
b)If there is no command to handle the alert, the play is stopped with an error.
c)If the alert is handled with assertAlert, assertAlertPresent or verifyAlert, no alert is displayed and there is no error.
d)Each of the above
ans :D

24. What is data parameterization?
a)Using variable test data in place of fixed test data values
b)Using different number of test data values when executing the same test case
c)Putting pre-requisites for the test case to execute
d)Limiting the test case execution only when certain conditions exist
ans:a

25. Which of the following statements is correct for a Test Suite?
a)A Test Suite is a comma separated values file.
b)A Test Suite is an HTML file containing a table with a single column.
c)The test cases of a Test Suite must be placed in the same folder as the Test Suite.
d)A new Test Suite can have only new test cases.
Ans:b
26. What are the different modes that Selenium uses?
a)*iehta
b)*firefox and *iexplore
c)*chrome
d)All of the above
ans:d
27. How do you start the browser?
a)selenium.Start()
b)get start()
c)selenium.server start()
d)None of the above
ans :a
28. Do you need to have Selenium .jar files as a dependency of your tests?
a)Yes
b)No
c)Yes, but as a good practice only
d)No Selenium jar file is provided with Selenium RC.
Ans:a
29. How many parameters does the Selenium object take when using DefaultSelenium?
a)2
b)3
c)4
d)6
ans:c
30. How do you start selenium rc server with user extensions?
a)java -jar selenium-server.jar
b)java -jar selenium-server.jar -userExtensions user-extensions.js
c)java -jar selenium-server.jar user-extensions.js
d)java -jar selenium-server.jar user-extensions.js -h
ans:B

31. Which Selenium command do you use to run commands in slow motion in Selenium RC?
a)selenium.setSpeed()
b)selenium.speed()
c)selenium.serverSpeed()
d)None of the above
ans:a
32. Which command is used to get the alert box?
a)assertequals(selenium.getAlert())
b)selenium.getAlert()
c)selenium.alertBox()
d)selenium.click()
ans:b
33. Which command is used for verifying if a web element exists?
a)selenium.isElementPresent(String locator)
b)assertTrue(Selenium.isElementPresent())
c)selenium.ElementPresent()
d)None of the above
ans:a
34. Which command is used for typing in a textbox?
a)selenium.input()
b)selenium.type(String locator, String value)
c)assertequals(selenium.getValues())
d)selenium.textInput()
ans:b
35. What is the command to load a page?
a)selenium.waitForPageToLoad(String timeoutInMilliseconds)
d)selenium.waitForPageToLoadInt timeoutInMilliseconds
c)selenium.waitForPageToLoad(timeoutInMilliseconds)
d)selenium.waitForPageToLoad()
ans a



No comments:

Post a Comment