Sunday, 19 April 2015

Selenium Quiz - 1

Question 1
What are the external files which will be required to develop Keyword driven framework?
A
TestNG
B
JXL/POI
C
JUnit TestNG
D
Plugin for eclipse
E
All of the above

Question 2
What is the purpose of TestNG component in Keyword driven framework?
A
In order to data drive our test
B
In order to read excel file
C
Requires to verify conditions
D
None of the above

Question 3
JXL/POI jar files are required to ________.
A
Requires to verify conditions
B
In order to use Microsoft Excel files as data source
C
In order to data drive our test
D
All of the above

Question 4
How to create an instance of WebDriver?
A
WebDriver driver = FirefoxDriver();
B
WebDriver = new FirefoxDriver();
C
WebDriver driver = CreateObject FirefoxDriver();
D
WebDriver driver = new FirefoxDriver();

Question 5
How to navigate to the ITeLearn home page?
A
Webdriver.get("http://www.itelearn.com");
B
driver.navigate("http://www.itelearn.com");
C
driver.get("http://www.itelearn.com");
D
None of the above

Question 6
How to find an element by Name?
A
WebElement searchBox = driver.findElement(By.name("someElement"));
B
WebElement searchBox = findElement(By.name("someElement"));
C
WebElement searchBox = driver.findElement(name("someElement"));
D
All of the above


Question 7
Display the title of the page _________.
A
System.out.println("Title: " + driver.Title());
B
System.out.println("Title: " + driver.getTitle());
C
System.out.println("Title: " + getTitle());
D
None of the above

Question 8
Does Selenium supports regular expression?
A
Yes
B
No

uestion 9
________ statement matches links such as 'Over $75', 'Over $85' etc
A
selenium.click("link=^Over \\$[0-9]+$");
B
selenium.click("link=regexpi:^Over \\$+$");
C
selenium.click("link=regexpi:Over \\$[0-9]+$");
D
selenium.click("link=regexpi:^Over \\$[0-9]+$");

Question 10
_________ statement clicks on the first image that has an id attribute that starts with 'cat_prod_image'.
A
selenium.click("//img[(@id,'cat_prod_image')]");
B
selenium.click("[starts-with(@id,'cat_prod_image')]");
C
selenium.click("//img[starts-with(@id,'cat_prod_image')]");
D
None of the above


1. Question
Does Selenium supports Data Driven Framework ?
1.                   1.  No
2.       2.  Yes
3.       3.  Only supports Modular framework
4.       4.  Only supports Keyword driven framework
2. Question
The annotation ______ identifies that a method is a test method.
1.                   1.  @Test
2.       2.  @Before
3.       3.  @Ignore
4.       4.  @After
3. Question
_______ will execute the method before each test.
1.                   1.  @After
2.       2.  @Before
3.       3.  @Test
4.       4.  @AfterClass
4. Question
In WebDriver, which command can be used to enter values onto text boxes? Select the best answer
1.                   1.  type()
2.       2.  sendKeys("text")
3.       3.  sendKeys()
4.       4.  driver.type()
5. Question
Selenium IDE is supported by which browser?
1.                   1.  Google Chrome
2.       2.  Mozilla Firefox
3.       3.  Internet Explorer
4.       4.  All Of Above
5.       5.  Safari
6. Question
Which selenium command check whether specific text exists somewhere on the page?
1.                   1.  verifyTextPresent
2.       2.  CheckTextPresent
3.       3.  None of these
4.       4.  verifyPresentText
7. Question
Which WebDriver method is used to change focus to an alert, a frame or a browser window?
1.                   1.  setFocus()
2.       2.  switchTo()
3.       3.  changeFocus()
4.       4.  changeTo()
8. Question
In Data Driven Framework, can you access data from database?
1.                   1.  Yes
2.       2.  No
3.       3.  May be
4.       4.  All of the Above
9. Question
In webdriver, what is the method that counts the number of elements?
1.                   1.  driver.findElements(By.id("search")).size()
2.       2.  driver.findElement(By.id("search")).getCount()
3.       3.  driver.getCountOfElements()
4.       4.  driver.findElements(By.id("search")).length()
10. Question
Selenium variables are stored in _____________.
1.                   1.  storedVariables
2.       2.  VariablesStore
3.       3.  storedVars
4.       4.  None of the above



