Selenium Test
Selenium Test
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.
ANS - @BeforeTest, @BeforeClass, @BeforeMethod, @Test,
@AfterMethod, @AfterClass, @AfterTest
25. Sarah wants to automate the selection of only one option from a
drop-down box as shown below.
<html>
<body>
<select multiple>
<option value = “web”> html</option>
<option value = “prog”> python</option>
<option value = “prog”> java</option>
<option value = “prog”> python</option>
<option value = “prog”> java</option>
</select>
</body>
</html>
Sarah has to select only the fourth option i.e., python from the
option list .
selectByIndex()
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
35. Samantha wants to automate selection of value from a drop-down
menu. When the element was Inspected. She found:
<html>
<body>
<select name=”jobrole”>
<Option value=”1”>Manager</option >
<option value=”2”>Lead</option>
<option value=”3”>Analyst</option>
</select>
</body>
<html>
Choose “lead” as the test data. Assist her by choosing the correct
options.
selectByIndex(1);
selectByVisibleText(“Lead”)
selectByValue(“2”)
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
42. Sean is working on a Test Automation project; He is looking for
different strategies for identifying the elements/objects from the
web application using Selenium locators. Suggest Sean with the
available locators in Selenium.
By.id()
By.tagName()
By.partialLinkText()
(Explanation – SELENIUM Selectors - ID, Tag Name, Link Text,
Name, CSS Selector, Partial Link Text, Class Name, XPath)
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
48. Sarah is coding an automation script to switch to frame in a web
application. Help her to switch a particular frame on a web page
using the window library. She wants to interact with the pop-up
window and decline the confirmation pop up window show a
message “Do you want to cancel the payment?”. Assist Samantha to
interact with
Driver.SwitchTo().frame(int index)
Driver.SwitchTo().frame(String name or id)
Driver.switchto().frame(webelement frameelement)
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?
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
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?
ExtentReports
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()
80. 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
81. While using Soft Assertion in the Test Class, James must specify a
method, that will collate and display the assertion results.
assertAll()
1. Sean is coding to automate a web application using the webDriver library. He had set the implicit
wait of 30 seconds. However, the webelement was found within 10s. Will the webdriver wait for
further 20 seconds before executing the next line of code?
2. 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
3. Sarah is coding to automate script to switch to multiple windows in a web application. She has to
store all the window instances in a java variable which is retrived by driver.getWindowHandles().
Suggest sarah with a compatable return type to store the window references.
Ans:Set <string>
4. 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?
Ans: add
5. Sean is automating a test scenario in which he has to fetch the URL of the webpage using
webDriver API. Suggest a method fo Sean to get the link address
Ans: getCurrentURL()
6. 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
a TestNG XML Suite file can be generated at the time of creating a TestNG class. b TestNG XML
Suite file can be generated using ‘convert to TestNG’ option in Eclipse after a java class is
created.
c TestNG XML Suite file can be automatically generated when user creates a maven java project
a driver.get(“url”)
b driver.navigate().to(“URL”)
c driver.navigate(“URL”)
d driver.getUrl(“URL”)
e driver.setUrl(“URL”)
3) Sam is designing an automation test, where test data is specified in an external excel file. Which
command will be helpful to get across to the 2nd sheet of excel file. Assume wb is the workbook
object.
a wb.getSheetAt(1)
b wb.getSheetAt(2)
c wb.getSheet(1)
d wb.getSheet(2)
4)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?
a parallel = “methods”
b parallel="tests"
c parallel = “test-classes”
d parallel =”test-cases”
5) Kevin is designing an automation test, where test data is specified in an external excel file. Which
command will be helpful to write the data into a cell of the excel file? Assume c1 is the cell object.
a c1.setCellValue("data")
b c1.setValue(“data”)
c c1.writeCellValue(“data”)
d c1.setCellData(“data”)
6) Sarah wants to automate the selection of only one option from a drop-down box as shown
below.
<html>
<body>
<select multiple>
</select>
</body>
</html>
Sarah has to select only the fourth option i.e. python from the option list .
a selectByVisibleText()
b selectByValue()
c selectByIndex()
DDT
Sam is designing an automation test, where test data is specified in an external excel file. Which
command will be helpful to get access to the 2nd sheet of the excel file. Assume wb Is the workbook
object
wb.getSheetAt(1)
wb.getSheetAt(2)
wb.getSheet(1)
wb.getSheet(1)
EXTENT REPORTS
Which of the following Java classes are from the Extent API library?
ExtentReports
Status
TakesScreenshot
Actions
SWITCHING TO WINDOWS
Which of the following methods is used to close all the opened windows of WebDriver
Instance? Close()
Quit()
Null()
Sleep()
ACTIONS
Sean is coding an automation script for emulating user actions by mouse using the webdriver library.
Assist Sean to choose correct syntax to create an object for actions class from the following options
New Actions(driverInstance)
Actions.callMethods()
EXTENT REPORTS
Which date format is used to customize the system data to year-month-day format?
new SimpleDateFormat(“yyyy-mm-dd”)
new SimpleDateFormat(“yyyy-MM-dd”)
new SimpleDateFormat(“yyyy-month-dd”)
new SimpleDateFormat(“yyyy-mmm-dd”)
WEBDRIVER API
Fuller has written an automation script using selenium webdriver commands. He has used all the
necessary and appropriate locators for interacting with the web elements. When he executed the
script the web driver was not able to locate an element resulting in the test script failure. Which
error/ exception is thrown by webdriver?
NoSuchElementException
NoSuchElementError
NullPointerException
ObjectNotFoundException
WEBDRIVER API
Samantha wants to automate selection of value from a drop down menu. When the element was
Inspected. She foundAgain
<html>
<body>
<select name=”jobrole”>
<option value=”2”>Lead</option>
<option value=”3”>Analyst</option>
</select>
</body>
<html>
Choose “lead” as the test data. Assist her by choosing the correct
options. selectByIndex(1)
selectByValue(2)
selectByVisibleText(“Lead”)
selectByValue(“2”)
Q1- Which expression is used in CSS selectors to match the attribute value with a prefix?
Ans: ^
@Test(priority=1)
@Test
@Test
@Test(priority=2)
Ans: method2,method3,method1,method4
1. Which java enum is used to handle the keyboard strokes from webdriver library?
a. Actions
b. Keyboard
c. Keys
d. Keyword
2. Sam is designing an automation test, where test data is specified in an external excelfile.
Which command will be helpful to get access to the 2nd sheet of the excel file. Assume wb is
workbook object.
a. wb.getSheetAt(1)
b. wb.getSheetAt(2)
c. wb.getSheet(1)
d. wb.getSheet(2)
3. sarah wants to automate the selection of only one option from a drop down box as shown
below
<html>
<body>
<select multiple>
<option value=”web”>html</option>
<option value=”prog”>python</option>
<option value=”prog”>java</option>
<option value=”prog”>python</option>
<option value=”prog”>java</option>
</select>
</body>
</html>
Sarah has to select only the fourth option that is python from the options list
a. selectByVisibleText()
b. selectByValue ()
c. selectByIndex()
d. all the above
4. What are the various status options available in the Extent reports library?
a. PASS,FAIL,SKIP,FATAL,ERROR,WARNING,INFO
b. SUCCESS,FAIL,SKIP ,ERROR,WARNING,INFO
c. DONE,DEBUG,FAIL,SKIP,ERROR,WARNING,INFO
d. ABORT,PASS,FAIL,DONE,ERROR,WARNING,INFO
5. Sean is automating a test scenario, in which he has to fetch the URL of the web page using
WebDriver API . Suggest a method for Sean to get the link address.
a. getURL()
b. get()
c. getCurrentURL()
d. getURL()
6. 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?
a. selectAllOptions()
b. getOptions()
c. getAllOptions()
d. getData()
e. getText()
7. QUESTION NOT VISIBLE , multiple options
a. driver.get(“URL”)
b. driver.navigate().to(“URL”)
c. driver.navigate(“URL”)
d. driver.getUrl(“URL”)
e. driver.setUrl(“URL”)
f. Sarah is coding in a test scenario, in which she must fetch the booking id as a text
message from the span element.
The web element looks like
<Space> order completed with Booking id:6665<Space>
Help Sarah to find a method from the webdriver library to fetch the booking ID?
Ans - getText();
g. James is automating a script and using CSS Selector as a locator. What are the
primitive types for designing the CSS selector?
ANS - .id, .Attribute, .innerText()
(Explanation - There are 5 types of CSS Selectors in Selenium tests
ID, Class, Attribute, Sub-String, Inner Text)
h. Which expression is used in CSS Selectors to match the attribute value with a prefix?
ANS- ^=
(Explanation - [attr^=value] Represents elements with an attribute name of attr whose
value is prefixed (preceded) by value.)
k. Identify the correct way of launching the Chrome browser through WebDriver instance
with the correct property.
ANS -
System.setProperty("webdriver.chrome.driver","src/test/resources/chromedriver.exe
");
WebDriver driver = new ChromeDriver();
l. Samantha wants to write an automation script that determines the count of Hobbies
checkboxes. These checkboxes have a name attribute as “hobbies”. Assist Samantha
by choosing the correct command.
ANS –
driver.findElements(By.name(“hobbies”)).size()
m. Henry is designing a script and using CSS Selector as the locator strategy. He must
locate the element effectively. The element inspected looks like:
<input id=“newPassword” type=“password”>
ANS - By.cssSelector("input[id='newPassword']")
n. Kevin is automating a test scenario. In which he wants to locate an element with the
class attribute “classg1 jkyu_90”. Assist Kevin in setting up the correct locator for the
element.
ANS - By.className(“classg1”)
o. 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. ANS -
@BeforeTest, @BeforeClass, @BeforeMethod, @Test, @AfterMethod, @AfterClass, @AfterTest
p. Sean is coding an automation script for emulating user actions by mouse actions using
webdriver library. Assist Sean to choose the correct syntax to create an object for
Actions class from the following options.
ANS -
Actions act = new Actions(driverinstance)
Actions act = new Actions()
Actions act = (Actions)driverinstance
q. Kevin is using a CSS Selector as a locator strategy for the following element:
<h1 id=“msg01” name=“success”>Registration completed</h1>
He must identify the element effectively.
ANS –
By.cssSelector(“h1[id=‘msg01’]”)
By.cssSelector(“h1[id=‘msg01’][name=‘success’]”)
89. Which of the following reports can be generated using plugins from Cucumber
90. James wants to design a scenario in a feature file, in which the complete scenario runs multiple
times for different data sets . Suggest James with a Gherkin keyword to activate drop-down testing
in the feature file ?
91. Jack had created the feature file with the below mentioned scenarios as shown below:
@crash Scenario: This is the second scenario In test runner class, Jack mentioned
@cucumberoptions (tags=(“smoke”)) predict which scenario is/are gets executed
92.Which of the following is the logical container that contains all the elements which drive the
performance test?
Ans: Load Testing Correct But, If Test Plan Available in option, Then, the correct Ans will be Test
Plan.
95. Which of the following input documents is used to create test scenarios and conditions?
96. Which of the following Java classes are from the extent API library?
97. Sean is coding to automate a web application using the webDriver library. He had set the implicit
wait of 30 seconds. However, the webelement was found / Test Plan correct correct correct Google :
ExtentReports correct within 10s . Will the webdriver wait for further 20 seconds before executing
the next line of code?
1) Which java enum is used to handle the keyboard strokes from webdriver library?
(a) Actions
(b) Keyboard
(c) Keys
(d) Keyword
Ans: (b) keyboard
2) Which expression is used in CSS selectors to match attribute value with a prefix?
(a)$=
(b)^=
(c)*=
(d)none
Ans: (b) ^=
3) Samantha wants to automate selection of valur from a drop…..
<html>
<body>
<select name=”jobrole”>
<option value=”1”>Manager</option>
<option value=”2”>Lead</option>
<option value=”3”>Analyst</option>
</select>
</body>
</html>
Ans: SelectByVisibleText(“Lead”)
SelectByValue(“2)
4) Sarah is coding an automation script to switch to IFRAME in a web application .Which of the
listed options(s) will help sarah to switch to a particular frame on a web page using the
webdriver library?
(a )driver.switchTo().frame(int index)
(b) driver.switchTo().frame(string nameOrld)
( c) driver.switchTo().frame(WebElement frameElement)
(d)driver.switchTo().frame()
(e) driver.switchTo().frame(String name)
ANS: (a) , (b), (c)
(a)ppt
(b)docs
(c)…
(d)…
@beforeMethod
Public void method1() {…}
@afterMethod
@Test(dataProvider=”loginData”)
@data provider
****7) which method is used in apache poi library to fetch the cell value from a row? identify the
format of invoking the library functions to get value from a cell
(a)sheet.getStringCellValue()
(b) sheet.get(rowno).getstringCellvalue()
(d) sheet.get(rowno).getCell(colon).getstringCellvalue()
Ans : (c)
1. 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.
Ans selenium RC
2. George is reviewing the quality of the java code given to him using SonarQube and
described that the variables are named without following java variables naming
convention. Under which category this issue can be tracked in the tool?
Choose the most appropriate option.
Ans minor
3. Identify the correct flow of jenkins build, when a maven project job in Jenkins is triggered
for build
Ans testing.xml->pom.xml>testing classes>reports
4. Sarah is coding to automate a scenario for the selection of the “from Cities” drop down
box on the flight booking application web page, which class is used?
Ans Select Class
5. Sarah is coding in a test scenario, in which she must fetch the booking id as a text message
from the span element The web element looks like <Space> order completed with Booking
id:6665<Space> Help Sarah to find a method from the webdriver library to fetch the
booking ID?
Ans get Text();
6. Which expression is used in CSS Selectors to match the attribute value with a prefix?
Ans ^=
1. Samantha has designed a TestClass with the following methods:
@BeforeMethod
@AfterMethod
@Test(dataProvider=”loginData”)
@DataProvider
Suppose loginData() generates 5 sets of login credentials, how many times method1, method2 and
method 3 would be executed ?
2. Sarah is coding an automation script to switch to iFRAME in a web application. Which of the listed
options will help Sarah to switch to a particular frame on a web page using the webdriver library?
Choose the appropriate options.
a) driver.switchTo().frame(int index)
b) driver.switchTo().frame(String name Or id)
c) driver.switchTo().frame(WebElement frameElement)
d) driver.switchTo().frame()
e) driver.switchTo().iframe(String name)
3. Sean is coding to automate mouse interactions on a web browser. Assist Sean to identify the mouse
event specific methods from the below options.
a) moveToElement()
b) moveByOffset()
c) release()
d) keyUp()
e) keyDown()
f) sendKeys()
4. What method in the Web driver library is used to get the attribute value of a web element?
a) getAttributeValue(“attributeName”)
b) getAttribute(“attributeName”)
c) getValue(“attributeName”)
d) getText()
6. Sarah is coding to automate a test scenario in which she must fetch the booking id as a text
message from the span element.
The web element looks like: <span>Order Completed With Booking
ID:6665</span> Help Sarah to find a method from the WebDriver Library to fetch
the Booking ID.
a) getValue()
b) getID()
c) getText()
d) getTagName()
7. 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.
a) Info
b) Minor
c) Major
d) Critical
e) 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.
Ans: jre , jdk ,meavon
f) Henry is designing a script and using css selector as the locator strategy. He must locate
the element effectively. The element inspected looks like
<input id =”new Password” type =”password”>
Choose the most appropriate option.
ans: By.CssSelector(“input[id=’password’]”)
g) There is an element on the web page when inspected on the browser it looks like
<div class=”errorMsg”>Error Message</div> James want to use selenium locators to
identify the element. Choose the correct set of commands to locate the element
effectively.
Ans: By.CssSelector(“div.errorMsg”)
h) Match the following tools with the correct description
(a) String
(b) WebDriver
(c) WebElement
(d) List
Sub-topic: TestNG
2) Which of the following is correct about generating about an XML suite file in TestNG for Test
Suite Exception.
(a) TestNG XML suite can be generated at time of creating TestNG class.
(b) TestNG XML suite can be generated using "Convert to testNG" option..........class is
created.
(c) TestNG XML suite file is automatically generated when user create a maven java project.
(d) There is no option in Eclipse to generate XML suite file.
(e) TestNG XML suite file can be generated by Jenkins
Ans: (a) TestNG XML suite can be generated at time of creating TestNG class.
(b) TestNG XML suite can be generated using "Convert to testNG" option..........class is
created.
Sub-topics: Switching to windows
(a) List<String>
(b) Set<String>
(c) Array<String>
(d) Window<String>
4) Kevin wants to generate expensive report for the test automation project. He decides to use
Extent Report Library. Which class in the library is used to create labels, code blocks and
tables in the report?
(a). ExtentHtmlReporter.
(b). ExtentReports
(c). MarkupHelper
(d). ExtentTest.
Ans: ( c) MarkupHelper.
5) Sean is coding an automation Script to launch the web application on a browser window.
Which of the following listed option(s) will help Sean to lunch the desired application on a
web browser in selenium?
(a). driver.get(“URL”)
(b). driver.navigate().to(“URL”)
(c). driver.navigate(“URL”)
(d). driver.getUrl(“URL”)
(e). driver.setUrl(“URL”)
Sarah wants to locate the 3rd child element i.e Hydrabad. Suggest the appropriate locator stratgy
for
Sarah.
7) James wants to automate the selection of ID proofs drop-down box in the web application.
He has to verify the drop-down has a selection of more than one option. Which of the
following method is suggested to James?
Ans : isMultiple()
8) Kavin is using CSS selector as a locator strategy for the following element: <h1 id”msg01”
name=”success” > Registeration Completed </h1>
Ans: By.cssSelector("h1[id='msg01']")
By.cssSelector("h1[id='msg01'][name='success']")
1) Which is an IDE extension that helps you detect and fix quality issues as you write code in
python/HTML/Javascript/PHP?
SonarQube
SonarLint
SonarQubeServer
2) Sarah is coding an automation script to switch to iFRAME in a web application. Which of the
listed options will help sarah to switch to a particular frame on a web page using the library?
driver.switchTo().frame(int index)
driver.switchTo().frame(String nameOrld)
driver.switchTo().frame(Webelement frameElement)
driver.switchTo().frame()
driver.switchTo().iframe(String name)
3) Kevin is planning to write an automation script for below test scenario: Given the user is on
the Payment Page, he views a text box with attribute value=”Enter Mobile Number” written
inside the box. The user must enter the mobile number in the box.
Please check the correct command to help Kevin in automating this scenario. Assume that
text box element is already identified and stored in mobileTxtBox variable.
mobileTxtBox.clear(); mobileTxtBox.sendKeys(“9090909090”);
mobileTxtBox.sendKeys(“9090909090”);
mobileTxtBox.sendKeys(“9090909090”);mobileTxtBox.clear();
mobileTxtBox.value=”9090909090”;
4) Which Java enum is used to handle the keyboard strokes from WebDriver Library?
Actions
Keyboard
Keys
Keyword
1. Which java interface is used to capture screenshot of a web page using web driver API ?
Ans: TakeScreenshot
2. Henry is designing a script and using CSS Selector as the locator strategy. He must locate the
element effectively. The element inspected looks like:
<input id=“newPassword” type=“password”>
ANS : By.cssSelector("input[id='newPassword']")
3. 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. ANS
:@BeforeTest, @BeforeClass, @BeforeMethod, @Test, @AfterMethod, @AfterClass,
@AfterTest
4. Kevin is using a CSS Selector as a locator strategy for the following element:
<h1 id=“msg01” name=“success”>Registration completed</h1>
He must identify the element effectively.
ANS :By.cssSelector(“h1[id=‘msg01’]”), By.cssSelector(“h1[id=‘msg01’][name=‘success’]”. 5.
Testing an automation script to test a web application. He has to store the Logout link in the
using a driver.findElement() method. Suggest Sean with a compatible return to leg out least
object.
Ans:WebElement
6. While using soft assertion in the test class, james must specify a method, that will collate
and display assertion results
Ans:assertAll()
7. Sarah is coding to automate a test scenario in which she must fetch the booking id as a text
message from the span element.
The web element looks like: <span>Order Completed With Booking
ID:6665</span> Help Sarah to find a method from the WebDriver Library to fetch
the Booking ID. Ans: getText()
8. Sean is coding to automate mouse interactions on a web browser. Assist Sean to identify the
mouse event specific methods from the below options.
Ans: moveToElement(),moveByOffset(),release()
9. Which date format is used to customize the system data to year-month-day format?
ANS:new SimpleDateFormat(“yyyy-MM-dd”)
10. What are the various status options available in the Extent reports library?
Ans:PASS,FAIL,SKIP,FATAL,ERROR,WARNING,INFO
11. James is automating a script and using CSS Selector as a locator. What are the primitive
types for designing the CSS selector?
ANS - .id, .Attribute, .innerText()
12. 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.Ans:method2, method3, method1, method4.
Q:1 Sarah wants to automate the selection of only one option from a dropdown box as shown below
<html>
<body>
<select multiple>
<option value=”web”>html</option>
<option value=”prog”>python</option>
<option value=”prog”>java</option>
<option value=”prog”>python</option>
<option value=”prog”>java</option>
</select>
</body>
</html>.
Sarah has to select only the fourth option,i.e,python from the options field.
Ans: selectByVisibleText()
selectByValue()
selectByIndex()
All of the above
Q2: Sean is automating a test scenario, in which he has to fetch the URL of the web page using
WebDriver API. Suggest a method for Sean to get the link address
Ans:-getURL()
get()
getCurrentURL()
getURI()
Q3: 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?
a parallel = “methods”
b parallel="tests"
c parallel = “test-classes”
d parallel =”test-cases”
Q4: Fuller has written an automation script using selenium webdriver commands. He has used all the
necessary and appropriate locators for interacting with the web elements. When he executed the
script the web driver was not able to locate an element resulting in the test script failure. Which
error/ exception is thrown by webdriver?
NoSuchElementException
NoSuchElementError
NullPointerException
ObjectNotFoundException
Q5: Kevin is designing an automation test, where test data is specified in an external excel file.
Which command will be helpful to write the data into a cell of the excel file? Assume c1 is the cell
object.
a c1.setCellValue("data")
b c1.setValue(“data”)
c c1.writeCellValue(“data”)
d c1.setCellData(“data”)
Q6: Which of the following is correct about generating about an XML suite file in TestNG for Test
Suite Exception.
(a) TestNG XML suite can be generated at time of creating TestNG class.
(b) TestNG XML suite can be generated using "Convert to testNG" option..........class is
created.
(c) TestNG XML suite file is automatically generated when user create a maven java
project.
(d) There is no option in Eclipse to generate XML suite file.
Q7: Which of the following Java classes are from the Extent API library?
ExtentReports
Status
TakesScreenshot
Actions
Q8: Sean wants to switch to multiple frames on a web page when an operation is completed on a
frame and test flow needs to move to another frame. Calling the driver.switch To().frame()
immediately will not move the context to the next frame which is at the same level in DOM. The
test will first need to switch to the main document and then activate the desired frame. Which
method is used to switch back to the main document from the frame?
driver.switch To().mainDocument()
driver.switchTo().defaultContent()
Q9: Sam is designing an automation test, where test data is specified in an external excel file. Which
command will be helpful to get across to the 2nd sheet of excel file. Assume wb is the workbook
object.
a wb.getSheetAt(1)
b wb.getSheetAt(2)
c wb.getSheet(1)
d wb.getSheet(2)
Q10: Sean is performing verification using Assert class functions from TestNG. Suggest him the
corect method to verify the reference/address of the two objects to be identical
assert True(Object1,Object2)
assertRef(Obect1,Object2)
assertEquals(Object1,Object2)
assertSame(Object1,Object2)
Q11: Sean is coding an automation Script to launch the web application on a browser window.
Which of the following listed option(s) will help Sean to lunch the desired application on a web
browser in selenium?
(a). driver.get(“URL”)
(b). driver.navigate().to(“URL”)
(c). driver.navigate(“URL”)
(d). driver.getUrl(“URL”)
(e). driver.setUrl(“URL”)
Q12: Sarah is coding an automation Script to locate a child element in an unordered list. The list is
given below:
<html>
<body>
<ul class=”cities”>
<li>Bangalore</li>
<li>Chennai</li>
<li>Hydrabad</li>
<li>Mumbai</li>
<li>Pune</li>
</ul>
</body>
</html>
Sarah wants to locate the 3rd child element i.e Hydrabad. Suggest the appropriate locator stratgy
for
Sarah.
Q13: 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?
ExplicitWait
ImplicitWait
WebDriverWait
Expected Conditions
Q14: What are the various status options available in the Extent reports library?
e. PASS,FAIL,SKIP,FATAL,ERROR,WARNING,INFO
f. SUCCESS,FAIL,SKIP ,ERROR,WARNING,INFO
g. DONE,DEBUG,FAIL,SKIP,ERROR,WARNING,INFO
h. ABORT,PASS,FAIL,DONE,ERROR,WARNING,INFO
Q15: 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?
f. selectAllOptions()
g. getOptions()
h. getAllOptions()
i. getData()
j. getText()
Q16: Which java interface is used to capture screenshot of a web page using Web Driver API?
ANS: TakeScreenshot
Q17: There is an element on the webpages when inspected on the browser it looks like <div
call=”errorMsg”>Error Message</div>.
James wants to use selenium locations to identify the element. Choose the correct set of commands
to locate the elements efficiently.
Ans:-By. CssSelector(“id=newPassword”)
By .CssSelector(“input.newPassword”)
By .CssSelector(“input_newPassword”)
By .CssSelector(“input[id$=’Password’]”)
Q19: Kevin is using a CSS Selector as a locator strategy for the following element:
Q20: 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. ANS - @BeforeTest,
@BeforeClass, @BeforeMethod, @Test, @AfterMethod, @AfterClass, @AfterTest
Q21: Testing an automation script to test a web application. He has to store the Logout link in the
using a driver.findElement() method. Suggest Sean with a compatible return to leg out least object.
(a) String
(b) WebDriver
(c) WebElement
(d) List
1Q) Sean is coding an automation script to test a web application. He has to store the Logout Ink
in a Java vanable using a driver findElement() method. Suggest Sean with a compatible return type
a) String
b) WebDnver
c) WebElement
d) List
a) By.className('style1’)
b) By.id(‘Email')
c) By.name(‘Email’)
d) By.xpath(‘//label[@id='Email’]’)
3Q) James is automating a scnpt and using CSS Seleclor as a localor. What are the primitive
a) Id
b) Attribute
c) Inner Text
d) Tagname
3Q) Sean is performing verification using Assert class functions from TesTNG. Suggest him
the correct method to verify the reference/address of the two objects to be identical. Choose
a) assert True(Object1.Object2)
b) assertRef(Obect1, Object2)
c) assertEquals(Object1, Object2)
d) assertSame(Object1, Object2)
4Q)Sean is coding an automation script for emulating user actions by mouse using the
webdriver library. Assist Sean to choose the correct syntax to create an object for Actions class
c) new Actions(driverInstance)
d) Actions act=(Actions)driverInstance
e) Aclions.callMethods()
5Q) Samantha wants to write an automation script that determines the count of
a) driver.findElement(By.name("hobbies")).getCount()
b) driver.findElement(By.name("hobbies")).size()
c) driver.findElement(By.name("hobbies")).length()
d) driver.findElements(By.name("hobbies")).getCount()
e) driver.findElements(By.name("hobbies")).size()
6Q) Which Java Interface is used to capture screenshot of a web page using Web Driver API?
a) ScreenShot
b) Capture
c) TakesScreenshot
d) Image
7Q) Which date fomat is used to customize the system date to year-month-day format?
a) new SimpleDateFormat("yyyy-mm-dd")
b) new SimpleDateFormat("yyyy-MM-dd")
c) new SimpleDateFormat("yyyy-month-dd")
d) new SimpleDateFormat("yyyy-mmm-dd")
8Q) Sarah is coding an automation script to switch to IFRAME in a web application. Which of the
listed option(s) will help Sarah to switch to a particular frame on a web page using the webdriver
library?
9Q) Identify the correct way of launching the Chrome browser through WebDriver Instance with
a) System.setProperty("webdriver.chrome.driver”, "src/test/resources");
b) System.setProperty("webdriver.chrome.driver","src/test/resources/chromedriver.exe");
System.setProperty("webdriver.chrome.driver","src/test/resources/chromedriver.exe"); d)
System.getProperty("webdriver.chrome.driver","src/test/resources/chromedriver.exe");
10Q) Which of the following Java classes are from the Extent API
A ExtentReports
B Status
C TakesScreenshot
D Actions
@Test
@Test
@Test
Kevin executes the above TestClass as a TestNG test. Which of the following correctly
12Q) Sarah coding a test script using TestNG classes. She has used all the necessary
Assert funtions to verify the test scripts When she executes the script. TestNG detected
failures
B Error Messages
C Warning Messages
13Q) Sarah is validating the Registration Page for TestMe App using TestNG Assertions. She wants
to execute all the validation statements and display the status as Pass/Fail, along with failure
messages if any. Which type of assertions are recommended to Sarah for implementation Choose
A Soft Assertions
B Hard Assertions
C Hard Exceptions
D Soft Exceptions
14Q) Kevin is automating a test scenario, in which he wants to locate an element with the
class attribute "classg1 jkyu_90". Assist Kevin in setting up the correct locator for the element.
By.className(“classg1 jkyu_90")
By.className(“classg1”)
By.class("classg1 jkyu_90”)
By.className(“jkyu_90")
15Q) Sarah is coding an automation script to switch to multiple windows in a web application. She
has to store all the window instances in a java variable which is returned by
driver.getWindowHandles(). Suggest Sarah with a compatible return type to store the window
references
List<String>
Set<String>
Array <String>
Window< String>
16Q) Sam is designing an automation test, where test data is specified in an external excel file.
Which command will be helpful to get across to the 2nd sheet of excel file. Assume wb is the
workbook object.
a wb.getSheetAt(1)
b wb.getSheetAt(2)
c wb.getSheet(1)
d wb.getSheet(2)
1…Sarah is coding a test script TESTNG classes she has ---ERROR MESSAGES
3…GIT CLONE
7….. which plugin can be used as an IDE (like eclipse extension that helps to detect and fix
quality issues-----SONARTLINT
extension
11…..George is reviewinf=g the quality of the java code given to him using sonarqube an
identified--- -MINOR
12….sarah wants to automate the selection of only one option from a drop ------SELECTBY
INDEX 13….which of the following statement is tru about extent reports-----ALL THE ABOVE
15…… sean is performing verification using assert class functions testing.suggest him the correct
…- ------ASSERTSAME(OBJECT1,OBJECT2)
SONARQUBE>OPEN-SOURCE
scenario-----DRIVER.SWITCHTO().ALERT()DISMISS(); 19---TAKESSCREENSHOT
20---ISMULTIPLE()
21---NOSUCHELEMENTEXCEPTION
22----MARKUPHELPER
24…EXTENTREPORTS ,STATUS
SELENIUM
1. Sean is coding to automate a web application using the webDriver library. He had set the
implicit wait of 30 seconds. However, the webelement was found within 10s. Will the webdriver
wait for further 20 seconds before executing the next line of code?
2. 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
3. Sarah is coding to automate script to switch to multiple windows in a web application. She has
to store all the window instances in a java variable which is retrived by
driver.getWindowHandles(). Suggest sarah with a compatable return type to store the window
references.
Ans:Set <string>
4. 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?
Ans: add
5. Sean is automating a test scenario in which he has to fetch the URL of the webpage using
webDriver API. Suggest a method fo Sean to get the link address
Ans: getCurrentURL()
6. 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
1) Which of the following is correct about generating XML suite file in testNG for Test Suite
Execution
a TestNG XML Suite file can be generated at the time of creating a TestNG class. b TestNG XML
Suite file can be generated using ‘convert to TestNG’ option in Eclipse after a java class is
created.
c TestNG XML Suite file can be automatically generated when user creates a maven java project
a driver.get(“url”)
b driver.navigate().to(“URL”)
c driver.navigate(“URL”)
d driver.getUrl(“URL”)
e driver.setUrl(“URL”)
3) Sam is designing an automation test, where test data is specified in an external excel file.
Which command will be helpful to get across to the 2nd sheet of excel file. Assume wb is the
workbook object.
a wb.getSheetAt(1)
b wb.getSheetAt(2)
c wb.getSheet(1)
d wb.getSheet(2)
4)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?
a parallel = “methods”
b parallel="tests"
c parallel = “test-classes”
d parallel =”test-cases”
5) Kevin is designing an automation test, where test data is specified in an external excel file.
Which command will be helpful to write the data into a cell of the excel file? Assume c1 is the cell
object.
a c1.setCellValue("data")
b c1.setValue(“data”)
c c1.writeCellValue(“data”)
d c1.setCellData(“data”)
6) Sarah wants to automate the selection of only one option from a drop-down box as shown
below.
<html>
<body>
<select multiple>
</select>
</body>
</html>
Sarah has to select only the fourth option i.e. python from the option list .
a selectByVisibleText()
b selectByValue()
c selectByIndex()
DDT
Sam is designing an automation test, where test data is specified in an external excel file. Which
command will be helpful to get access to the 2nd sheet of the excel file. Assume wb Is the
workbook object
wb.getSheetAt(1)ᤰᤱ
wb.getSheetAt(2)
wb.getSheet(1)
wb.getSheet(1)
EXTENT REPORTS
Which of the following Java classes are from the Extent API library?
ExtentReportsᤰᤱ
Statusᤰᤱ
TakesScreenshot
Actions
SWITCHING TO WINDOWS
Which of the following methods is used to close all the opened windows of WebDriver Instance?
Close()
Quit()ᤰᤱ
Null()
Sleep()
ACTIONS
Sean is coding an automation script for emulating user actions by mouse using the webdriver
library. Assist Sean to choose correct syntax to create an object for actions class from the
following options
New Actions(driverInstance)
EXTENT REPORTS
Which date format is used to customize the system data to year-month-day format? new
SimpleDateFormat(“yyyy-mm-dd”)
new SimpleDateFormat(“yyyy-MM-dd”)ᤰᤱ
new SimpleDateFormat(“yyyy-month-dd”)
new SimpleDateFormat(“yyyy-mmm-dd”)
WEBDRIVER API
Fuller has written an automation script using selenium webdriver commands. He has used all the
necessary and appropriate locators for interacting with the web elements. When he executed the
script the web driver was not able to locate an element resulting in the test script failure. Which
error/ exception is thrown by webdriver?
NoSuchElementExceptionᤰᤱ
NoSuchElementError
NullPointerException
ObjectNotFoundException
WEBDRIVER API
Samantha wants to automate selection of value from a drop down menu. When the element was
Inspected. She foundAgain
<html>
<body>
<select name=”jobrole”>
<option value=”2”>Lead</option>
<option value=”3”>Analyst</option>
</select>
</body>
<html>
Choose “lead” as the test data. Assist her by choosing the correct options. selectByIndex(1)
selectByValue(2)
selectByVisibleText(“Lead”)ᤰᤱ
selectByValue(“2”)ᤰᤱ
Q1- Which expression is used in CSS selectors to match the attribute value with a prefix? Ans: ^
@Test(priority=1)
@Test
@Test
@Test(priority=2)
Ans: method2,method3,method1,method4
1. Which java enum is used to handle the keyboard strokes from webdriver library? a. Actions
b. Keyboard
c. Keys
d. Keyword
2. Sam is designing an automation test, where test data is specified in an external excelfile.
Which command will be helpful to get access to the 2nd sheet of the excel file. Assume wb is
workbook object.
a. wb.getSheetAt(1)
b. wb.getSheetAt(2)
c. wb.getSheet(1)
d. wb.getSheet(2)
3. sarah wants to automate the selection of only one option from a drop down box as shown
below
<html>
<body>
<select multiple>
<option value=”web”>html</option>
<option value=”prog”>python</option>
<option value=”prog”>java</option>
<option value=”prog”>python</option>
<option value=”prog”>java</option>
</select>
</body>
</html>
Sarah has to select only the fourth option that is python from the options list a.
selectByVisibleText()
b. selectByValue ()
c. selectByIndex()
d. all the above
4. What are the various status options available in the Extent reports library? a.
PASS,FAIL,SKIP,FATAL,ERROR,WARNING,INFO
b. SUCCESS,FAIL,SKIP ,ERROR,WARNING,INFO
c. DONE,DEBUG,FAIL,SKIP,ERROR,WARNING,INFO
d. ABORT,PASS,FAIL,DONE,ERROR,WARNING,INFO
5. Sean is automating a test scenario, in which he has to fetch the URL of the web page using
WebDriver API . Suggest a method for Sean to get the link address.
a. getURL()
b. get()
c. getCurrentURL()
d. getURL()
6. 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?
a. selectAllOptions()
b. getOptions()
c. getAllOptions()
d. getData()
e. getText()
7. QUESTION NOT VISIBLE , multiple options
a. driver.get(“URL”)
b. driver.navigate().to(“URL”)
c. driver.navigate(“URL”)
d. driver.getUrl(“URL”)
e. driver.setUrl(“URL”)
f. Sarah is coding in a test scenario, in which she must fetch the booking id as a text message
from the span element.
The web element looks like
<Space> order completed with Booking id:6665<Space>
Help Sarah to find a method from the webdriver library to fetch the booking ID?
Ans - getText();
g. James is automating a script and using CSS Selector as a locator. What are the primitive types
for designing the CSS selector?
ANS - .id, .Attribute, .innerText()
(Explanation - There are 5 types of CSS Selectors in Selenium tests
ID, Class, Attribute, Sub-String, Inner Text)
h. Which expression is used in CSS Selectors to match the attribute value with a prefix? ANS- ^=
(Explanation - [attr^=value] Represents elements with an attribute name of attr whose value is
prefixed (preceded) by value.)
k. Identify the correct way of launching the Chrome browser through WebDriver instance with the
correct property.
ANS -
System.setProperty("webdriver.chrome.driver","src/test/resources/chromedriver.exe ");
WebDriver driver = new ChromeDriver();
l. Samantha wants to write an automation script that determines the count of Hobbies
checkboxes. These checkboxes have a name attribute as “hobbies”. Assist Samantha by
choosing the correct command.
ANS –
driver.findElements(By.name(“hobbies”)).size()
m. Henry is designing a script and using CSS Selector as the locator strategy. He must locate the
element effectively. The element inspected looks like:
<input id=“newPassword” type=“password”>
ANS - By.cssSelector("input[id='newPassword']")
n. Kevin is automating a test scenario. In which he wants to locate an element with the class
attribute “classg1 jkyu_90”. Assist Kevin in setting up the correct locator for the element.
ANS - By.className(“classg1”)
o. 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. ANS -
@BeforeTest, @BeforeClass, @BeforeMethod, @Test, @AfterMethod, @AfterClass, @AfterTest
p. Sean is coding an automation script for emulating user actions by mouse actions using
webdriver library. Assist Sean to choose the correct syntax to create an object for Actions class
from the following options.
ANS -
Actions act = new Actions(driverinstance)
Actions act = new Actions()
Actions act = (Actions)driverinstance
q. Kevin is using a CSS Selector as a locator strategy for the following element: <h1 id=“msg01”
name=“success”>Registration completed</h1>
He must identify the element effectively.
ANS –
By.cssSelector(“h1[id=‘msg01’]”)
By.cssSelector(“h1[id=‘msg01’][name=‘success’]”)
89. Which of the following reports can be generated using plugins from Cucumber options? ANS-
90. James wants to design a scenario in a feature file, in which the complete scenario runs
multiple times for different data sets . Suggest James with a Gherkin keyword to activate
drop-down testing in the feature file ?
91. Jack had created the feature file with the below mentioned scenarios as shown below:
@crash Scenario: This is the second scenario In test runner class, Jack mentioned
@cucumberoptions (tags=(“smoke”)) predict which scenario is/are gets executed Ans: Execute
92.Which of the following is the logical container that contains all the elements which drive the
performance test?
Ans: Load Testing Correct But, If Test Plan Available in option, Then, the correct Ans will be Test
Plan.
93. Which of the following assertions is not applied in Jmeter?
95. Which of the following input documents is used to create test scenarios and conditions? Ans:
96. Which of the following Java classes are from the extent API library?
97. Sean is coding to automate a web application using the webDriver library. He had set the
implicit wait of 30 seconds. However, the webelement was found / Test Plan correct correct
correct Google : ExtentReports correct within 10s . Will the webdriver wait for further 20 seconds
before executing the next line of code?
1) Which java enum is used to handle the keyboard strokes from webdriver library? (a) Actions
(b) Keyboard
(c) Keys
(d) Keyword
2) Which expression is used in CSS selectors to match attribute value with a prefix? (a)$=
(b)^=
(c)*=
(d)none
Ans: (b) ^=
3) Samantha wants to automate selection of valur from a drop…..
<html>
<body>
<select name=”jobrole”>
<option value=”1”>Manager</option>
<option value=”2”>Lead</option>
<option value=”3”>Analyst</option>
</select>
</body>
</html>
Ans: SelectByVisibleText(“Lead”)
SelectByValue(“2)
4) Sarah is coding an automation script to switch to IFRAME in a web application .Which of the
listed options(s) will help sarah to switch to a particular frame on a web page using the webdriver
library?
(a )driver.switchTo().frame(int index)
(b) driver.switchTo().frame(string nameOrld)
( c) driver.switchTo().frame(WebElement frameElement)
(d)driver.switchTo().frame()
(e) driver.switchTo().frame(String name)
ANS: (a) , (b), (c)
(a)ppt
(b)docs
(c)…
(d)…
Ans: POIFS
@beforeMethod
Public void method1() {…}
@afterMethod
@Test(dataProvider=”loginData”)
@data provider
****7) which method is used in apache poi library to fetch the cell value from a row? identify the
format of invoking the library functions to get value from a cell
(a)sheet.getStringCellValue()
(b) sheet.get(rowno).getstringCellvalue()
(d) sheet.get(rowno).getCell(colon).getstringCellvalue()
Ans : (c)
1. 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.
Ans selenium RC
2. George is reviewing the quality of the java code given to him using SonarQube and described
that the variables are named without following java variables naming convention. Under which
category this issue can be tracked in the tool?
Choose the most appropriate option.
Ans minor
3. Identify the correct flow of jenkins build, when a maven project job in Jenkins is triggered for
build
Ans testing.xml->pom.xml>testing classes>reports
4. Sarah is coding to automate a scenario for the selection of the “from Cities” drop down box on
the flight booking application web page, which class is used?
Ans Select Class
5. Sarah is coding in a test scenario, in which she must fetch the booking id as a text message
from the span element The web element looks like <Space> order completed with Booking
id:6665<Space> Help Sarah to find a method from the webdriver library to fetch the booking ID?
Ans get Text();
6. Which expression is used in CSS Selectors to match the attribute value with a prefix? Ans ^=
1. Samantha has designed a TestClass with the following methods:
@BeforeMethod
@Test(dataProvider=”loginData”)
@DataProvider
Suppose loginData() generates 5 sets of login credentials, how many times method1, method2
and method 3 would be executed ?
2. Sarah is coding an automation script to switch to iFRAME in a web application. Which of the
listed options will help Sarah to switch to a particular frame on a web page using the webdriver
library?
Choose the appropriate options.
a) driver.switchTo().frame(int index)
b) driver.switchTo().frame(String name Or id)
c) driver.switchTo().frame(WebElement frameElement)
d) driver.switchTo().frame()
e) driver.switchTo().iframe(String name)
3. Sean is coding to automate mouse interactions on a web browser. Assist Sean to identify the
mouse event specific methods from the below options.
a) moveToElement()
b) moveByOffset()
c) release()
d) keyUp()
e) keyDown()
f) sendKeys()
4. What method in the Web driver library is used to get the attribute value of a web element?
a) getAttributeValue(“attributeName”)
b) getAttribute(“attributeName”)
c) getValue(“attributeName”)
d) getText()
6. Sarah is coding to automate a test scenario in which she must fetch the booking id as a text
message from the span element.
The web element looks like: <span>Order Completed With Booking ID:6665</span> Help Sarah
to find a method from the WebDriver Library to fetch the Booking ID.
a) getValue()
b) getID()
c) getText()
d) getTagName()
7. 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.
a) Info
b) Minor
c) Major
d) Critical
e) 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.
Ans: jre , jdk ,meavon
f) Henry is designing a script and using css selector as the locator strategy. He must locate the
element effectively. The element inspected looks like
<input id =”new Password” type =”password”>
Choose the most appropriate option.
ans: By.CssSelector(“input[id=’password’]”)
g) There is an element on the web page when inspected on the browser it looks like <div
class=”errorMsg”>Error Message</div> James want to use selenium locators to identify the
element. Choose the correct set of commands to locate the element effectively.
Ans: By.CssSelector(“div.errorMsg”)
h) Match the following tools with the correct description
(a) String
(b) WebDriver
(c) WebElement
(d) List
Sub-topic: TestNG
2) Which of the following is correct about generating about an XML suite file in TestNG for Test
Suite Exception.
(a) TestNG XML suite can be generated at time of creating TestNG class.
(b) TestNG XML suite can be generated using "Convert to testNG" option..........class is created.
(c) TestNG XML suite file is automatically generated when user create a maven java project. (d)
There is no option in Eclipse to generate XML suite file.
(e) TestNG XML suite file can be generated by Jenkins
Ans: (a) TestNG XML suite can be generated at time of creating TestNG class.
(b) TestNG XML suite can be generated using "Convert to testNG" option..........class is created.
Sub-topics: Switching to windows
3) Sarah is coding an automation script to switch to multiple windows in a web application . She
has to store all the window instance in a java variable which is returned by
driver.getWindowHandles(). Suggest Sarah with a compatible return type to store the window
References.
(a) List<String>
(b) Set<String>
(c) Array<String>
(d) Window<String>
4) Kevin wants to generate expensive report for the test automation project. He decides to use
Extent Report Library. Which class in the library is used to create labels, code blocks and tables in
the report?
(a). ExtentHtmlReporter.
(b). ExtentReports
(c). MarkupHelper
(d). ExtentTest.
Ans: ( c) MarkupHelper.
5) Sean is coding an automation Script to launch the web application on a browser window. Which
of the following listed option(s) will help Sean to lunch the desired application on a web browser in
selenium?
(a). driver.get(“URL”)
(b). driver.navigate().to(“URL”)
(c). driver.navigate(“URL”)
(d). driver.getUrl(“URL”)
(e). driver.setUrl(“URL”)
Ans: (a) driver.get("URL")
(b) driver.navigate().to("URL")
Sarah wants to locate the 3rd child element i.e Hydrabad. Suggest the appropriate locator stratgy
for
Sarah.
7) James wants to automate the selection of ID proofs drop-down box in the web application. He
has to verify the drop-down has a selection of more than one option. Which of the following
method is suggested to James?
Ans : isMultiple()
8) Kavin is using CSS selector as a locator strategy for the following element: <h1 id”msg01”
name=”success” > Registeration Completed </h1>
Ans: By.cssSelector("h1[id='msg01']")
By.cssSelector("h1[id='msg01'][name='success']")
1) Which is an IDE extension that helps you detect and fix quality issues as you write code in
python/HTML/Javascript/PHP?
SonarQube
SonarLint
SonarQubeServer
2) Sarah is coding an automation script to switch to iFRAME in a web application. Which of the
listed options will help sarah to switch to a particular frame on a web page using the library?
driver.switchTo().frame(int index)
driver.switchTo().frame(String nameOrld)
driver.switchTo().frame(Webelement frameElement)
driver.switchTo().frame()
driver.switchTo().iframe(String name)
Please check the correct command to help Kevin in automating this scenario. Assume that text
box element is already identified and stored in mobileTxtBox variable.
mobileTxtBox.clear(); mobileTxtBox.sendKeys(“9090909090”);
mobileTxtBox.sendKeys(“9090909090”);
mobileTxtBox.sendKeys(“9090909090”);mobileTxtBox.clear();
mobileTxtBox.value=”9090909090”;
4) Which Java enum is used to handle the keyboard strokes from WebDriver Library? Actions
Keyboard
Keys
Keyword
1. Which java interface is used to capture screenshot of a web page using web driver API ? Ans:
TakeScreenshot
2. Henry is designing a script and using CSS Selector as the locator strategy. He must locate the
element effectively. The element inspected looks like:
<input id=“newPassword” type=“password”>
ANS : By.cssSelector("input[id='newPassword']")
3. 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. ANS
:@BeforeTest, @BeforeClass, @BeforeMethod, @Test, @AfterMethod, @AfterClass, @AfterTest
4. Kevin is using a CSS Selector as a locator strategy for the following element: <h1 id=“msg01”
name=“success”>Registration completed</h1>
He must identify the element effectively.
ANS :By.cssSelector(“h1[id=‘msg01’]”), By.cssSelector(“h1[id=‘msg01’][name=‘success’]”. 5.
Testing an automation script to test a web application. He has to store the Logout link in the using
a driver.findElement() method. Suggest Sean with a compatible return to leg out least object.
Ans:WebElement
6. While using soft assertion in the test class, james must specify a method, that will collate and
display assertion results
Ans:assertAll()
7. Sarah is coding to automate a test scenario in which she must fetch the booking id as a text
message from the span element.
The web element looks like: <span>Order Completed With Booking ID:6665</span> Help Sarah
to find a method from the WebDriver Library to fetch the Booking ID. Ans: getText()
8. Sean is coding to automate mouse interactions on a web browser. Assist Sean to identify the
mouse event specific methods from the below options.
Ans: moveToElement(),moveByOffset(),release()
9. Which date format is used to customize the system data to year-month-day format? ANS:new
SimpleDateFormat(“yyyy-MM-dd”)
10. What are the various status options available in the Extent reports library?
Ans:PASS,FAIL,SKIP,FATAL,ERROR,WARNING,INFO
11. James is automating a script and using CSS Selector as a locator. What are the primitive
types for designing the CSS selector?
ANS - .id, .Attribute, .innerText()
12. 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.Ans:method2,
method3, method1, method4.
Q:1 Sarah wants to automate the selection of only one option from a dropdown box as shown
below <html>
<body>
<select multiple>
<option value=”web”>html</option>
<option value=”prog”>python</option>
<option value=”prog”>java</option>
<option value=”prog”>python</option>
<option value=”prog”>java</option>
</select>
</body>
</html>.
Sarah has to select only the fourth option,i.e,python from the options field.
Ans: selectByVisibleText()
selectByValue()
selectByIndex()
All of the above
Q2: Sean is automating a test scenario, in which he has to fetch the URL of the web page using
WebDriver API. Suggest a method for Sean to get the link address
Ans:-getURL()
get()
getCurrentURL()
getURI()
Q3: 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?
a parallel = “methods”
b parallel="tests"
c parallel = “test-classes”
d parallel =”test-cases”
Q4: Fuller has written an automation script using selenium webdriver commands. He has used all
the necessary and appropriate locators for interacting with the web elements. When he executed
the script the web driver was not able to locate an element resulting in the test script failure.
Which error/ exception is thrown by webdriver?
NoSuchElementExceptionᤰᤱ
NoSuchElementError
NullPointerException
ObjectNotFoundException
Q5: Kevin is designing an automation test, where test data is specified in an external excel file.
Which command will be helpful to write the data into a cell of the excel file? Assume c1 is the cell
object.
a c1.setCellValue("data")
b c1.setValue(“data”)
c c1.writeCellValue(“data”)
d c1.setCellData(“data”)
Q6: Which of the following is correct about generating about an XML suite file in TestNG for Test
Suite Exception.
(a) TestNG XML suite can be generated at time of creating TestNG class.
(b) TestNG XML suite can be generated using "Convert to testNG" option..........class is created.
(c) TestNG XML suite file is automatically generated when user create a maven java project.
(d) There is no option in Eclipse to generate XML suite file.
Q7: Which of the following Java classes are from the Extent API library?
ExtentReportsᤰᤱ
Statusᤰᤱ
TakesScreenshot
Actions
Q8: Sean wants to switch to multiple frames on a web page when an operation is completed on a
frame and test flow needs to move to another frame. Calling the driver.switch To().frame()
immediately will not move the context to the next frame which is at the same level in DOM. The
test will first need to switch to the main document and then activate the desired frame. Which
method is used to switch back to the main document from the frame?
driver.switch To().mainDocument()
driver.switchTo().defaultContent()
Q9: Sam is designing an automation test, where test data is specified in an external excel file.
Which command will be helpful to get across to the 2nd sheet of excel file. Assume wb is the
workbook object.
a wb.getSheetAt(1)
b wb.getSheetAt(2)
c wb.getSheet(1)
d wb.getSheet(2)
Q10: Sean is performing verification using Assert class functions from TestNG. Suggest him the
corect method to verify the reference/address of the two objects to be identical
assert True(Object1,Object2)
assertRef(Obect1,Object2)
assertEquals(Object1,Object2)
assertSame(Object1,Object2)
Q11: Sean is coding an automation Script to launch the web application on a browser window.
Which of the following listed option(s) will help Sean to lunch the desired application on a web
browser in selenium?
(a). driver.get(“URL”)
(b). driver.navigate().to(“URL”)
(c). driver.navigate(“URL”)
(d). driver.getUrl(“URL”)
(e). driver.setUrl(“URL”)
Q12: Sarah is coding an automation Script to locate a child element in an unordered list. The list is
given below:
<html>
<body>
<ul class=”cities”>
<li>Bangalore</li>
<li>Chennai</li>
<li>Hydrabad</li>
<li>Mumbai</li>
<li>Pune</li>
</ul>
</body>
</html>
Sarah wants to locate the 3rd child element i.e Hydrabad. Suggest the appropriate locator stratgy
for
Sarah.
(e) CSS = “ul:cities li:nth-child(2)”
(f) CSS = “ul:cities li:nth-of-type(“Hydrabad”)
(g) CSS =” ul:cities li:nth-child(“Hydrabad”)
(h) CSS= “ul:cities li:nth-child(])”
Q13: 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?
ExplicitWait
ImplicitWait
WebDriverWait
Expected Conditions
Q14: What are the various status options available in the Extent reports library?
e. PASS,FAIL,SKIP,FATAL,ERROR,WARNING,INFO
f. SUCCESS,FAIL,SKIP ,ERROR,WARNING,INFO
g. DONE,DEBUG,FAIL,SKIP,ERROR,WARNING,INFO
h. ABORT,PASS,FAIL,DONE,ERROR,WARNING,INFO
Q15: 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?
f. selectAllOptions()
g. getOptions()
h. getAllOptions()
i. getData()
j. getText()
Q16: Which java interface is used to capture screenshot of a web page using Web Driver API?
ANS: TakeScreenshot
Q17: There is an element on the webpages when inspected on the browser it looks like <div
call=”errorMsg”>Error Message</div>.
James wants to use selenium locations to identify the element. Choose the correct set of
commands to locate the elements efficiently.
Ans: By.CSS Selector(“div#errorMsg”)
By.CSS Selector(“div.errorMsg”)
By.CSS Selector(“div_errorMsg”)
By.CSS Selector(“errorMsg”)
Q18: ) Henry is designing a script and using CSS Selector as the locator strategy. He must locate
the element effectively. The element inspected looks like:
Ans:-By. CssSelector(“id=newPassword”)
By .CssSelector(“input.newPassword”)
By .CssSelector(“input_newPassword”)
By .CssSelector(“input[id$=’Password’]”)
Q19: Kevin is using a CSS Selector as a locator strategy for the following element:
Q20: 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. ANS -
@BeforeTest, @BeforeClass, @BeforeMethod, @Test, @AfterMethod, @AfterClass, @AfterTest
Q21: Testing an automation script to test a web application. He has to store the Logout link in the
using a driver.findElement() method. Suggest Sean with a compatible return to leg out least object.
(a) String
(b) WebDriver
(c) WebElement
(d) List
1Q) Sean is coding an automation script to test a web application. He has to store the Logout Ink
in a Java vanable using a driver findElement() method. Suggest Sean with a compatible return
a) String
b) WebDnver
c) WebElement
d) List
a) By.className('style1’)
b) By.id(‘Email')
c) By.name(‘Email’)
d) By.xpath(‘//label[@id='Email’]’)
3Q) James is automating a scnpt and using CSS Seleclor as a localor. What are the primitive
a) Id
b) Attribute
c) Inner Text
d) Tagname
3Q) Sean is performing verification using Assert class functions from TesTNG. Suggest him the
correct method to verify the reference/address of the two objects to be identical. Choose the most
appropnale option.
a) assert True(Object1.Object2)
b) assertRef(Obect1, Object2)
c) assertEquals(Object1, Object2)
d) assertSame(Object1, Object2)
4Q)Sean is coding an automation script for emulating user actions by mouse using the webdriver
library. Assist Sean to choose the correct syntax to create an object for Actions class from the
following options
c) new Actions(driverInstance)
d) Actions act=(Actions)driverInstance
e) Aclions.callMethods()
5Q) Samantha wants to write an automation script that determines the count of Hobbies
a) driver.findElement(By.name("hobbies")).getCount()
b) driver.findElement(By.name("hobbies")).size()
c) driver.findElement(By.name("hobbies")).length()
d) driver.findElements(By.name("hobbies")).getCount()
e) driver.findElements(By.name("hobbies")).size()
6Q) Which Java Interface is used to capture screenshot of a web page using Web Driver API?
a) ScreenShot
b) Capture
c) TakesScreenshot
d) Image
7Q) Which date fomat is used to customize the system date to year-month-day format? For
example: 2019-04-24
a) new SimpleDateFormat("yyyy-mm-dd")
b) new SimpleDateFormat("yyyy-MM-dd")
c) new SimpleDateFormat("yyyy-month-dd")
d) new SimpleDateFormat("yyyy-mmm-dd")
8Q) Sarah is coding an automation script to switch to IFRAME in a web application. Which of the
listed option(s) will help Sarah to switch to a particular frame on a web page using the webdriver
library?
9Q) Identify the correct way of launching the Chrome browser through WebDriver Instance with
a) System.setProperty("webdriver.chrome.driver”, "src/test/resources");
b) System.setProperty("webdriver.chrome.driver","src/test/resources/chromedriver.exe");
WebDriver driver=new ChromeDriver();
System.setProperty("webdriver.chrome.driver","src/test/resources/chromedriver.exe"); d)
System.getProperty("webdriver.chrome.driver","src/test/resources/chromedriver.exe"); WebDriver
driver=new ChromeDriver();
10Q) Which of the following Java classes are from the Extent API library? Choose the most
appropriate option.
A ExtentReports
B Status
C TakesScreenshot
D Actions
@Test
@Test
@Test
Kevin executes the above TestClass as a TestNG test. Which of the following correctly represents
funtions to verify the test scripts When she executes the script. TestNG detected failures
Predict what type of message objects are thrown in the console as output? A Exception
Messages
B Error Messages
C Warning Messages
13Q) Sarah is validating the Registration Page for TestMe App using TestNG Assertions. She
wants to execute all the validation statements and display the status as Pass/Fail, along with
failure messages if any. Which type of assertions are recommended to Sarah for implementation
A Soft Assertions
B Hard Assertions
C Hard Exceptions
D Soft Exceptions
14Q) Kevin is automating a test scenario, in which he wants to locate an element with the class
attribute "classg1 jkyu_90". Assist Kevin in setting up the correct locator for the element. Choose
By.className(“classg1 jkyu_90")
By.className(“classg1”)
By.class("classg1 jkyu_90”)
By.className(“jkyu_90")
15Q) Sarah is coding an automation script to switch to multiple windows in a web application. She
has to store all the window instances in a java variable which is returned by
driver.getWindowHandles(). Suggest Sarah with a compatible return type to store the window
references
List<String>
Set<String>
Array <String>
Window< String>
16Q) Sam is designing an automation test, where test data is specified in an external excel file.
Which command will be helpful to get across to the 2nd sheet of excel file. Assume wb is the
workbook object.
a wb.getSheetAt(1)
b wb.getSheetAt(2)
c wb.getSheet(1)
d wb.getSheet(2)
SELENIUM
1. Sean is coding to automate a web application using the webDriver library. He had set the
implicit wait of 30 seconds. However, the webelement was found within 10s. Will the webdriver
wait for further 20 seconds before executing the next line of code?
2. 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
3. Sarah is coding to automate script to switch to multiple windows in a web application. She
has to store all the window instances in a java variable which is retrived by
driver.getWindowHandles(). Suggest sarah with a compatable return type to store the
window references.
Ans:Set <string>
4. 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?
Ans: add
5. Sean is automating a test scenario in which he has to fetch the URL of the webpage using
webDriver API. Suggest a method fo Sean to get the link address
Ans: getCurrentURL()
6. 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
1) Which of the following is correct about generating XML suite file in testNG for Test Suite
Execution
a TestNG XML Suite file can be generated at the time of creating a TestNG class.
b TestNG XML Suite file can be generated using ‘convert to TestNG’ option in Eclipse after a java
class is created.
c TestNG XML Suite file can be automatically generated when user creates a maven java project
2) Sean is coding an automated script to launch the web application on a browser window. Which
of the following listed option will help Sean to launch the desired application on a web browser in
selenium?
a driver.get(“url”)
b driver.navigate().to(“URL”)
c driver.navigate(“URL”)
d driver.getUrl(“URL”)
e driver.setUrl(“URL”)
3) Sam is designing an automation test, where test data is specified in an external excel file.
Which command will be helpful to get across to the 2nd sheet of excel file. Assume wb is the
workbook object.
a wb.getSheetAt(1)
b wb.getSheetAt(2)
c wb.getSheet(1)
d wb.getSheet(2)
4)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?
a parallel = “methods”
b parallel="tests"
c parallel = “test-classes”
d parallel =”test-cases”
5) Kevin is designing an automation test, where test data is specified in an external excel file.
Which command will be helpful to write the data into a cell of the excel file? Assume c1 is the cell
object.
a c1.setCellValue("data")
b c1.setValue(“data”)
c c1.writeCellValue(“data”)
d c1.setCellData(“data”)
6) Sarah wants to automate the selection of only one option from a drop-down box as shown
below.
<html>
<body>
<select multiple>
</select>
</body>
</html>
Sarah has to select only the fourth option i.e. python from the option list .
a selectByVisibleText()
b selectByValue()
c selectByIndex()
DDT
Sam is designing an automation test, where test data is specified in an external excel file. Which
command will be helpful to get access to the 2nd sheet of the excel file. Assume wb Is the
workbook object
wb.getSheetAt(1) ✔️
wb.getSheetAt(2)
wb.getSheet(1)
wb.getSheet(1)
EXTENT REPORTS
Which of the following Java classes are from the Extent API library?
ExtentReports ✔️
Status✔️
TakesScreenshot
Actions
SWITCHING TO WINDOWS
Which of the following methods is used to close all the opened windows of WebDriver Instance?
Close()
Quit() ✔️
Null()
Sleep()
ACTIONS
Sean is coding an automation script for emulating user actions by mouse using the webdriver
library. Assist Sean to choose correct syntax to create an object for actions class from the
following options
New Actions(driverInstance)
Actions.callMethods()
EXTENT REPORTS
Which date format is used to customize the system data to year-month-day format?
new SimpleDateFormat(“yyyy-mm-dd”)
new SimpleDateFormat(“yyyy-MM-dd”) ✔️
new SimpleDateFormat(“yyyy-month-dd”)
new SimpleDateFormat(“yyyy-mmm-dd”)
WEBDRIVER API
Fuller has written an automation script using selenium webdriver commands. He has used all the
necessary and appropriate locators for interacting with the web elements. When he executed the
script the web driver was not able to locate an element resulting in the test script failure. Which
error/ exception is thrown by webdriver?
NoSuchElementException ✔️
NoSuchElementError
NullPointerException
ObjectNotFoundException
WEBDRIVER API
Samantha wants to automate selection of value from a drop down menu. When the element was
Inspected. She foundAgain
<html>
<body>
<select name=”jobrole”>
<option value=”2”>Lead</option>
<option value=”3”>Analyst</option>
</select>
</body>
<html>
Choose “lead” as the test data. Assist her by choosing the correct options.
selectByIndex(1)
selectByValue(2)
selectByVisibleText(“Lead”) ✔️
selectByValue(“2”) ✔️
Q1- Which expression is used in CSS selectors to match the attribute value with a prefix?
Ans: ^
@Test(priority=1)
@Test
@Test
@Test(priority=2)
Ans: method2,method3,method1,method4
1. Which java enum is used to handle the keyboard strokes from webdriver library?
a. Actions
b. Keyboard
c. Keys
d. Keyword
2. Sam is designing an automation test, where test data is specified in an external excelfile.
Which command will be helpful to get access to the 2nd sheet of the excel file. Assume wb is
workbook object.
a. wb.getSheetAt(1)
b. wb.getSheetAt(2)
c. wb.getSheet(1)
d. wb.getSheet(2)
3. sarah wants to automate the selection of only one option from a drop down box as shown
below
<html>
<body>
<select multiple>
<option value=”web”>html</option>
<option value=”prog”>python</option>
<option value=”prog”>java</option>
<option value=”prog”>python</option>
<option value=”prog”>java</option>
</select>
</body>
</html>
Sarah has to select only the fourth option that is python from the options list
a. selectByVisibleText()
b. selectByValue ()
c. selectByIndex()
4. What are the various status options available in the Extent reports library?
a. PASS,FAIL,SKIP,FATAL,ERROR,WARNING,INFO
b. SUCCESS,FAIL,SKIP ,ERROR,WARNING,INFO
c. DONE,DEBUG,FAIL,SKIP,ERROR,WARNING,INFO
d. ABORT,PASS,FAIL,DONE,ERROR,WARNING,INFO
5. Sean is automating a test scenario, in which he has to fetch the URL of the web page using
WebDriver API . Suggest a method for Sean to get the link address.
a. getURL()
b. get()
c. getCurrentURL()
d. getURL()
6. 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?
a. selectAllOptions()
b. getOptions()
c. getAllOptions()
d. getData()
e. getText()
a. driver.get(“URL”)
b. driver.navigate().to(“URL”)
c. driver.navigate(“URL”)
d. driver.getUrl(“URL”)
e. driver.setUrl(“URL”)
f. Sarah is coding in a test scenario, in which she must fetch the booking id
as a text message from the span element.
Help Sarah to find a method from the webdriver library to fetch the booking ID?
Ans - getText();
g. James is automating a script and using CSS Selector as a locator. What are
the primitive types for designing the CSS selector?
h. Which expression is used in CSS Selectors to match the attribute value with
a prefix?
ANS- ^=
(Explanation - [attr^=value] Represents elements with an attribute name of attr whose value is
prefixed (preceded) by value.)
i. Write in correct order.
c. Jenkins checks the Git Repository periodically to detect changes in build project.
e. Testers/ Developers commits source code changes to the shared Git Repository.
ANS- e,c,a,b,d
@Test
@Test
@Test
Kevin executes the above TestClass as a TestNG test. Which of the following correctly
represents the test result?
m. Henry is designing a script and using CSS Selector as the locator strategy.
He must locate the element effectively. The element inspected looks like:
<input id=“newPassword” type=“password”>
ANS - By.cssSelector("input[id='newPassword']")
o. 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.
ANS -
ANS –
By.cssSelector(“h1[id=‘msg01’]”)
By.cssSelector(“h1[id=‘msg01’][name=‘success’]”)
89. Which of the following reports can be generated using plugins from Cucumber options?
90. James wants to design a scenario in a feature file, in which the complete scenario runs
multiple times for different data sets . Suggest James with a Gherkin keyword to activate
drop-down testing in the feature file ?
91. Jack had created the feature file with the below mentioned scenarios as shown below:
@crash Scenario: This is the second scenario In test runner class, Jack mentioned
92.Which of the following is the logical container that contains all the elements which drive the
performance test?
95. Which of the following input documents is used to create test scenarios and conditions?
96. Which of the following Java classes are from the extent API library?
97. Sean is coding to automate a web application using the webDriver library. He had set the
implicit wait of 30 seconds. However, the webelement was found / Test Plan correct correct correct
Google : ExtentReports correct within 10s . Will the webdriver wait for further 20 seconds before
executing the next line of code?
(a) Actions
(b) Keyboard
(c) Keys
(d) Keyword
2) Which expression is used in CSS selectors to match attribute value with a prefix?
(a)$=
(b)^=
(c)*=
(d)none
Ans: (b) ^=
<html>
<body>
<select name=”jobrole”>
<option value=”1”>Manager</option>
<option value=”2”>Lead</option>
<option value=”3”>Analyst</option>
</select>
</body>
</html>
Ans: SelectByVisibleText(“Lead”)
SelectByValue(“2)
4) Sarah is coding an automation script to switch to IFRAME in a web application .Which of the
listed options(s) will help sarah to switch to a particular frame on a web page using the
webdriver library?
(a )driver.switchTo().frame(int index)
( c) driver.switchTo().frame(WebElement frameElement)
(d)driver.switchTo().frame()
(a)ppt
(b)docs
(c)…
(d)…
Ans: POIFS
@beforeMethod
@afterMethod
@data provider
****7) which method is used in apache poi library to fetch the cell value from a row? identify the
format of invoking the library functions to get value from a cell
(a)sheet.getStringCellValue()
(b) sheet.get(rowno).getstringCellvalue()
(d) sheet.get(rowno).getCell(colon).getstringCellvalue()
Ans : (c)
1. Samantha has to execute automation scripts across multiple platforms like windows,
mac, Linux which tool in the selenium suite will be used by Samantha?
Ans selenium RC
2. George is reviewing the quality of the java code given to him using SonarQube and
described that the variables are named without following java variables naming
convention. Under which category this issue can be tracked in the tool?
Ans minor
3. Identify the correct flow of jenkins build, when a maven project job in Jenkins is
triggered for build
4. Sarah is coding to automate a scenario for the selection of the “from Cities” drop
down box on the flight booking application web page, which class is used?
5. Sarah is coding in a test scenario, in which she must fetch the booking id as a text
message from the span element The web element looks like <Space> order completed
with Booking id:6665<Space> Help Sarah to find a method from the webdriver library to
fetch the booking ID?
6. Which expression is used in CSS Selectors to match the attribute value with a prefix?
Ans ^=
@BeforeMethod
@AfterMethod
@Test(dataProvider=”loginData”)
@DataProvider
Suppose loginData() generates 5 sets of login credentials, how many times method1, method2 and
method 3 would be executed ?
2. Sarah is coding an automation script to switch to iFRAME in a web application. Which of the
listed options will help Sarah to switch to a particular frame on a web page using the
webdriver library?
a) driver.switchTo().frame(int index)
c) driver.switchTo().frame(WebElement frameElement)
d) driver.switchTo().frame()
e) driver.switchTo().iframe(String name)
3. Sean is coding to automate mouse interactions on a web browser. Assist Sean to identify
the mouse event specific methods from the below options.
a) moveToElement()
b) moveByOffset()
c) release()
d) keyUp()
e) keyDown()
f) sendKeys()
4. What method in the Web driver library is used to get the attribute value of a web element?
a) getAttributeValue(“attributeName”)
b) getAttribute(“attributeName”)
c) getValue(“attributeName”)
d) getText()
@Test(priority=1)
@Test
@Test
@Test(priority=2)
}
Predict the test method execution sequence.
6. Sarah is coding to automate a test scenario in which she must fetch the booking id as a
text message from the span element.
The web element looks like: <span>Order Completed With Booking ID:6665</span>
Help Sarah to find a method from the WebDriver Library to fetch the Booking ID.
a) getValue()
b) getID()
c) getText()
d) getTagName()
7. 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?
a) Info
b) Minor
c) Major
d) Critical
f) Henry is designing a script and using css selector as the locator strategy. He
must locate the element effectively. The element inspected looks like
ans: By.CssSelector(“input[id=’password’]”)
g) There is an element on the web page when inspected on the browser it looks
like
Ans: By.CssSelector(“div.errorMsg”)
i) When verification fails in TestNG, what forces the test to stop execution and
mark as failed. Choose the most appropriate option.
j) Which java enum is used to handle the keyboard strokes from web driver
library? Choose the most appropriate option.
Ans: keys
1) Testing an automation script to test a web application. He has to store the Logout link in the
using a driver.findElement() method. Suggest Sean with a compatible return to leg out least
object.
(a) String
(b) WebDriver
(c) WebElement
(d) List
Sub-topic: TestNG
2) Which of the following is correct about generating about an XML suite file in TestNG for Test
Suite Exception.
(a) TestNG XML suite can be generated at time of creating TestNG class.
(b) TestNG XML suite can be generated using "Convert to testNG" option..........class
is created.
(c) TestNG XML suite file is automatically generated when user create a maven java
project.
Ans: (a) TestNG XML suite can be generated at time of creating TestNG class.
3) Sarah is coding an automation script to switch to multiple windows in a web application . She
has to store all the window instance in a java variable which is returned by
driver.getWindowHandles(). Suggest Sarah with a compatible return type to store the window
References.
(a) List<String>
(b) Set<String>
(c) Array<String>
(d) Window<String>
(a). ExtentHtmlReporter.
(b). ExtentReports
(c). MarkupHelper
(d). ExtentTest.
Ans: ( c) MarkupHelper.
5) Sean is coding an automation Script to launch the web application on a browser window.
Which of the following listed option(s) will help Sean to lunch the desired application on a web
browser in selenium?
(a). driver.get(“URL”)
(b). driver.navigate().to(“URL”)
(c). driver.navigate(“URL”)
(d). driver.getUrl(“URL”)
(e). driver.setUrl(“URL”)
(b) driver.navigate().to("URL")
6) Sarah is coding an automation Script to locate a child element in an unordered list. The list is
given below:
<html>
<body>
<ul class=”cities”>
<li>Bangalore</li>
<li>Chennai</li>
<li>Hydrabad</li>
<li>Mumbai</li>
<li>Pune</li>
</ul>
</body>
</html>
Sarah wants to locate the 3rd child element i.e Hydrabad. Suggest the appropriate locator
stratgy for
Sarah.
7) James wants to automate the selection of ID proofs drop-down box in the web application. He
has to verify the drop-down has a selection of more than one option. Which of the following
method is suggested to James?
Ans : isMultiple()
8) Kavin is using CSS selector as a locator strategy for the following element: <h1 id”msg01”
name=”success” > Registeration Completed </h1>
Ans: By.cssSelector("h1[id='msg01']")
By.cssSelector("h1[id='msg01'][name='success']")
1) Which is an IDE extension that helps you detect and fix quality issues as you write code in
python/HTML/Javascript/PHP?
SonarQube
SonarLint
SonarQubeServer
driver.switchTo().frame(int index)
driver.switchTo().frame(String nameOrld)
driver.switchTo().frame(Webelement frameElement)
driver.switchTo().frame()
driver.switchTo().iframe(String name)
Given the user is on the Payment Page, he views a text box with attribute value=”Enter
Mobile Number” written inside the box. The user must enter the mobile number in the
box.
Please check the correct command to help Kevin in automating this scenario. Assume
that text box element is already identified and stored in mobileTxtBox variable.
mobileTxtBox.clear(); mobileTxtBox.sendKeys(“9090909090”);
mobileTxtBox.sendKeys(“9090909090”);
mobileTxtBox.sendKeys(“9090909090”);mobileTxtBox.clear();
mobileTxtBox.value=”9090909090”;
4) Which Java enum is used to handle the keyboard strokes from WebDriver Library?
Actions
Keyboard
Keys
Keyword
1. Which java interface is used to capture screenshot of a web page using web driver API ?
Ans: TakeScreenshot
2. Henry is designing a script and using CSS Selector as the locator strategy. He must locate the
element effectively. The element inspected looks like:
ANS : By.cssSelector("input[id='newPassword']")
3. 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.
4. Kevin is using a CSS Selector as a locator strategy for the following element:
5. Testing an automation script to test a web application. He has to store the Logout link in the
using a driver.findElement() method. Suggest Sean with a compatible return to leg out least
object.
Ans:WebElement
6. While using soft assertion in the test class, james must specify a method, that will collate and
display assertion results
Ans:assertAll()
7. Sarah is coding to automate a test scenario in which she must fetch the booking id as a text
message from the span element.
The web element looks like: <span>Order Completed With Booking ID:6665</span>
Help Sarah to find a method from the WebDriver Library to fetch the Booking ID.
Ans: getText()
8. Sean is coding to automate mouse interactions on a web browser. Assist Sean to identify the
mouse event specific methods from the below options.
Ans: moveToElement(),moveByOffset(),release()
9. Which date format is used to customize the system data to year-month-day format?
ANS:new SimpleDateFormat(“yyyy-MM-dd”)
10. What are the various status options available in the Extent reports library?
Ans:PASS,FAIL,SKIP,FATAL,ERROR,WARNING,INFO
11. James is automating a script and using CSS Selector as a locator. What are the primitive
types for designing the CSS selector?
12. Sam has created a TestNG project with below specified TestClass.
@Test(priority=1)
@Test
@Test
@Test(priority=2)
}Predict the test method execution sequence.Choose the most appropriate option.Ans:method2,
method3, method1, method4.
Q:1 Sarah wants to automate the selection of only one option from a dropdown box as shown
below
<html>
<body>
<select multiple>
<option value=”web”>html</option>
<option value=”prog”>python</option>
<option value=”prog”>java</option>
<option value=”prog”>python</option>
<option value=”prog”>java</option>
</select>
</body>
</html>.
Sarah has to select only the fourth option,i.e,python from the options field.
Ans: selectByVisibleText()
selectByValue()
selectByIndex()
Q2: Sean is automating a test scenario, in which he has to fetch the URL of the web page using
WebDriver API. Suggest a method for Sean to get the link address
Ans:-getURL()
get()
getCurrentURL()
getURI()
Q3: 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?
a parallel = “methods”
b parallel="tests"
c parallel = “test-classes”
d parallel =”test-cases”
Q4: Fuller has written an automation script using selenium webdriver commands. He has used all
the necessary and appropriate locators for interacting with the web elements. When he executed
the script the web driver was not able to locate an element resulting in the test script failure. Which
error/ exception is thrown by webdriver?
NoSuchElementException ✔️
NoSuchElementError
NullPointerException
ObjectNotFoundException
Q5: Kevin is designing an automation test, where test data is specified in an external excel file.
Which command will be helpful to write the data into a cell of the excel file? Assume c1 is the cell
object.
a c1.setCellValue("data")
b c1.setValue(“data”)
c c1.writeCellValue(“data”)
d c1.setCellData(“data”)
Q6: Which of the following is correct about generating about an XML suite file in TestNG for Test
Suite Exception.
(a) TestNG XML suite can be generated at time of creating TestNG class.
(c) TestNG XML suite file is automatically generated when user create a maven
java project.
Q7: Which of the following Java classes are from the Extent API library?
ExtentReports ✔️
Status✔️
TakesScreenshot
Actions
Q8: Sean wants to switch to multiple frames on a web page when an operation is completed on a
frame and test flow needs to move to another frame. Calling the driver.switch To().frame()
immediately will not move the context to the next frame which is at the same level in DOM. The
test will first need to switch to the main document and then activate the desired frame. Which
method is used to switch back to the main document from the frame?
driver.switch To().mainDocument()
driver.switchTo().defaultContent()
Q9: Sam is designing an automation test, where test data is specified in an external excel file.
Which command will be helpful to get across to the 2nd sheet of excel file. Assume wb is the
workbook object.
a wb.getSheetAt(1)
b wb.getSheetAt(2)
c wb.getSheet(1)
d wb.getSheet(2)
Q10: Sean is performing verification using Assert class functions from TestNG. Suggest him the
corect method to verify the reference/address of the two objects to be identical
assert True(Object1,Object2)
assertRef(Obect1,Object2)
assertEquals(Object1,Object2)
assertSame(Object1,Object2)
Q11: Sean is coding an automation Script to launch the web application on a browser window.
Which of the following listed option(s) will help Sean to lunch the desired application on a web
browser in selenium?
(a). driver.get(“URL”)
(b). driver.navigate().to(“URL”)
(c). driver.navigate(“URL”)
(d). driver.getUrl(“URL”)
(e). driver.setUrl(“URL”)
(b) driver.navigate().to("URL")
Q12: Sarah is coding an automation Script to locate a child element in an unordered list. The list is
given below:
<html>
<body>
<ul class=”cities”>
<li>Bangalore</li>
<li>Chennai</li>
<li>Hydrabad</li>
<li>Mumbai</li>
<li>Pune</li>
</ul>
</body>
</html>
Sarah wants to locate the 3rd child element i.e Hydrabad. Suggest the appropriate locator
stratgy for
Sarah.
Q13: 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?
ExplicitWait
ImplicitWait
WebDriverWait
Expected Conditions
Q14: What are the various status options available in the Extent reports library?
e. PASS,FAIL,SKIP,FATAL,ERROR,WARNING,INFO
f. SUCCESS,FAIL,SKIP ,ERROR,WARNING,INFO
g. DONE,DEBUG,FAIL,SKIP,ERROR,WARNING,INFO
h. ABORT,PASS,FAIL,DONE,ERROR,WARNING,INFO
Q15: 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?
f. selectAllOptions()
g. getOptions()
h. getAllOptions()
i. getData()
j. getText()
Q16: Which java interface is used to capture screenshot of a web page using Web Driver API?
ANS: TakeScreenshot
Q17: There is an element on the webpages when inspected on the browser it looks like <div
call=”errorMsg”>Error Message</div>.
James wants to use selenium locations to identify the element. Choose the correct set of
commands to locate the elements efficiently.
By.CSS Selector(“div.errorMsg”)
By.CSS Selector(“div_errorMsg”)
By.CSS Selector(“errorMsg”)
Q18: ) Henry is designing a script and using CSS Selector as the locator strategy. He must locate
the element effectively. The element inspected looks like:
Ans:-By. CssSelector(“id=newPassword”)
By .CssSelector(“input.newPassword”)
By .CssSelector(“input_newPassword”)
By .CssSelector(“input[id$=’Password’]”)
Q19: Kevin is using a CSS Selector as a locator strategy for the following element:
ANS –
By.cssSelector(“h1[id=‘msg01’]”)
By.cssSelector(“h1[id=‘msg01’][name=‘success’]”)
Q20: 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.
Q21: Testing an automation script to test a web application. He has to store the Logout link in the
using a driver.findElement() method. Suggest Sean with a compatible return to leg out least object.
(a) String
(b) WebDriver
(c) WebElement
(d) List
1Q) Sean is coding an automation script to test a web application. He has to store the Logout Ink
in
a Java vanable using a driver findElement() method. Suggest Sean with a compatible return
a) String
b) WebDnver
c) WebElement
d) List
a) By.className('style1’)
b) By.id(‘Email')
c) By.name(‘Email’)
d) By.xpath(‘//label[@id='Email’]’)
3Q) James is automating a scnpt and using CSS Seleclor as a localor. What are the primitive
types
a) Id
b) Attribute
c) Inner Text
d) Tagname
3Q) Sean is performing verification using Assert class functions from TesTNG. Suggest him the
a) assert True(Object1.Object2)
b) assertRef(Obect1, Object2)
c) assertEquals(Object1, Object2)
d) assertSame(Object1, Object2)
4Q)Sean is coding an automation script for emulating user actions by mouse using the webdriver
library. Assist Sean to choose the correct syntax to create an object for Actions class from the
following options
d) Actions act=(Actions)driverInstance
e) Aclions.callMethods()
5Q) Samantha wants to write an automation script that determines the count of Hobbies
a) driver.findElement(By.name("hobbies")).getCount()
b) driver.findElement(By.name("hobbies")).size()
c) driver.findElement(By.name("hobbies")).length()
d) driver.findElements(By.name("hobbies")).getCount()
e) driver.findElements(By.name("hobbies")).size()
6Q) Which Java Interface is used to capture screenshot of a web page using Web Driver API?
a) ScreenShot
b) Capture
c) TakesScreenshot
d) Image
7Q) Which date fomat is used to customize the system date to year-month-day format?
a) new SimpleDateFormat("yyyy-mm-dd")
b) new SimpleDateFormat("yyyy-MM-dd")
c) new SimpleDateFormat("yyyy-month-dd")
d) new SimpleDateFormat("yyyy-mmm-dd")
8Q) Sarah is coding an automation script to switch to IFRAME in a web application. Which of the
listed option(s) will help Sarah to switch to a particular frame on a web page using the webdriver
library?
9Q) Identify the correct way of launching the Chrome browser through WebDriver Instance with
the
correct property
a) System.setProperty("webdriver.chrome.driver”, "src/test/resources");
b) System.setProperty("webdriver.chrome.driver","src/test/resources/chromedriver.exe");
System.setProperty("webdriver.chrome.driver","src/test/resources/chromedriver.exe");
d) System.getProperty("webdriver.chrome.driver","src/test/resources/chromedriver.exe");
A ExtentReports
B Status
C TakesScreenshot
D Actions
@Test
@Test
@Test
Kevin executes the above TestClass as a TestNG test. Which of the following correctly
12Q) Sarah coding a test script using TestNG classes. She has used all the necessary Assert
funtions to verify the test scripts When she executes the script. TestNG detected failures
Predict what type of message objects are thrown in the console as output?
A Exception Messages
B Error Messages
C Warning Messages
13Q) Sarah is validating the Registration Page for TestMe App using TestNG Assertions. She
wants
to execute all the validation statements and display the status as Pass/Fail, along with failure
messages if any. Which type of assertions are recommended to Sarah for implementation
A Soft Assertions
B Hard Assertions
C Hard Exceptions
D Soft Exceptions
14Q) Kevin is automating a test scenario, in which he wants to locate an element with the class
attribute "classg1 jkyu_90". Assist Kevin in setting up the correct locator for the element.
By.className(“classg1 jkyu_90")
By.className(“classg1”)
By.class("classg1 jkyu_90”)
By.className(“jkyu_90")
15Q) Sarah is coding an automation script to switch to multiple windows in a web application. She
has to store all the window instances in a java variable which is returned by
driver.getWindowHandles(). Suggest Sarah with a compatible return type to store the window
references
List<String>
Set<String>
Array <String>
Window< String>
16Q) Sam is designing an automation test, where test data is specified in an external excel file.
Which command will be helpful to get across to the 2nd sheet of excel file. Assume wb is the
workbook object.
a wb.getSheetAt(1)
b wb.getSheetAt(2)
c wb.getSheet(1)
d wb.getSheet(2)
A. PHP
B. Python
C. JavaScript
Ans: C
Ans: B
Ans: A
A. DOS applications
B. Browser-based applications
C. GUI applications
Ans: B
A. storedVars
B. stored variables
C. VariablesStore
Ans: A
6. Which selenium command check whether specific text exists somewhere on the page?
A. verifyTextPresent
B. verifyTextPresent
C. CheckTextPresent
D. VerifyPresentText
Ans: A
Ans: B
A. Windows Software
B. Firefox Plug-in
C. Java Software
D. Flash Plug-in
Ans: B
9. What is called that scale for large test suites or test suites that must be run in multiple
environments?
A. Selenium-Grid
B. Selenium RC
D. Selenium NG
Ans: A
A. XML documents
B. MS-Word documents
C. MS-Excel documents
D. MS-PowerPoint documents
Ans: A
Ans: B
A. Registered Expression
B. Regular Expression
C. Regression Expression
D. Regional Expression
Ans: B
13. Which label is used as a prefix pattern to specify a globbing pattern parameter for a Selenese
command?
A. pattern
B. glob
C. regex
D. None
Ans: B
A. Test packs
B. Tests
C. Test blocks
D. Test pattern
Ans: B
A. Element title
B. Page title
C. Block title
Ans: B
16. Select the component which is NOT part of the Selenium suite.
A. Selenium IDE
B. Selenium RC
C. selenium grid
D. Selenium Web
Ans: D
17. Select the language which is NOT supported by the Selenium RC.
A. ASP
B. Java
C. C#
D. PHP
Ans: A
18. Select the name which is NOT the type of the locators.
A. ID
B. Name
C. Password
D. Link Text
Ans: A, C
A. No
B. Yes
Ans: B
20. Selenium IDE stands for
Ans: C
A. Google Chrome
B. Opera mini
C. Mozilla Firefox
D. Internet Explorer
Ans: C
22. Select the operating system which is NOT supported by Selenium IDE.
A. Unix
B. Linux
C. Windows
D. Solaris
Ans: A
Ans: A
24. The Selenium IDE is used
Ans: D
A. To run your test against different browsers (except HtmlUnit) on different operating systems.
Ans: A
26. Out of the following which can only test web applications
A. QTP
B. Selenium
Ans: B
27. Select the command which is NOT a type of assertion in Selenium IDE.
A. Assert
B. Verify
C. WaitFor
D. Wait
Ans: D
28. Select the method which selects the option at the given index.
A. selectByIndex()
B. selectIndex()
C. selectedByIndex()
D. selectByIndexes()
Ans: A
Ans: C
Ans: D
A. Yes
B. No
Ans: B
A. No
B. Yes
Ans: A
33. Which command can be used to enter values into text boxes?
A. sendsKeys()
B. sendKey()
C. sendKeys
D. sendKeys()
Ans: D
34. Select the language which is supported by The Selenium Web Driver
A. Perl
B. SQL
C. ASP
D. Cobol
Ans: A
A. Selenium Generator
B. Selenium IDE
C. Selenium WebDriver
Ans: C
36. Select the command in Selenium IDE used to open a page using the URL.
A. OpenRecord
B. Open
C. OpenText
D. OpenTable
Ans: B
37. In the case of Selenium IDE, the Source view shows your script in
A. DHTML format
B. J2EE format
C. XML format
D. HTML format.
Ans: C
Ans: A
39. Select the command which is used to check the presence of a certain element.
A. verifiable
B. verifyTitlePresent
C. verifyTextPresent
D. verifyElementPresent
Ans: D
40. Select the command which is used to print a string value or a variable in Selenium IDE.
Ans: B
A. Web driver
B. Selenium RC
C. Selenium IDE
D. Selenium Grid
Ans: A
42. Select the command which is used to compare the contents of a table with expected values.
A. verifiable
B. verifyTableData
C. verifiable
D. verifyTableCell
Ans: C
43. Select the command which is used to pause execution until the specified element becomes
present.
A. waitForElementPresent
B. waitForPagePresent
C. waitForTablePresent
D. waitForFieldPresent
Ans: A
44. Select the command that will NOT wait for a new page to load before moving onto the next
command.
A. clickAndWait
B. selectAndType
C. typeAndWait
D. selectAndWait
Ans: B
45. Select the command which is used to pause execution until the page is loaded completely.
A. waitForPageToLoad
B. waitForElementPresent
C. waitForPage
Ans: A
46. Select the syntax to locate an element using inner text.
A. css=tag:contains(“inner text”)
B. css=tag:value(“inner text”)
C. css=tag:attributes(“inner text”)
D. css=tag:class(“inner text”)
Ans: A
47. Select the command which is used to compare the actual page title with an expected value.
A. verifyTitle
B. verifiedTitle
C. verifyTitles
D. verifiedTitles
Ans: A
48. Select the command which is NOT used in verifying page elements.
A. verifyElementPresent
B. verifyElementRight
C. verifyElementNotPresent
D. verifyElementPositionLeft
Ans: B
49. Select the tab which gives feedback and other useful information when executing tests.
A. Information
B. Feedback
C. Reference
D. Element
Ans: C
B. TestNewGenerlization
C. TestNewGeneration
D. TestNextGenerations
Ans: A
51. Select the variation which finds elements based on the driver’s underlying CSS selector engine
in Web driver Selenium.
A. By.cssSelected
B. By.cssSelection
C. By.cssSelector
D. By.Select
Ans: C
52. Select the variation which locates elements by the value of the “name” attribute in Web driver
Selenium
A. By.name
B. By.nametag
C. By.tagname
D. By.nametags
Ans: A
53. Select the tab that shows which command Selenium IDE is currently executing.
A. Variable
B. Data
C. Information
D. Info
Ans: D
54. Which is a faster component between the selenium web driver and Selenium RC?
A. Selenium RC
Ans: B
55. Select the variation which locates elements by the value of their “id” attribute in Web Driver
Selenium
A. By.id
B. By.idno
C. By.id_no
D. By.tag_id
Ans: A
56. Select the Get command which fetches the inner text of the element that you specify in Web
driver Selenium.
A. getinnerText()
B. get_in_Text()
C. get_inner_Text()
D. getText()
Ans: D
57. Which Navigate command takes you forward by one page on the browser’s history in Web
driver Selenium.
A. navigate.forward()
B. navigate().forward()
C. navigate()_forward()
D. navigate_forword()
Ans: B
58. Which method is used when you want to verify whether a certain checkbox, radio button, or
option in a drop-down box is selected in Web driver Selenium
A. is_Selected()
B. select()
C. isSelected()
D. is_Select()
Ans: C
59. Which Component is used to run multiple tests simultaneously in different browsers and
platforms?
A. Selenium Grid
B. Selenium IDE
C. Selenium RC
D. Selenium Webdriver
Ans: A
60. Select the View which shows your script in HTML format.
A. Table View
Ans: B
61. Select the method which clears all selected entries in Web driver Selenium.
A. dselectAll()
B. deselect_All()
C. dselect_All()
D. deselectAll()
Ans: D
62. Method which selects the option which displays the text matching the parameter passed to it
A. selectVisibleText()
B. selectByVisibleText()
C. select_VisibleText()
D. select_ByVisibleText()
Ans: B
B. waitForTextPresent
D. waitForAlert
Ans: C
64. Select the command which retrieves the alert message and stores it in a variable that you will
specify.
A. storeAlert
B. storedAlert
C. store_Alert
D. storesAlert
Ans: A
65. Select the method which performs a context-click at the current mouse location.
A. click_Context()
B. context.Click()
C. contextClick()
D. context_Click()
Ans: C
B. 20 sec
C. 25 sec
D. 30 sec
Ans: D
Ans: B
A. storedVars
B. stored variables
C. VariablesStore
Ans: A
69. Which command should be used to confirm that test will pass in the future when a new
element is added after page loaded?
A. waitForElementPresent
B. pause
C. assertElementPresent
D. None of these
Ans: A
B. waitForTextPresent
C. waitForFramePresent
D. waitForPageToLoad
Ans: B
Ans: D
A. ID
B. XPath
C. CSS selector
D. Pattern matching
Ans: D
73. Which command is used to extend the time limit of WAITFOR command?
D. setTimeout.
Ans: D
74. ___________ finds the item ending with the value passed in. This is the equivalent to the
XPath ends-with. Is concern with?
A. ^=
B. $=
C. *=
D. &=
Ans: B
B. Selects all elements that follow the closing tab of the current elements.
Ans: B
B. This is comment
D. All of these
Ans: A
D. All of these
Ans: A
78. Which regular expression sequence that loosely translates to “anything or nothing?”
A. .* (dot star)
B. *. (star dot)
C. “?
D. *+
Ans: A
A. Wait
B. Exit
C. WaitForProperty
D. None of these.
Ans: A
A. ${variableName}
B. storedVars[‘variableName’].
C. Both of these
D. None of these
Ans: C
81. We use the dot (.) operator followed by either a * or a +. The + tells the regular expression that
there will be instances between “0” and “n”, while the * tells the regular expression that there will
be instances between “1” and “n”.
A. True
B. False
Ans: B
82. Applications do not have the items needed for the tests when the tests get to commands. To
get around this, we had a look at adding for waitFor commands to test. This is related to
A. Debugging tests
D. All of these
Ans: B
A. ID
B. XPath
C. CSS selector
D. Name
Ans:
D. B and C
Ans: C
A. By DOM query
B. BY XPath query
C. BY CSS sector
D. All of these
Ans: A
86. Which of the following is not verify and asserts method in Selenium?
A. VerifyElementPresent
B. VerifyElementNotPresent
C. VerifyText
D. VerifyTextAttributes
Ans: D
87. If you wanted to access the element that has the text “This element has an ID that changes
every time the page is loaded” in it, then which of the following is used:
A. //div[contains(@id,’time_’)]
B. //div[contains(@id_time())]
C. //div[parameter(@id_time())]
D. //div[parameter(@id,’time_’)]
Ans: A
88. To delete a cookie we need to call the deleteCookie method, passing in two parameters.
A. The first parameter is the name of the cookie, and the second parameter is where it was
created.
B. The first parameter is where it was created, and the second parameter is the name of a cookie.
C. None of these
Ans: A
A. 4444
B. 2222
C. 1111
D. 3333
Ans: A
91. In selenium, parent and child nodes are in the same query because HTML has a tree
structure.
A. True
B. False
Ans: A
92. Selects all the parent, grandparent, and so on of the element is related to which axis name in
Selenium:
A. Ancestor
B. Preceding
C. Parent
D. All of these.
Ans: A
A. ${variableName}
B. storedVars[‘variableName’].
C. Both of these
D. None of these
Ans: C
A. to display the value of a variable in the log file, which can be very valuable for debugging.
B. Display the value of a variable named answer in the log file, what would the first argument to
the previous command look like.
C. Both of these
D. None of these
Ans: C
If you want to validate that a button has appeared on a page, which two commands would be the
best two to use?
Ans: verifyElementPresent/assertElementPresent
If an element got added after the page has loaded what command would you use to make sure the
test passed in the future?
Ans: waitForElementPresent
Ans: Id
If you wanted to find the sibling input that is after an input in the DOM, what would the XPath look
like?
Ans: //input/following-sibling::input
Pick two from the following if you wanted do a partial match on an attribute on an element from the
beginning of the value:
(A) contains()
(B) starts-with()
What is the best call for finding multiple elements using XPath?
findElementsByXPath
Ans: No, it will not throw an exception. It will return an empty list.
Ans: All versions of IE6, IE7, IE8, and IE9 for both 32-bit and 64-bit installations
Ans : .*
Ans: waitForActive
Ans: sendKeys()
Which of the following method is used to work with multiple browser windows?
(C) getWindowhandle()
Ans: WebDriverWait
Ans: getText()
Ans: ID
This set of Software Engineering Multiple Choice Questions & Answers (MCQs) focuses
on “Software Control”.
View Answer
Answer: b
a) hard drive
b) access-controlled library
c) servers
d) access control
View Answer
Answer: b
Explanation: None.
a) CM Planning
c) CM audits
View Answer
Answer: d
4. CM is about managing the different items in the product, and changes in them.
a) True
b) False
View Answer
Answer: a
Explanation: None.
5. What allows different projects to use the same source files at the same time?
a) Version Control
b) Access control
c) CM Process
View Answer
Answer: a
View Answer
Answer: d
a) True
b) False
View Answer
Answer: a
Explanation: None.
8. What is one or more software configuration items that have been formally reviewed
and agreed upon and serve as a basis for further development?
a) Baseline
b) Cumulative changes
c) CM
d) Change Control
View Answer
Answer: a
a) By reviews
b) By inspections
c) By testing of code
View Answer
Answer: c
a) SCM procedures
b) Source code
Answer: d
a) True
b) False
View Answer
Answer: a
Explanation: None.
View Answer
Answer: a
Explanation: None.
View Answer
Answer: d
2. What is a repository
Ans. Vim
14. You want to use a Git status to chech the state of a file
Ans. Tracked
16. List the steps that we need to complete before we can set
17. Specify the commands that we can use to add and manage
20. Specify some of the key technologies that are involved in the cloud computing
22. List some of the key tasks that we can perform with
Ans. Git lab provides the capability to run jobs in parallel on multiple machines
29. Recall the commands that we can use to create a directory tree
Ans.Imperative, Declarative
Ans.BitBucket, GitHub
48. Select some of the key tasks involved in the setting up agile teams
Ans. close
55. Consider there are three frames in a web page
Ans. switchTo.mainWindow()
Ans. id ,name
57. Which of the following commands should be used to extract more than
Ans. findElements
58. Which among the following is a term used in the testing of computer
Ans. True
Ans. All
62. . .
1) Which of the following field/column for requirements in excel format is used
to map the requirements folder in ALM?
Ans: Path
2) Which of the following best defines ALM as an integrated repository?
Ans: Link between requirements with releases & cycles
Link between defects with releases & cycles
3) By default, what does application life cycle management (ALM) assign when a
new defect is created?
Ans: A unique defect IO
4) Which of the following sections allows you to view coverage by cycle?
Ans: Requirement coverage
5) How many defects can be associated with a requirement?
Ans: Multiple defects
6) Which of the following elements of JMeter determines the order in which the
requests have to get processed?
Ans: Logic controllers
7) Which one of the following is not a controller in JMeter?
Ans: Condition controller
8) Which of the following represents a process where samplers are executes with
multiple sets of user input data?
Ans: Parameterization
9) Which of the following statements is true about pre-processors?
Ans: Pre-processors execute before the sampler requests are executed in the
test plan (only a)
10) Which assertion is used to test whether the API server response was
received within a given amount of time or not?
Ans: Duration
11) Which of the following defect states is marked by the developer when he is
analyzing the defect description?
Ans: Open
12) Which of the following test defines “Verification” & “Validation”?
Ans: Verification: Lalitha is reviewing the test script conduct by raju
Validation: Raju is updating the requirements traceability matrix for the
requirement coverage
13) John has raised a high priority defect in the morning and is waiting for the
fix to be completed. At 5pm he got a fix from the developer. Now he also need
to check the fix implemented does not introduce any new defects on the
system. What type of testing is he performing?
Ans: Regression testing
14) Consider the below html code snippet
Email:<label id=”Email” class=”Style1” name=”input”> Which of the best locator
to identify the Email web element?
Ans: By id (“Email”)
15) Which method in the web driver library is used to get the attribute value of
a web element?
Ans: getAttribute(“AttributeName”)
16) Sarah is coding an automation script, where she has to validate the price of
the holiday package based on the drag and drop of island only from the menu.
The price is fetched from the server and displays without reloading the
webpage. Which web driver library class has the pre defined conditions for
handling dynamic waits in selenium webdriver library?
Ans: WebDriver wait
17) Which of the following statement(s) is/are about the extent reports?
Ans: All of the above : Extent reports are customisable HTML Reports
Extent reports can be integrated with Selenium webdriver using TestNG/Junit
test frameworks
Extent reports can add events, screenshots, tags, devices, and any other related
information about test environment
18) Sean is coding an automation script for emulating user actions by mouse
using the webdriver library. Assist sean to choose the correct syntax to create
an object for actions class from the following
Ans: Actions act=new Actions(driver instance)
19) Which Java interface is used to capture screenshot of a webpage using
webdriver API?
Ans: TakeScreenshot
20) Sean wants to switch to multiple frames on a webpage when an operation
is completed on a frame an test flow needs to move to another frame, calling
the driver.SwitchTo().frame() immediately will not move the context to the
next frame which is at the same level in DCM. The test will first need to switch
to the main document and then activate the desired frame which method is
used to switch back to the main document from the frame?
Ans: driver.SwithTo().defaultContent()
21) Samatha wants to write an automation script that determines the count of
hobbies check boxes. These check boxes have a name attribute as ”hobbies”.
Assist Samatha by choosing the correct command
Ans: Driver.dindElements.By.name(“hobbies”).size()
22) Samatha is automating a test scenario. This scenario involves a pop up of a
confirmation window. She wants to interact with the pop up window and
decline the confirmation pop-up window that shows a message “Do you want
to cancel the payment?”. Choose correct code
Ans: Driver.SwithchTo().alert().dismiss()
23) Sarah is coding an automation script to switch to frame in a web
application. Help her to switch a particular frame on a web page using the
window library. She wants to interact with the pop up window and decline the
confirmation pop up window show a message “Do you want to cancel the
payment?”. Assist Samantha to interact with
Ans: Driver.SwitchTo().frame(int index)
Driver.SwitchTo().frame(String name or id)
24) Which of the following is correct about generating an XML Suite file is
TestNG for Test Suite execution?
Ans: Test NG XML suite file
Can be generated at the time of creating TestNG class
TestNG XML suite file can be generated using convert to TestNG option in Eclipse
after a java code
25) Sarah is designing an automation script using descriptive programming in
UFT for a web based Flight GUI application. Assist sarah with a tool to identify
the property of the test scripts
Ans: Object Spy
26) Sarah wants to slice a text to perform a test on a message. She used the
split function in VB Scripting to chop the strings. Predict the output for the
below code
Arr=Split(“this ”is ”VB”Scripting”,” ‘ ”)
Msgbox arr(2)
Ans: VB
27) In UFT which type of variable can be accessed by all actions, function
libraries and tests that have a global scope?
Ans: Environment variable
28) Which of the following types of applications can be tested using UFT?
Ans: Web app, SOAP and REST APIs
29) A retail application generates an order id on successful order placing. Order
id follows the pattern. Starts with TXN, followed by 3 digit number and ends
with any capital alphabet
Ans: ^TXNd[3]{A-Z}$
30) Jack wants to apply checkpoint in an existing test script. He decides to use
keyword view to insert checkpoint. Which all checkpoints can be inserted using
keyword view?
Ans: Only standard
31) What type of action can we create if others want to reuse that action, but
at the same time, it should be non-editable for others?
Ans: Reusable action
32) Chetan wants to add some additional information like the environment for
test execution, which method can be used to add the information in the test
method?
Ans: Add Run Information
33) Predict the output for the below code snippet Msgbox (“UFT” &
String(3,”T”))
Ans: 6
34) Many wants to add the HTML report snippet to have better clarity in the
test results. Which Reporter object method can be added to achieve the task?
Ans: ReportHTMLEvent
35) There are various elements in a SOAP message. Which element of the SOAP
message shows error message and status information?
Ans: Fault
36) Lisa is a new joiner to cucumber project assigned to execute the scenarios
marked as both OAT and UAT tags. Which of the following will assist Lisa to
execute the desired Scenario using tags from Cucumber option?
Ans: @CucumberOptions(tags=(“@OAT”,”@UAT”))
37) Henry wants to write some comments in the feature file. Which character
command is used to define comments in the feature file?
Ans: #
38) Kevin is creating a feature file with multiple scenarios. He wants to apply
multiple tags to a scenario. Which of the following best requirements the
technique to apply multiple tag names?
Ans: @Tag1,@Tag2
39) Which statements are true about feature file?
Ans: only 1, 2 & 3 : A feature file contains multiple scenarios
Feature Gherkin keyword is always written as first high level keyword in a feature
file
There can be multiple feature file in a project
40) No question
@when(“Kevin enters quantity as{int}item(3)”)
@Then(“Shopping cart icon shows {int}”)
41) Which of the following is not a valid element in the JMeter test plan?
Ans: Annotation
42) Which of the following is past processor in JMeter ?
Ans: Regular expression Evaluator
43) Which of the following parameters can be configured using a thread group?
Ans: Ramp-up period
Loop count
44) Which among the following is an invalid controller in JMeter?
Ans: State controller
45) Which of the following fields in the defect log helps the tester to prioritize
and fix the defect?
Ans: Severity
46) Sean is coding an automation script to test a web application. He has to
store the largest link in a java variable using a driver find element() method.
Suggest Sean with a compatible return type to store the logout test object?
Ans: WebElement
47) James want to automate the selection of ID proofs drop down box in the
web application . He has to verify the drop down box has a selection of more
than one option. Which of the following method is suggested to JMeter?
Ans: Ismultiple()
48) When verification fails in TestNG. What forces the test to stop execution
and mark as fail?
Ans: Assertion Fail
49) Kavin 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?
Ans: Markup Helper
50) Sean configured this project for the test Suite execution using TestNG. He
wants to perform parallel execution using TestNG. Which attribute represents
the parallel execution of the test cases?
Ans: Parallel=”tests”
51. Kevin is using CSS selector as a locator strategy for the following element <h1
id =”msg1” name=”success”>Registration completed</h1>. He must identify the
element efficiently.
Ans: .By CSS Selector(“h1[id=’msg01’]”)
.By CSS Selector(“h1[id=’msg01’][name=’success’]”)
52. There is an element on the webpages when inspected on the browser it looks
like <div call=”errorMsg”>Error Message</div>. James wants to use selenium
locations to identify the element. Choose the correct set of commands to locate
the elements efficiently.
Ans: By CSS Selector(“div.errorMsg”)
53. Sarah wants to automate the selection of only one option from a dropdown
box as shown below
<html>
<body>
<select multiple>
<option value=”web”>html</option>
<option value=”prog”>python</option>
<option value=”prog”>java</option>
<option value=”prog”>python</option>
<option value=”prog”>java</option>
</select>
</body>
</html>.
Sarah has to select only the fourth option,i.e,python from the options field.
Ans: Select By Index()
54. Identify the valid statement from the below given options.
Ans: Browser(name i=Demowebshop).page(page i=”.*”).WebEdit(“Emailiq”) Set
Prince
55. Neha is an automation tester working for TestMe project. She wants to log
some information in the UFT tet result pane. Which reporter object method is
more relevant in the situation?
Ans: MicDone
56. UFT supports various debugging techniques that help us in finding the issues
in the automation script. Which technique allows us to change the value of local
variables at runtime to understand the behaviour?
Ans: Console
57. Which of the following statements regarding actions in UFT is incorrect?
Ans: In actions, parameters are passed by value and by
58. To execute a cucumber scenario, which file(s) are important and must be
created in the maven project?
Ans: .feature file, .step definition
59. Henry wants to generate JSON reports on the execution of Test Runner in
cucumber. Assert Henry with the right option to configure the JSON report
generation in @Cucumber options?
Ans: @Cucumber Options({plugin=pretty,”html:report.html”})
60. Henry has created a feature file with tagged scenarios. He wants to execute all
the scenarios excluding “SevereTag” scenarios. What command should he use in
cucumber options for TestRunner class?
Ans: tags=(“~@SevereTag”)
61. Which of the following will control the amount of time Jmeter will execute a
test plan?
Ans: Test duration
62. Which of the following types of applications can be tested using Jmeter?
Ans: All of these
63. Jude is testing the login page of an application that contains 10 fields. He has
analyzed the data dictionary to derive the test data for the login page. He has
tested the application with all the combinations as it was a mandatory task
required for the project. However, he is sure that 0% of defects do not guarantee
the process success from the customers perspective, please predict the testing
principle that he is referring to in the above statement?
Ans: Exhausting testing not possible
64. Which of the following styles of writing test scenario ids will represent clearly
the referenced test scenario and help the testing team for tracking purposes?
Ans:
65. Sean is coding to automate a test scenario in which he has to click on a
dynamic link to navigate to the shopping cart page.
The web element looks like <a href=”icart.jsp? params”>cart[19]</a>. Which
locator is most recommended for the scan to identify the cart web element for all
test iterations ?
Ans: By.partial link Text()
66. Kevin wants to fetch all the data from the country dropdown 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 dropdown box .Which method
helps Kevin?
Ans: get options()
67. What does double forward slash // represent in xpath selenium locations?
Ans: relative xpath
68. Kevin is planning to write automation script for below scenario.
Given the user is on the payment page. He views a textbox with attribute values .
“Enter Mobile Number” written in the box. The user must enter the mobile
number in the box to proceed. Please choose the correct command to help Kevin
in automating the scenario. Assume the textbox element is already identified and
stored in mobile txt box variable .
Ans: mobileTxtBox.sendKeys(“xxxxxxxxxx”)
69. Henry is designing a script and using CSS selector as the locator strategy. He
must locate the element efficiently. The element inspected looks like <input
id=”new password” type=”password”>.
Ans: By CSS Selector(“input[id=password]”)
70. Kevin is designing an automation test, where test data is specified in an
external excel file. Which command will be helpful to write the data into a cell of
the excel file? Assume c1 is the cell object.
Ans: c1.SetCellValue(‘data’)
71. <html>
<body>
<ul class = ”cities” >
<li>Bangalore</li>
<li>Chennai</li>
<li>Mumbai</li>
<li>Bangalore</li>
<li>Pune</li>
</ul>
</body>
</html>
Sarah wants to locate the 3rd child element i.e. Hyderabad.Suggest the
appropriate locator strategy by Sarah.
ANS- CSS=”ul.cities.li inth of type(“Hyderabad”)”
72. UFT supports various synchronization techniques that helps us to manage
web applications. Which technique is applied only to webpages and browsers ?
ANS- Sync.
73. Consider a test String to be “order 200 completed”. which of the below
regular expression(s) will not match the given string?
ANS- order [0-9]+Completed
74. Henry had bined a project team. The team is using the BDD framework for
effective testing . Henry must understand keywords in Cucumber. Which gherkin
keyword indicates the pre-conditions / pre- requests steps in a feature file?
ANS- Given
75. Samantha has created a feature file in a project. she wants to configure the
Test Runner class using feature files/glue tags. Which of the following is the
correct set annotations to be used in the test runner?
ANS- @Runwith ; @Cucumber options.
76. Write in corect order
a. Triggers the build
b. Open reports to see the latest test results
c. Jenkins checks the Git Repository periodically to detect changes in build
project.
d. The build is successful / Failure.
e. Testers/ Developers commits source code changes to the shared Git
Repository
ANS-
77. Which of the following elements of Jmeter executes after the sampler
requests are executed in the test plan?
ANS- Post Processors.
78. Sarah is coding in a test scenario, in which she must fetch the booking id as a
text message from the span element
The web element looks like <Space> order completed with Booking
id:6665<Space>
Help Sarah to find a method from the webdriver library to fetch the booking ID?
Ans- get Text();
79. James is automating a script and using CSS Selector as a locator. What are the
primitive types for designing the CSS selector?
ANS- .id, . Attribute, .innerText()
80. Which expression is used in CSS Selectors to match the attribute value with a
prefix?
ANS- ^=
81. Sean is coding an automation Script to launch the web application on a
browser window. Which of the following listed option(s) will help Sean to launch
the designed application on a web browser in Selenium?
ANS- .driver.get(“URL”) , .driver.navigate().to(“URL”)
82. Which date format is used to customize the system date to Year-Month-day
format?
For example 2019-04-24
ANS- new Simple Date Format(“YYYY-MM-dd”).
83. Select the correct order of execution of annotations, as per the life cycle of
Test NG which can be applied for test methods along with before XXXX-after
XXXX methods
ANS- Before test, Before class, Before method , test , After method, After class ,
After test .
84. Sam has created a Test NG project with below specified Test class
Public class Test class
{
@Test (Priority = 1)
Public void method 1() (-----)
@Test
Public void method 3() (-----)
@Test
Public void method 2() (-----)
@Test
Public void method 4() (-----) }
ANS- Method 2 - Method - 3 Method - 1 Method – 4
85. What are the various status options available in the Extent Reports library?
ANS- PASS , FAIL , SKIP , FATAL , ERROR , Warning , INFO
86. Sarah wants to perform a few scenarios using a do-while loop in UFT. She has
written the below code. Predict the number of times the loop will be executed ?
i=10
Do while (i<5)
msg box i
i=i+1
loop
ANS- Does not execution in the condition
87. Predict the Output for the below code snippet
Dim Str
Str = Str Reverse (mid (“Unified functional testing”,4,9))
Print Str
ANS- couf deif
88. Predict the Output for the below code snippet
Dim a,b
a= ”vbscript”
b= Left (Right (a,3) 2)
print
ANS- ip
89. Which of the following reports can be generated using plugins from
Cucumber options?
ANS- All of the above
90. James wants to design a scenario in a feature file, in which the complete
scenario runs multiple times for different data sets . Suggest James with a Gherkin
keyword to activate drop-down testing in the feature file ?
ANS- Use Scenario outline.
91. Jack had created the feature file with the below mentioned scenarios as
shown below:
@smoke
Scenario: This is the first scenario
@crash
Scenario: This is the second scenario
In test runner class, Jack mentioned @cucumberoptions (tags=(“smoke”)) predict
which scenario is/are gets executed
Ans: Execute first scenario
92.Which of the following is the logical container that contains all the elements
which drive the performance test?
Ans: Load Testing
93. Which of the following assertions is not applied in Jmeter?
Ans: web
94. Which of the following is an invalid configuration element in Jmeter?
Ans: FTP cookie manager
95. Which of the following input documents is used to create test scenarios and
conditions?
Ans: Use cases
96. Which of the following Java classes are from the extent API library?
Ans: ExtentReports, Status
97. Sean is coding to automate a web application using the webDriver library. He
had set the implicit wait of 30 seconds. However, the webelement was found
within 10s . Will the webdriver wait for further 20 seconds before executing the
next line of code?
Ans: Yes, webDriver will wait 20 more seconds.
98. 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
Ans: sheet.getRow(rowno).getcell(col no).getStringCellValue()
99. Sarah is coding to automate script to switch to multiple windows in a web
application. She has to store all the window instances in a java variable which is
retrived by driver.getWindowHandles(). Suggest sarah with a compatable return
type to store the window references.
Ans: list <string>
100. 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
Ans: .(wildcard character)
101. Which Gherken keyword is used to create/execute as a common given step
for all the scenarios in the feature table?
Ans; Background
102. 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?
Ans: put
103.
104. Which parameter types in cucumber expressions matches text without white
space?
Ans:{ word}
105. Sean is automating a test scenario in which he has to fetch the URL of the
webpage using webDriver API. Suggest a method fo Sean to get the link address
Ans: getCurrentURL()
106. Ans: No such element Exception
107. Sean is performing verification using assert class functions from TestNG.
Suggest him the correct method to verify the reference/address of the two
objects to be identical?
Ans: assertSame(object1,object2)
108. Sam is designing an automation test where test data is specified in an
external excel file. Which command will be helpful to get access to the 2nd sheet
of the excel file. Assume web is the writebook object
Ans: who.getSheetA1(1)
110. Which of the following is a listener in JMeter?
Ans: All the above (Assertion results, Monitor results, Aggregate report)
111. Sarah is coding to automate a scenario for the selection of the “from Cities”
drop down box on the flight booking application web page, which class is used?
Ans: Select Class
112. Which of the following elements of JMeter helps to validate whether on
application is returning on excepted response or not?
Ans: Assertion
113. Which controller in JMeter you organize the samples & other logic
controllers?
Ans: Simple
114.
Ans: Once Only
115.
Ans: WebElement element 01 = driver.findelement(By.id(“Searchbox”));
116.
Ans: Test Driven Development
117. Trigger all scenarios
Ans: Feature file
118. BDD Process
Ans: 2-3-1-4-5
119. Selenium Grid (Multiple Box)
120. standard
Standard, Text and Bitmap (Active Screen)
SELENIUM
1. Sean is coding to automate a web application using the webDriver library. He had set the implicit
wait of 30 seconds. However, the webelement was found within 10s. Will the webdriver wait for
further 20 seconds before executing the next line of code?
2. 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
3. Sarah is coding to automate script to switch to multiple windows in a web application. She has to
store all the window instances in a java variable which is retrived by driver.getWindowHandles().
Suggest sarah with a compatable return type to store the window references.
Ans:Set <string>
4. 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?
Ans: add
5. Sean is automating a test scenario in which he has to fetch the URL of the webpage using
webDriver API. Suggest a method fo Sean to get the link address
Ans: getCurrentURL()
6. 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
1) Which of the following is correct about generating XML suite file in testNG for Test Suite
Execution
a TestNG XML Suite file can be generated at the time of creating a TestNG class.
b TestNG XML Suite file can be generated using ‘convert to TestNG’ option in Eclipse after a java
class is created.
c TestNG XML Suite file can be automatically generated when user creates a maven java project
a driver.get(“url”)
b driver.navigate().to(“URL”)
c driver.navigate(“URL”)
d driver.getUrl(“URL”)
e driver.setUrl(“URL”)
3) Sam is designing an automation test, where test data is specified in an external excel file. Which
command will be helpful to get across to the 2nd sheet of excel file. Assume wb is the workbook
object.
a wb.getSheetAt(1)
b wb.getSheetAt(2)
c wb.getSheet(1)
d wb.getSheet(2)
4)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?
a parallel = “methods”
b parallel="tests"
c parallel = “test-classes”
d parallel =”test-cases”
5) Kevin is designing an automation test, where test data is specified in an external excel file. Which
command will be helpful to write the data into a cell of the excel file? Assume c1 is the cell object.
a c1.setCellValue("data")
b c1.setValue(“data”)
c c1.writeCellValue(“data”)
d c1.setCellData(“data”)
6) Sarah wants to automate the selection of only one option from a drop-down box as shown
below.
<html>
<body>
<select multiple>
</select>
</body>
</html>
Sarah has to select only the fourth option i.e. python from the option list .
a selectByVisibleText()
b selectByValue()
c selectByIndex()
DDT
Sam is designing an automation test, where test data is specified in an external excel file. Which
command will be helpful to get access to the 2nd sheet of the excel file. Assume wb Is the workbook
object
wb.getSheetAt(1)
wb.getSheetAt(2)
wb.getSheet(1)
wb.getSheet(1)
EXTENT REPORTS
Which of the following Java classes are from the Extent API library?
ExtentReports
Status
TakesScreenshot
Actions
SWITCHING TO WINDOWS
Which of the following methods is used to close all the opened windows of WebDriver Instance?
Close()
Quit()
Null()
Sleep()
ACTIONS
Sean is coding an automation script for emulating user actions by mouse using the webdriver library.
Assist Sean to choose correct syntax to create an object for actions class from the following options
New Actions(driverInstance)
Actions.callMethods()
EXTENT REPORTS
Which date format is used to customize the system data to year-month-day format?
new SimpleDateFormat(“yyyy-mm-dd”)
new SimpleDateFormat(“yyyy-MM-dd”)
new SimpleDateFormat(“yyyy-month-dd”)
new SimpleDateFormat(“yyyy-mmm-dd”)
WEBDRIVER API
Fuller has written an automation script using selenium webdriver commands. He has used all the
necessary and appropriate locators for interacting with the web elements. When he executed the
script the web driver was not able to locate an element resulting in the test script failure. Which
error/ exception is thrown by webdriver?
NoSuchElementException
NoSuchElementError
NullPointerException
ObjectNotFoundException
WEBDRIVER API
Samantha wants to automate selection of value from a drop down menu. When the element was
Inspected. She foundAgain
<html>
<body>
<select name=”jobrole”>
<option value=”2”>Lead</option>
<option value=”3”>Analyst</option>
</select>
</body>
<html>
Choose “lead” as the test data. Assist her by choosing the correct options.
selectByIndex(1)
selectByValue(2)
selectByVisibleText(“Lead”)
selectByValue(“2”)
Q1- Which expression is used in CSS selectors to match the attribute value with a prefix?
Ans: ^
@Test(priority=1)
@Test
@Test
@Test(priority=2)
Ans: method2,method3,method1,method4
1. Which java enum is used to handle the keyboard strokes from webdriver library?
a. Actions
b. Keyboard
c. Keys
d. Keyword
2. Sam is designing an automation test, where test data is specified in an external excelfile.
Which command will be helpful to get access to the 2nd sheet of the excel file. Assume wb is
workbook object.
a. wb.getSheetAt(1)
b. wb.getSheetAt(2)
c. wb.getSheet(1)
d. wb.getSheet(2)
3. sarah wants to automate the selection of only one option from a drop down box as shown
below
<html>
<body>
<select multiple>
<option value=”web”>html</option>
<option value=”prog”>python</option>
<option value=”prog”>java</option>
<option value=”prog”>python</option>
<option value=”prog”>java</option>
</select>
</body>
</html>
Sarah has to select only the fourth option that is python from the options list
a. selectByVisibleText()
b. selectByValue ()
c. selectByIndex()
d. all the above
4. What are the various status options available in the Extent reports library?
a. PASS,FAIL,SKIP,FATAL,ERROR,WARNING,INFO
b. SUCCESS,FAIL,SKIP ,ERROR,WARNING,INFO
c. DONE,DEBUG,FAIL,SKIP,ERROR,WARNING,INFO
d. ABORT,PASS,FAIL,DONE,ERROR,WARNING,INFO
5. Sean is automating a test scenario, in which he has to fetch the URL of the web page using
WebDriver API . Suggest a method for Sean to get the link address.
a. getURL()
b. get()
c. getCurrentURL()
d. getURL()
6. 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?
a. selectAllOptions()
b. getOptions()
c. getAllOptions()
d. getData()
e. getText()
7. QUESTION NOT VISIBLE , multiple options
a. driver.get(“URL”)
b. driver.navigate().to(“URL”)
c. driver.navigate(“URL”)
d. driver.getUrl(“URL”)
e. driver.setUrl(“URL”)
f. Sarah is coding in a test scenario, in which she must fetch the booking id as a text
message from the span element.
The web element looks like
<Space> order completed with Booking id:6665<Space>
Help Sarah to find a method from the webdriver library to fetch the booking ID?
Ans - getText();
g. James is automating a script and using CSS Selector as a locator. What are the
primitive types for designing the CSS selector?
ANS - .id, .Attribute, .innerText()
(Explanation - There are 5 types of CSS Selectors in Selenium tests-
ID, Class, Attribute, Sub-String, Inner Text)
h. Which expression is used in CSS Selectors to match the attribute value with a prefix?
ANS- ^=
(Explanation - [attr^=value] Represents elements with an attribute name of attr whose value
is prefixed (preceded) by value.)
k. Identify the correct way of launching the Chrome browser through WebDriver instance
with the correct property.
ANS -
System.setProperty("webdriver.chrome.driver","src/test/resources/chromedriver.exe
");
WebDriver driver = new ChromeDriver();
l. Samantha wants to write an automation script that determines the count of Hobbies
checkboxes. These checkboxes have a name attribute as “hobbies”. Assist Samantha
by choosing the correct command.
ANS –
driver.findElements(By.name(“hobbies”)).size()
m. Henry is designing a script and using CSS Selector as the locator strategy. He must
locate the element effectively. The element inspected looks like:
<input id=“newPassword” type=“password”>
ANS - By.cssSelector("input[id='newPassword']")
n. Kevin is automating a test scenario. In which he wants to locate an element with the
class attribute “classg1 jkyu_90”. Assist Kevin in setting up the correct locator for the
element.
ANS - By.className(“classg1”)
o. 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.
ANS - @BeforeTest, @BeforeClass, @BeforeMethod, @Test, @AfterMethod, @AfterClass,
@AfterTest
p. Sean is coding an automation script for emulating user actions by mouse actions using
webdriver library. Assist Sean to choose the correct syntax to create an object for
Actions class from the following options.
ANS -
Actions act = new Actions(driverinstance)
Actions act = new Actions()
Actions act = (Actions)driverinstance
q. Kevin is using a CSS Selector as a locator strategy for the following element:
<h1 id=“msg01” name=“success”>Registration completed</h1>
He must identify the element effectively.
ANS –
By.cssSelector(“h1[id=‘msg01’]”)
By.cssSelector(“h1[id=‘msg01’][name=‘success’]”)
89. Which of the following reports can be generated using plugins from Cucumber options?
90. James wants to design a scenario in a feature file, in which the complete scenario runs multiple
times for different data sets . Suggest James with a Gherkin keyword to activate drop-down testing
in the feature file ?
91. Jack had created the feature file with the below mentioned scenarios as shown below:
@crash Scenario: This is the second scenario In test runner class, Jack mentioned
@cucumberoptions (tags=(“smoke”)) predict which scenario is/are gets executed
92.Which of the following is the logical container that contains all the elements which drive the
performance test?
Ans: Load Testing Correct But, If Test Plan Available in option, Then, the correct Ans
will be Test Plan.
95. Which of the following input documents is used to create test scenarios and conditions?
96. Which of the following Java classes are from the extent API library?
97. Sean is coding to automate a web application using the webDriver library. He had set the implicit
wait of 30 seconds. However, the webelement was found / Test Plan correct correct correct Google :
ExtentReports correct within 10s . Will the webdriver wait for further 20 seconds before executing
the next line of code?
1) Which java enum is used to handle the keyboard strokes from webdriver library?
(a) Actions
(b) Keyboard
(c) Keys
(d) Keyword
2) Which expression is used in CSS selectors to match attribute value with a prefix?
(a)$=
(b)^=
(c)*=
(d)none
Ans: (b) ^=
3) Samantha wants to automate selection of valur from a drop…..
<html>
<body>
<select name=”jobrole”>
<option value=”1”>Manager</option>
<option value=”2”>Lead</option>
<option value=”3”>Analyst</option>
</select>
</body>
</html>
Ans: SelectByVisibleText(“Lead”)
SelectByValue(“2)
4) Sarah is coding an automation script to switch to IFRAME in a web application .Which of the
listed options(s) will help sarah to switch to a particular frame on a web page using the
webdriver library?
(a )driver.switchTo().frame(int index)
(b) driver.switchTo().frame(string nameOrld)
( c) driver.switchTo().frame(WebElement frameElement)
(d)driver.switchTo().frame()
(e) driver.switchTo().frame(String name)
ANS: (a) , (b), (c)
(a)ppt
(b)docs
(c)…
(d)…
Ans: POIFS
@beforeMethod
Public void method1() {…}
@afterMethod
@Test(dataProvider=”loginData”)
@data provider
****7) which method is used in apache poi library to fetch the cell value from a row? identify the
format of invoking the library functions to get value from a cell
(a)sheet.getStringCellValue()
(b) sheet.get(rowno).getstringCellvalue()
(d) sheet.get(rowno).getCell(colon).getstringCellvalue()
Ans : (c)
1. 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.
Ans selenium RC
2. George is reviewing the quality of the java code given to him using SonarQube and
described that the variables are named without following java variables naming
convention. Under which category this issue can be tracked in the tool?
Choose the most appropriate option.
Ans minor
3. Identify the correct flow of jenkins build, when a maven project job in Jenkins is triggered
for build
Ans testing.xml->pom.xml>testing classes>reports
4. Sarah is coding to automate a scenario for the selection of the “from Cities” drop down
box on the flight booking application web page, which class is used?
Ans Select Class
5. Sarah is coding in a test scenario, in which she must fetch the booking id as a text message
from the span element The web element looks like <Space> order completed with Booking
id:6665<Space> Help Sarah to find a method from the webdriver library to fetch the
booking ID?
Ans get Text();
6. Which expression is used in CSS Selectors to match the attribute value with a prefix?
Ans ^=
1. Samantha has designed a TestClass with the following methods:
@BeforeMethod
@AfterMethod
@Test(dataProvider=”loginData”)
@DataProvider
Suppose loginData() generates 5 sets of login credentials, how many times method1, method2 and
method 3 would be executed ?
2. Sarah is coding an automation script to switch to iFRAME in a web application. Which of the listed
options will help Sarah to switch to a particular frame on a web page using the webdriver library?
Choose the appropriate options.
a) driver.switchTo().frame(int index)
b) driver.switchTo().frame(String name Or id)
c) driver.switchTo().frame(WebElement frameElement)
d) driver.switchTo().frame()
e) driver.switchTo().iframe(String name)
3. Sean is coding to automate mouse interactions on a web browser. Assist Sean to identify the mouse
event specific methods from the below options.
a) moveToElement()
b) moveByOffset()
c) release()
d) keyUp()
e) keyDown()
f) sendKeys()
4. What method in the Web driver library is used to get the attribute value of a web element?
a) getAttributeValue(“attributeName”)
b) getAttribute(“attributeName”)
c) getValue(“attributeName”)
d) getText()
6. Sarah is coding to automate a test scenario in which she must fetch the booking id as a text
message from the span element.
The web element looks like: <span>Order Completed With Booking ID:6665</span>
Help Sarah to find a method from the WebDriver Library to fetch the Booking ID.
a) getValue()
b) getID()
c) getText()
d) getTagName()
7. 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.
a) Info
b) Minor
c) Major
d) Critical
e) 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.
Ans: jre , jdk ,meavon
f) Henry is designing a script and using css selector as the locator strategy. He must locate
the element effectively. The element inspected looks like
<input id =”new Password” type =”password”>
Choose the most appropriate option.
ans: By.CssSelector(“input[id=’password’]”)
g) There is an element on the web page when inspected on the browser it looks like
<div class=”errorMsg”>Error Message</div> James want to use selenium locators to
identify the element. Choose the correct set of commands to locate the element
effectively.
Ans: By.CssSelector(“div.errorMsg”)
h) Match the following tools with the correct description
ans: A-3 B-1 C-2
i) When verification fails in TestNG, what forces the test to stop execution and mark as
failed. Choose the most appropriate option.
Ans: Assertion Fail
j) Which java enum is used to handle the keyboard strokes from web driver library? Choose
the most appropriate option.
Ans: keys
1) Testing an automation script to test a web application. He has to store the Logout link in the
using a driver.findElement() method. Suggest Sean with a compatible return to leg out least
object.
(a) String
(b) WebDriver
(c) WebElement
(d) List
Sub-topic: TestNG
2) Which of the following is correct about generating about an XML suite file in TestNG for Test
Suite Exception.
(a) TestNG XML suite can be generated at time of creating TestNG class.
(b) TestNG XML suite can be generated using "Convert to testNG" option..........class is
created.
(c) TestNG XML suite file is automatically generated when user create a maven java project.
(d) There is no option in Eclipse to generate XML suite file.
(e) TestNG XML suite file can be generated by Jenkins
Ans: (a) TestNG XML suite can be generated at time of creating TestNG class.
(b) TestNG XML suite can be generated using "Convert to testNG" option..........class is
created.
Sub-topics: Switching to windows
(a) List<String>
(b) Set<String>
(c) Array<String>
(d) Window<String>
4) Kevin wants to generate expensive report for the test automation project. He decides to use
Extent Report Library. Which class in the library is used to create labels, code blocks and
tables in the report?
(a). ExtentHtmlReporter.
(b). ExtentReports
(c). MarkupHelper
(d). ExtentTest.
Ans: ( c) MarkupHelper.
5) Sean is coding an automation Script to launch the web application on a browser window.
Which of the following listed option(s) will help Sean to lunch the desired application on a
web browser in selenium?
(a). driver.get(“URL”)
(b). driver.navigate().to(“URL”)
(c). driver.navigate(“URL”)
(d). driver.getUrl(“URL”)
(e). driver.setUrl(“URL”)
(b) driver.navigate().to("URL")
Sarah wants to locate the 3rd child element i.e Hydrabad. Suggest the appropriate locator stratgy
for
Sarah.
7) James wants to automate the selection of ID proofs drop-down box in the web application.
He has to verify the drop-down has a selection of more than one option. Which of the
following method is suggested to James?
Ans : isMultiple()
8) Kavin is using CSS selector as a locator strategy for the following element: <h1 id”msg01”
name=”success” > Registeration Completed </h1>
Ans: By.cssSelector("h1[id='msg01']")
By.cssSelector("h1[id='msg01'][name='success']")
1) Which is an IDE extension that helps you detect and fix quality issues as you write code in
python/HTML/Javascript/PHP?
SonarQube
SonarLint
SonarQubeServer
2) Sarah is coding an automation script to switch to iFRAME in a web application. Which of the
listed options will help sarah to switch to a particular frame on a web page using the library?
driver.switchTo().frame(int index)
driver.switchTo().frame(String nameOrld)
driver.switchTo().frame(Webelement frameElement)
driver.switchTo().frame()
driver.switchTo().iframe(String name)
Please check the correct command to help Kevin in automating this scenario. Assume that
text box element is already identified and stored in mobileTxtBox variable.
mobileTxtBox.clear(); mobileTxtBox.sendKeys(“9090909090”);
mobileTxtBox.sendKeys(“9090909090”);
mobileTxtBox.sendKeys(“9090909090”);mobileTxtBox.clear();
mobileTxtBox.value=”9090909090”;
4) Which Java enum is used to handle the keyboard strokes from WebDriver Library?
Actions
Keyboard
Keys
Keyword
1. Which java interface is used to capture screenshot of a web page using web driver API ?
Ans: TakeScreenshot
2. Henry is designing a script and using CSS Selector as the locator strategy. He must locate the
element effectively. The element inspected looks like:
<input id=“newPassword” type=“password”>
ANS : By.cssSelector("input[id='newPassword']")
3. 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.
ANS :@BeforeTest, @BeforeClass, @BeforeMethod, @Test, @AfterMethod, @AfterClass,
@AfterTest
4. Kevin is using a CSS Selector as a locator strategy for the following element:
<h1 id=“msg01” name=“success”>Registration completed</h1>
He must identify the element effectively.
ANS :By.cssSelector(“h1[id=‘msg01’]”), By.cssSelector(“h1[id=‘msg01’][name=‘success’]”.
5. Testing an automation script to test a web application. He has to store the Logout link in the
using a driver.findElement() method. Suggest Sean with a compatible return to leg out least
object.
Ans:WebElement
6. While using soft assertion in the test class, james must specify a method, that will collate
and display assertion results
Ans:assertAll()
7. Sarah is coding to automate a test scenario in which she must fetch the booking id as a text
message from the span element.
The web element looks like: <span>Order Completed With Booking ID:6665</span>
Help Sarah to find a method from the WebDriver Library to fetch the Booking ID.
Ans: getText()
8. Sean is coding to automate mouse interactions on a web browser. Assist Sean to identify the
mouse event specific methods from the below options.
Ans: moveToElement(),moveByOffset(),release()
9. Which date format is used to customize the system data to year-month-day format?
ANS:new SimpleDateFormat(“yyyy-MM-dd”)
10. What are the various status options available in the Extent reports library?
Ans:PASS,FAIL,SKIP,FATAL,ERROR,WARNING,INFO
11. James is automating a script and using CSS Selector as a locator. What are the primitive
types for designing the CSS selector?
ANS - .id, .Attribute, .innerText()
12. 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.Ans:method2, method3, method1, method4.
Q:1 Sarah wants to automate the selection of only one option from a dropdown box as shown below
<html>
<body>
<select multiple>
<option value=”web”>html</option>
<option value=”prog”>python</option>
<option value=”prog”>java</option>
<option value=”prog”>python</option>
<option value=”prog”>java</option>
</select>
</body>
</html>.
Sarah has to select only the fourth option,i.e,python from the options field.
Ans: selectByVisibleText()
selectByValue()
selectByIndex()
All of the above
Q2: Sean is automating a test scenario, in which he has to fetch the URL of the web page using
WebDriver API. Suggest a method for Sean to get the link address
Ans:-getURL()
get()
getCurrentURL()
getURI()
Q3: 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?
a parallel = “methods”
b parallel="tests"
c parallel = “test-classes”
d parallel =”test-cases”
Q4: Fuller has written an automation script using selenium webdriver commands. He has used all the
necessary and appropriate locators for interacting with the web elements. When he executed the
script the web driver was not able to locate an element resulting in the test script failure. Which
error/ exception is thrown by webdriver?
NoSuchElementException
NoSuchElementError
NullPointerException
ObjectNotFoundException
Q5: Kevin is designing an automation test, where test data is specified in an external excel file.
Which command will be helpful to write the data into a cell of the excel file? Assume c1 is the cell
object.
a c1.setCellValue("data")
b c1.setValue(“data”)
c c1.writeCellValue(“data”)
d c1.setCellData(“data”)
Q6: Which of the following is correct about generating about an XML suite file in TestNG for Test
Suite Exception.
(a) TestNG XML suite can be generated at time of creating TestNG class.
(b) TestNG XML suite can be generated using "Convert to testNG" option..........class is
created.
(c) TestNG XML suite file is automatically generated when user create a maven java
project.
(d) There is no option in Eclipse to generate XML suite file.
Q7: Which of the following Java classes are from the Extent API library?
ExtentReports
Status
TakesScreenshot
Actions
Q8: Sean wants to switch to multiple frames on a web page when an operation is completed on a
frame and test flow needs to move to another frame. Calling the driver.switch To().frame()
immediately will not move the context to the next frame which is at the same level in DOM. The
test will first need to switch to the main document and then activate the desired frame. Which
method is used to switch back to the main document from the frame?
driver.switch To().mainDocument()
driver.switchTo().defaultContent()
Q9: Sam is designing an automation test, where test data is specified in an external excel file. Which
command will be helpful to get across to the 2nd sheet of excel file. Assume wb is the workbook
object.
a wb.getSheetAt(1)
b wb.getSheetAt(2)
c wb.getSheet(1)
d wb.getSheet(2)
Q10: Sean is performing verification using Assert class functions from TestNG. Suggest him the
corect method to verify the reference/address of the two objects to be identical
assert True(Object1,Object2)
assertRef(Obect1,Object2)
assertEquals(Object1,Object2)
assertSame(Object1,Object2)
Q11: Sean is coding an automation Script to launch the web application on a browser window.
Which of the following listed option(s) will help Sean to lunch the desired application on a web
browser in selenium?
(a). driver.get(“URL”)
(b). driver.navigate().to(“URL”)
(c). driver.navigate(“URL”)
(d). driver.getUrl(“URL”)
(e). driver.setUrl(“URL”)
Q12: Sarah is coding an automation Script to locate a child element in an unordered list. The list is
given below:
<html>
<body>
<ul class=”cities”>
<li>Bangalore</li>
<li>Chennai</li>
<li>Hydrabad</li>
<li>Mumbai</li>
<li>Pune</li>
</ul>
</body>
</html>
Sarah wants to locate the 3rd child element i.e Hydrabad. Suggest the appropriate locator stratgy
for
Sarah.
Q13: 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?
ExplicitWait
ImplicitWait
WebDriverWait
Expected Conditions
Q14: What are the various status options available in the Extent reports library?
e. PASS,FAIL,SKIP,FATAL,ERROR,WARNING,INFO
f. SUCCESS,FAIL,SKIP ,ERROR,WARNING,INFO
g. DONE,DEBUG,FAIL,SKIP,ERROR,WARNING,INFO
h. ABORT,PASS,FAIL,DONE,ERROR,WARNING,INFO
Q15: 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?
f. selectAllOptions()
g. getOptions()
h. getAllOptions()
i. getData()
j. getText()
Q16: Which java interface is used to capture screenshot of a web page using Web Driver API?
ANS: TakeScreenshot
Q17: There is an element on the webpages when inspected on the browser it looks like <div
call=”errorMsg”>Error Message</div>.
James wants to use selenium locations to identify the element. Choose the correct set of commands
to locate the elements efficiently.
Ans:-By. CssSelector(“id=newPassword”)
By .CssSelector(“input.newPassword”)
By .CssSelector(“input_newPassword”)
By .CssSelector(“input[id$=’Password’]”)
Q19: Kevin is using a CSS Selector as a locator strategy for the following element:
Q20: 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.
ANS - @BeforeTest, @BeforeClass, @BeforeMethod, @Test, @AfterMethod, @AfterClass,
@AfterTest
Q21: Testing an automation script to test a web application. He has to store the Logout link in the
using a driver.findElement() method. Suggest Sean with a compatible return to leg out least object.
(a) String
(b) WebDriver
(c) WebElement
(d) List
1Q) Sean is coding an automation script to test a web application. He has to store the Logout Ink in
a Java vanable using a driver findElement() method. Suggest Sean with a compatible return
a) String
b) WebDnver
c) WebElement
d) List
a) By.className('style1’)
b) By.id(‘Email')
c) By.name(‘Email’)
d) By.xpath(‘//label[@id='Email’]’)
3Q) James is automating a scnpt and using CSS Seleclor as a localor. What are the primitive types
a) Id
b) Attribute
c) Inner Text
d) Tagname
3Q) Sean is performing verification using Assert class functions from TesTNG. Suggest him the
a) assert True(Object1.Object2)
b) assertRef(Obect1, Object2)
c) assertEquals(Object1, Object2)
d) assertSame(Object1, Object2)
4Q)Sean is coding an automation script for emulating user actions by mouse using the webdriver
library. Assist Sean to choose the correct syntax to create an object for Actions class from the
following options
c) new Actions(driverInstance)
d) Actions act=(Actions)driverInstance
e) Aclions.callMethods()
5Q) Samantha wants to write an automation script that determines the count of Hobbies
a) driver.findElement(By.name("hobbies")).getCount()
b) driver.findElement(By.name("hobbies")).size()
c) driver.findElement(By.name("hobbies")).length()
d) driver.findElements(By.name("hobbies")).getCount()
e) driver.findElements(By.name("hobbies")).size()
6Q) Which Java Interface is used to capture screenshot of a web page using Web Driver API?
a) ScreenShot
b) Capture
c) TakesScreenshot
d) Image
7Q) Which date fomat is used to customize the system date to year-month-day format?
a) new SimpleDateFormat("yyyy-mm-dd")
b) new SimpleDateFormat("yyyy-MM-dd")
c) new SimpleDateFormat("yyyy-month-dd")
d) new SimpleDateFormat("yyyy-mmm-dd")
8Q) Sarah is coding an automation script to switch to IFRAME in a web application. Which of the
listed option(s) will help Sarah to switch to a particular frame on a web page using the webdriver
library?
9Q) Identify the correct way of launching the Chrome browser through WebDriver Instance with the
correct property
a) System.setProperty("webdriver.chrome.driver”, "src/test/resources");
b) System.setProperty("webdriver.chrome.driver","src/test/resources/chromedriver.exe");
System.setProperty("webdriver.chrome.driver","src/test/resources/chromedriver.exe");
d) System.getProperty("webdriver.chrome.driver","src/test/resources/chromedriver.exe");
A ExtentReports
B Status
C TakesScreenshot
D Actions
@Test
@Test
@Test
Kevin executes the above TestClass as a TestNG test. Which of the following correctly
12Q) Sarah coding a test script using TestNG classes. She has used all the necessary Assert
funtions to verify the test scripts When she executes the script. TestNG detected failures
Predict what type of message objects are thrown in the console as output?
A Exception Messages
B Error Messages
C Warning Messages
13Q) Sarah is validating the Registration Page for TestMe App using TestNG Assertions. She wants
to execute all the validation statements and display the status as Pass/Fail, along with failure
messages if any. Which type of assertions are recommended to Sarah for implementation
A Soft Assertions
B Hard Assertions
C Hard Exceptions
D Soft Exceptions
14Q) Kevin is automating a test scenario, in which he wants to locate an element with the class
attribute "classg1 jkyu_90". Assist Kevin in setting up the correct locator for the element.
By.className(“classg1 jkyu_90")
By.className(“classg1”)
By.class("classg1 jkyu_90”)
By.className(“jkyu_90")
15Q) Sarah is coding an automation script to switch to multiple windows in a web application. She
has to store all the window instances in a java variable which is returned by
driver.getWindowHandles(). Suggest Sarah with a compatible return type to store the window
references
List<String>
Set<String>
Array <String>
Window< String>
16Q) Sam is designing an automation test, where test data is specified in an external excel file.
Which command will be helpful to get across to the 2nd sheet of excel file. Assume wb is the
workbook object.
a wb.getSheetAt(1)
b wb.getSheetAt(2)
c wb.getSheet(1)
d wb.getSheet(2)
1. Sarah is coding in a test scenario, in which she must fetch the
booking id as a text message from the span element.
The web element looks like
<Space> order completed with Booking id:6665<Space>
Help Sarah to find a method from the webdriver library to fetch the
booking ID?
Ans - getText();
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.
ANS - @BeforeTest, @BeforeClass, @BeforeMethod, @Test,
@AfterMethod, @AfterClass, @AfterTest
25. Sarah wants to automate the selection of only one option from a
drop-down box as shown below.
<html>
<body>
<select multiple>
<option value = “web”> html</option>
<option value = “prog”> python</option>
<option value = “prog”> java</option>
<option value = “prog”> python</option>
<option value = “prog”> java</option>
</select>
</body>
</html>
Sarah has to select only the fourth option i.e., python from the
option list .
selectByIndex()
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
35. Samantha wants to automate selection of value from a drop-down
menu. When the element was Inspected. She found:
<html>
<body>
<select name=”jobrole”>
<Option value=”1”>Manager</option >
<option value=”2”>Lead</option>
<option value=”3”>Analyst</option>
</select>
</body>
<html>
Choose “lead” as the test data. Assist her by choosing the correct
options.
selectByIndex(1);
selectByVisibleText(“Lead”)
selectByValue(“2”)
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
42. Sean is working on a Test Automation project; He is looking for
different strategies for identifying the elements/objects from the
web application using Selenium locators. Suggest Sean with the
available locators in Selenium.
By.id()
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
48. Sarah is coding an automation script to switch to frame in a web
application. Help her to switch a particular frame on a web page
using the window library. She wants to interact with the pop-up
window and decline the confirmation pop up window show a
message “Do you want to cancel the payment?”. Assist Samantha to
interact with
Driver.SwitchTo().frame(int index)
Driver.SwitchTo().frame(String name or id)
Driver.switchto().frame(webelement frameelement)
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?
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
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?
ExtentReports
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()
80. 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
81. While using Soft Assertion in the Test Class, James must specify a
method, that will collate and display the assertion results.
assertAll()
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.
ANS - @BeforeTest, @BeforeClass, @BeforeMethod, @Test,
@AfterMethod, @AfterClass, @AfterTest
12. Kevin is using a CSS Selector as a locator strategy for the following
element:
<h1 id=“msg01” name=“success”>Registration completed</h1>
He must identify the element effectively.
ANS –
By.cssSelector(“h1[id=‘msg01’]”)
By.cssSelector(“h1[id=‘msg01’][name=‘success’]”)
18. Consider there are three frames in a web page, which method below
is used to comeback to main window before switching to any frame?
switchTo.defaultContent()
25. Sarah wants to automate the selection of only one option from a
drop-down box as shown below.
<html>
<body>
<select multiple>
<option value = “web”> html</option>
<option value = “prog”> python</option>
<option value = “prog”> java</option>
<option value = “prog”> python</option>
<option value = “prog”> java</option>
</select>
</body>
</html>
Sarah has to select only the fourth option i.e., python from the
option list .
selectByIndex()
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
selectByIndex(1);
selectByVisibleText(“Lead”)
selectByValue(“2”)
37. Which plugin can be used as an IDE (like Eclipse) extension that
helps to detect and fix quality issues of code written in
java/python/html/JavaScript/php?
Sonar Lint
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
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?
Markup Helper
54. Which java Enum is used to handle the keyboard strokes from web
driver library? Choose the most appropriate option.
Keys
55. There is an element on the web page when inspected on the browser
it looks like <div class=”errorMsg”>Error Message</div> James
wants to use selenium locators to identify the element. Choose the
correct set of commands to locate the element effectively.
By.cssSelector(“div.errorMsg”)
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.
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
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?
ExtentReports
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()
XLSX
75. Sarah is coding to automate a scenario for the selection of the “from
Cities” drop down box IN the flight booking application web page,
which WebDriver library class helps Sarah to automate the drop-
down box with different functions?
Select Class
80. 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
81. While using Soft Assertion in the Test Class, James must specify a
method, that will collate and display the assertion results.
assertAll()