MCQ 2 - Selenium - Main
MCQ 2 - Selenium - Main
MCQ 2 - Selenium - Main
10. Select the correct order of execution of annotations, as per the life
cycle of the TestNG which can be applied for test methods along
with beforeXXXX – afterXXXX methods. TCM
ANS - @BeforeTest, @BeforeClass, @BeforeMethod, @Test,
@AfterMethod, @AfterClass, @AfterTest
18. whithere are three frames in a web page, which method below is
used to comeback to main window before switching to any frame?
switchTo.defaultContent()
19. Which of the following methods will be used to handle an alert
dialog box?
alert.accept()
26. Sean is automating a test scenario in which he has to fetch the URL
of the webpage using webDriver API. Suggest a method for Sean to
get the link address.
getCurrentURL()
27. Which method is used in the Apache POI library to fetch the cell
value from a row? Identify the correct format of invoking the
library functions to get the value from the cell.
sheet.getRow(rowno).getcell(col no).getStringCellValue()
31. Which of the following is correct about generating XML suite file
in TestNG for Test Suite Execution?
TestNG XML Suite file can be generated at the time of creating a
TestNG class.
TestNG XML Suite file can be generated using ‘convert to
TestNG’ option in Eclipse after a java class is created.
34. When verification fails in TestNG, what forces the test to stop
execution and mark as Fail?
AssertionError
40. Identify the wait time method which is not the Selenium way to
handle synchronization in Test Automation.
Sleep()
41. Which of the following library is used for designing the test scripts
using the predefined classes, methods, and annotations?
TestNG Library
By.tagName()
By.partialLinkText()
(Explanation – SELENIUM Selectors - ID, Tag Name, Link Text,
Name, CSS Selector, Partial Link Text, Class Name, XPath)
45. List out the operating systems that are supported by Selenium.
Windows, Linux, Mac, android & iOS
46. Sean is filling a web form with his contact details like email, phone
number, and address while performing registration to an event. He
clicked on submit button without entering the phone number and a
pop-up window appeared saying "Contact Number is required".
Identify the correct way to handle such pop-up windows using
Selenium WebDriver.
driver.switchTo().alert()
47. Identify the child tags that are required to add inside dependency
tag in order to download the desired libraries/jar from the maven
central repository without any errors.
groupId
version
artifactId
51. Kevin wants to generate extensive report for the test automation
project. He decides to use Extent reports library. Which class in
this library is used to create labels, code blocks and labels in the
report? tables
Markup Helper
54. Which java Enum is used to handle the keyboard strokes from web
driver library? Choose the most appropriate option.
Keys
56. George is reviewing the quality of the Java code given to him using
SonarQube and identified that the variables are named without
following java variable naming convention rules. Under which
category this issue can be tracked in the tool? Choose the most
appropriate option.
Minor
57. Sam has created a TestNG project with below specified TestClass.
public class TestClass
{
@Test(priority=1)
public void method1() {….}
@Test
public void method3() {….}
@Test
public void method2() {….}
@Test(priority=2)
public void method4() {….}
}
Predict the test method execution sequence. Choose the most
appropriate option.
method2, method3, method1, method4
58. What method in the Web driver library is used to get the attribute
value of a web element? Choose the appropriate option.
getAttribute(“attributeName”)
61. Identify the correct flow of Jenkins build, when a maven project
job in Jenkins is triggered for build.
pom.xml >testing.xml- >testing classes>reports
62.Sarah has her code in git local repository, but her team lead had
pushed the new changes into the remote repository, which git
command would you recommend Sarah with new changes into her
working copy?
add pull
63. Mary is struggling to find a suitable simple wild cart character
that matches any single character. Please suggest to her which of
the following characters many be relevant to her search
(?) - single character search (*) - one or more
64. Sean configured his project for the test suite execution using
TestNG. He wants to perform parallel execution of the test cases.
Which attribute represents the parallel execution of the test cases?
parallel="tests"
66. Which of the following Java classes are from the Extent API
library? classes in api are:
ExtentReports extentsparkreporter ,extent reports,
Status extent test, extent color,
markuphelper, status,
67. Which date format is used to customize the system data to year-
month-day format?
new SimpleDateFormat(“yyyy-MM-dd”)
69. What are the various status options available in the Extent reports
library?
PASS,FAIL,SKIP,FATAL,ERROR,WARNING,INFO
70. Kevin wants to fetch all the data from the country drop down
menu and verify the data against data from the database. He is
looking into the library for a method to fetch all the data from the
country drop down box. Which method will help Kevin?
getOptions()
71. Samantha has to execute automation scripts across multiple
platforms like windows, mac, Linux which tool in the selenium suite
will be used by Samantha? Choose the most appropriate option.
selenium RC selenium grid
79. Sarah is coding an automation script, where she has to validate the
price of the holiday package based on the drag & drop of island city
from the menu. The price is fetched from the server and displays
without reloading the web page. Which WebDriver library class
has the predefined conditions for handling dynamic waits in
selenium WebDriver Library?
WebDriverWait Expected conditions
80. While using Soft Assertion in the Test Class, James must specify a
method, that will collate and display the assertion results.
assertAll()
88. Which method in the web driver library is used to get the attribute value of a web
element?
Ans: getAttribute(“AttributeName”)
90) Sarah as an automation engineer triggers a new build from Jenkins as a maven project
having source codes in git repository which of the following tools/ Software are required to be
configured by Sarah in Jenkins to make the build success.