How to create array in Java for primitive data types?
§  1.  myarr=new int[3];
§  2.  int[] myarr=int[3];
§  3.  None of the above
§  4.  int[] myarr=new int[3];
Consider the following html snippet
<ul>
<li>Firefox</li>
<li>Google Chrome</li>
<li>Internet Explorer</li>
<li>Opera</li>
<li>Safari</li>
</ul>
Which CSS selector is a valid statement to select Opera?
§  1.  css = ul > li:nth-of-type(4)
§  2.  css = ul > li:nth-of-type(3)
§  3.  css = ul.li:nth-child(4)
§  4.  css = li.contains("Opera")
§  5.  css = ul.li(4)
_______ Statement is used to close excel automation object. If myxl object is already created.
§  1.  Close()
§  2.  myxl.close
§  3.  myxl.close()
§  4.  None of the above
In WebDriver, which command can be used to enter values onto text boxes? Select the best answer
§  1.  type()
§  2.  driver.type()
§  3.  sendKeys("text")
§  4.  sendKeys()
§  5.  selenium.type()
_______ will execute the method before each test.
§  1.  @Test
§  2.  @Before
§  3.  @AfterClass
§  4.  @After
Selenium IDE is supported by which browser?
§  1.  Mozilla Firefox
§  2.  Safari
§  3.  Internet Explorer
§  4.  Google Chrome
§  5.  All Of Above
In webdriver, selectAllOptions() is a valid command.
§  1.  False
§  2.  True
What is the basic approach of Data Driven Framework?
§  1.  Code and Data as a separate units
§  2.  None of the above
§  3.  Code and Data as a single unit
Data Driven Framework used for only one set of Test Data.
§  1.  TRUE
§  2.  FALSE
Array subscripts start with the _____ in java.
§  1.  -1
§  2.  1
§  3.  2
§  4.  0
In webdriver, which command takes you forward by one page on the browser’s history?
§  1.  Navigate.forward
§  2.  Navigate.forward()
§  3.  navigate.forward()
§  4.  navigate().forward()
§  5.  navigate_forward()
In webdriver, which of the following commands retrieves the text of a html element?
§  1.  getElementText()
§  2.  selectText()
§  3.  getText()
§  4.  getText(element)
In _______ approach tests can be executed multiple sets of test data.
§  1.  Modular Framework
§  2.  Data Driven Framework
§  3.  Hybrid Framework
§  4.  Keyword Driven Framework
Does Selenium supports Data Driven Framework ?
§  1.  None of the above
§  2.  Yes
§  3.  Only supports Keyword driven framework
§  4.  Only supports Modular framework
§  5.  No
Which WebDriver method is used to change focus to an alert, a frame or a browser window?
§  1.  changeFocus()
§  2.  switchTo()
§  3.  setFocus()
§  4.  changeTo()
Does Data Driven Framework supports parallel execution of scripts?
§  1.  Yes
§  2.  No
What is the output of the following statement?
<div>
<span id=”name”>Name 1</span>
<span>Name 2</span>
</div>
driver.findElement(By.cssSelector("#name"));
§  1.  Output is Name 1
§  2.  Output is Name 2
§  3.  CSS selector syntax is incorrect
In webdriver, what is the method that counts the number of elements?
§  1. driver.findElement(By.id("search")).getCount()
§  2.  driver.getCountOfElements()
§  3.  driver.findElements(By.id("search")).length()
§  4.  driver.findElements(By.id("search")).size()
_______ will execute the method once, after all tests have finished.
§  1.  @AfterClass
§  2.  @BeforeClass
§  3.  @After
§  4.  @Ignore
_______ will execute the method once, before the start of all tests.
§  1.  @Before
§  2.  @BeforeClass
§  3.  @Test
§  4.  @After
The annotation ______ identifies that a method is a test method.
§  1.  @Test
§  2.  @After
§  3.  @Before
§  4.  @Ignore
“HSSFCell cell = row.getcell(j) This statement will give provided cell data”
§  1.  FALSE
§  2.  TRUE
§  3.  Syntax not correct
§  4.  None of the above
Implicit wait time is applied to all elements in your script and Explicit wait time is applied only for particular specified element.
§  1.  False
§  2.  True
In Data Driven Framework, data can be only accessed from excel.
§  1.  TRUE
§  2.  FALSE
In webdriver, which of the following is a valid select statement that selects a value from a drop down element?
§  1.  selectByVisibleText()
§  2.  selectByValue()
§  3.  selectByIndex()
§  4.  all above
§  5.  none of above
In webdriver, deselectAll() is a valid command
§  1.  True
§  2.  False
onsider the following HTML code snippet
<table>
<tr>
<td>1</td>
<td>2</td>
</tr>
<tr>
<td>3</td>
<td>4</td>
</tr>
</table>
driver.findElement(By.xpath("//table/tr[1]/td")).getText();
§  1.  The above statement returns 1
§  2.  The xpath query is incorrect
§  3.  The above statement returns 3
§  4.  webdriver statement is incorrect
Consider the following code snippet
WebDriverWait wait = new WebDriverWait(driver, 30); wait.until(ExpectedConditions.presenceOfElementLocated(by));
This is an example of an implicit wait.
§  1.  False
§  2.  True
_______ will execute the method after each test.
§  1.  @Test
§  2.  @Before
§  3.  @AfterClass
§  4.  @After
The following codes both print: Welcome to TestingExcellence.com
<html>
<head>
<title>Welcome to TestingExcellence.com</title>
</head>
<body>
</body>
</html>
System.out.println(driver.getTitle());
System.out.println(driver.findElement(By.tagName("title")).getText()
§  1.  False
§  2.  True
@Test(timeout=100), what is the significance of this statement?
§  1.  Pass, if the method takes longer than 100 miliseconds
§  2.  Same as @Test
§  3.  Fails, if the method takes longer than 100 miliseconds
§  4.  None of the above
In webdriver, which method closes the open browser?

§  1.  terminate()
§  2.  quit()
§  3.  shutdown()
§  4.  close()
Find out the correct option to open a excel file for read.
§  1.  FileInputStream stream = new FileInputStream(myxl)
§  2.  "File myxl = new File () FileInputStream stream = new FileInputStream(myxl)"
§  3.  FileInputStream stream = FileInputStream(myxl)
§  4.  None of the above
In webdriver, which methods navigates to a URL?

§  1.  getUrl("url")
§  2.  get("url")
§  3.  goToUrl("url")
§  4.  navigate.to("url")
Function libraries concept can not be implemented in Data Driven Framework. Is it right?
§  1.  Yes
§  2.  May be
§  3.  Both (1) and (2)
§  4.  All of the Above
§  5.  No
Which statement is correct to create excel automation object using POI excel API?
§  1.  File myxl = File ()
§  2.  File myxl == new File ()
§  3.  myxl = new File ()
§  4.  File myxl = new File ()
How to create new excel file?
§  1.  "HSSFWorkbook workbook = new HSSFWorkbook(); HSSFSheet sheet = workbook.createSheet(""Sample sheet"");"
§  2.  "HSSFWorkbook workbook = new HSSFWorkbook(); sheet = workbook.createSheet(""Sample sheet"");"
§  3.  """HSSFWorkbook workbook = new HSSFWorkbook(); HSSFSheet sheet = createSheet(""""Sample sheet"""");"""
§  4.  All of the above
In Data Driven Framework, can you access data from database?
§  1.  May be
§  2.  No
§  3.  Yes
§  4.  All of the Above


No comments:

Post a Comment