Got Some objective type questions in an exam of selenium


1. How many nodes can be connected to a hub?
a. 5
b. 10
c. 30
d. As many as you want

2. Which one is correct for priority in TestNG?
a. Priority is considered at entire suite level.
b. Priority is not considered if tests are run in parallel.
c. Priority is considered at the test name or class name something level only.
d. All of the above

3. What will be the output if following code is executed?
Actions action=new actions(Webdriver);
WebElement we=driver.findElement.By.xpath(“some xpath”);
a.moveToElement(we).moveToElement(driver.findElement.By.xpath(“some xpath”)).click().build().perform();

a. Mouse hover on the element
b. It will change the position of the element
c. It will move to another element – don’t remember exactly
d. It will fix the position of the element – something like this

4. Which one or ONES are the correct methods for drag and drop?
Actions act =new Actions(WebDriver);
WebElement src=driver.findElement.By.xpath(“some xpath”);
WebElement dest=driver.findElement.By.xpath(“some xpath”);

a. act.dragAndDrop(src,dest).build.perform();
b. act.clickAndHold(src).moveToElement(dest).build().perform();
d. one more, I guess all of the above , don’t remember

5. Which one or ONES are the most suitable way to delete cookies?
a. deleteCookieNamed(“cookie”)
b. deleteCookie(“cookieid”)
c. deleteAllCookies
d. one more don’t remember

6. Which one or ONES are correct for getWindowHandles
a. It will get all the windows which are currently opened,
b. It can have duplicate values
c. It cannot have duplicate values
d. Something – don’t remember

7. Which one or ONES are correct for following code:
Alert alert=driver.switchTo().alerts();
Alert alert=driver.switchTo().Alert();
a. It will return the alert which is currently opened
b. It will move to another alert – don’t remember
c. Something
d. Something

8. What will be the output of following code:
Value = 5/0 or value = [5]/[0]
If(divisionByZeroException.handled) e
Catch exception e)
Print (“exception\n”)
Print(“no exception\n”)
Print(“total exception\n”)

a. Exception
Total Exception
b. Exception
No exception
Total Exception
c. It will give runtime error
d. Compilation error

9. Below is the html code

Which one or ONES is the correct xpath for this
a. //body/abc/button
b. //button
c. //body/abc/div[2]/button
d. Something

10. Which wait is at the driver level?
a. Implicit wait only
b. Explicit wait
c. Something
d. Something

11. What will the outcome of this code
Something Wait (-10, SECONDS)
a. It will wait for 10 second.
b. Script will execute for the asynchronous items – something
c. Script will execute for the synchronous items – something
d. Something

12. Which one is correct to find if the element is visible and clickable?
a. a.visible_on_the_element.visible()
b. a.element_to_be_clicked.clickable()
c. a.element_to_be_something
d. a.element_to_be_something

13. How can we find hidden elements in selenium
a. It cannot be found
b. Using JavascriptExecutor
c. Something
d. Something

14. What is the default time for Waitfor() command in java?
a. 5
b. 10
c. 15
d. 30
15. When will the exception occur for following:
AssertTitle(Expected title, Actual title);
a. If Expected title does not match with actual title.
b. If Expected title matches with actual title.
c. If expected title is not null and actual is null.
d. If actual title is not null and expected is null.

Add Comment
  • 0 Answer(s)
  • Your Answer

    By posting your answer, you agree to the privacy policy and terms of service.