0% found this document useful (0 votes)
21 views

Selenium Test

Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
21 views

Selenium Test

Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 224

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();

2. 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)

3. 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.)

4. Write in correct 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- e,c,a,d,b

5. Kevin has designed a TestClass with the following methods:


public class TestClass {
@Test
public void testMehod1() {int a = 78;}
@Test
public void testMehod2() {Assert.assertEquals(67, 76);}
public void testMehod3() {System.out.println("Welcome");}
@Test
public void testMehod4(){Assert.assertEquals("Hello”,
“Hello");} }
Kevin executes the above TestClass as a TestNG test. Which of the
following correctly represents the test result?
ANS - Total tests run: 3, Passed: 2, Failed: 1
6. 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();

7. 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()

8. 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']")
By.cssSelector("input[id$='Password']")

9. 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”)

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

11. 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
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’]”)

13. Which of the following method causes a thread to pause for a


specified duration?
pause()

14. What are the features of TestNG?


Annotation Based
Parallel Testing
Reporting

15. __ Closes all the associated windows of webdriver.


Quit()

16. Which of the following components identify the artifacts in


Maven?
Artifact Id
Group ID
Version

17. What is the correct Syntax to instantiate a Firefox Browser


session?
WebDriver driver = new FirefoxDriver();
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()

19. Which of the following methods will be used to handle an alert


dialog box?
alert.accept()

20. Which of the given options are structure-based


locators? CSS
XPATH

21. Which of the following command should be used to extract more


than one element on web page?
findElements

22. Which of the following is a term used in thee testing of computer


software to describe testing done using a table of conditions directly
as test data inputs?
Data Driven Testing

23. getText() method extracts the text from an element.


True

24. 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? YES ,
webDriver will wait 20 more seconds.

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()

28. Match the following tools with the correct description.


Tools Description
A. GIT 1. A cloud service for remote hosting of
git repositories. In addition to hosting
your code, the site helps manage
software
development projects.

B. Git Lab 2. Open-Source platform or


continuous inspection of code
quality to perform
automatic review with static analysis
of code to detect bugs.
C. SonarQube 3. Software that handles source code
versioning, letting you make and track
local file changes and share with
remote repository.

A-3, B-1, C-2


29. 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?
driver.switchTo().frame(int index)
driver.switchTo().frame(string nameOrld)
driver.switchTo().frame(WebElement frameElement)

30. 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?
driver.get(“URL”)
driver.navigate().to(“URL”)

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.

32. 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.
wb.getSheetAt(1)

33. 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 retrieved by driver.getWindowHandles().
Suggest Sarah with a compatible return type to store the window
references.
set <string>

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”)

36. In distributed version control system for SCM, which of the


following is not true?
Only online commits are allowed.

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

38. Sarah is an Automation Engineer and wants to build a job from


Jenkins server. The Jenkins server is up and running. What is the
default port number that Sarah needs to remember to access the
Jenkins server with URL?
8080

39. Which of the following are supporting attributes for @Test?


priority
enabled

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)

43. Which of the following is used to pass data from a source to a


particular test method to replace the constant values with variables
in TestNG?
Data Provider

44. In the TestNG framework, which of the following contains


Single/Multiple Test Cases?
Test Suite

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)

49. 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.
WebElement
50. 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?
isMultiple()

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

52. 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.
Set<String>
53. 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>Hyderabad</li>
<li>Mumbai</li>
<li>Pune</li>
</ul>
</body>
</html>
Sarah wants to locate the 3rd child element i.e., Hyderabad.
Suggest the appropriate locator strategy for Sarah.
CSS = "ul.cities li:nth-of-type("Hyderabad")

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”)

59. Sean is coding to automate mouse interactions on a web browser.


Assist Sean to identify the mouse event specific methods from the
below options. Choose the appropriate options.
moveToElement()
moveByOffset()
release()

60. Samantha has designed a TestClass with the following methods:


public class TestClass
{
@BeforeMethod
public void method1() {……}
@AfterMethod
public void method2() {……}
@Test(dataProvider=”loginData”)
public void method3(String u, String p) {…..}
@DataProvider
public Object[][] loginData() {….}
}
Suppose loginData() generates 5 sets of login credentials, how many
times method1, method2 and method 3 would be executed ? Choose
the appropriate option.
Method1 – 5 times, Method2 – 5 times, Method3 – 5 times

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

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"

65. 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.
c1.setCellValue("data")

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”)

68. 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

69. What are the various status options available in the Extent reports
library?
PASS,FAIL,SKIP,FATAL,ERROR,WARNING,INFO
70. Kevin wants to fetch all the data from the country drop down
menu and verify the data against data from the database. He is
looking into the library for a method to fetch all the data from the
country drop down box. Which method will help Kevin?
getOptions()

71. Samantha has to execute automation scripts across multiple


platforms like windows, mac, Linux which tool in the selenium suite
will be used by Samantha? Choose the most appropriate option.
selenium RC

72. 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 ?
By.partialLinkText()

73. 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.
mobileTxtBox.clear(); mobileTxtBox.sendKeys(“xxxxxxxxxx”);

74. Which MS office component(s) can be handled by Apache POI


Library?
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

76. 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?
assertSame(object1,object2)
77. Samantha has to execute automation scripts across multiple
platforms like windows, max and Linux. Which tool in the
Selenium suite will be useful for Samantha?
Selenium Grid

78. 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.switchTo().frame() immediately
will not move the context to 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 frame. Which method is used to switch back
to the main document from the frame?
switchTo.defaultContent()

79. Samantha is automating a test scenario. This scenario involves a


pop-up of confirmation window. She wants to interact with the pop
up window and decline the confirmation. Pop-up window shows a
message “Do you want to cancel the payment?”
Driver.switchTo().alert().dismiss()

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()

82. Which java interface is used to capture screenshot of web page


using Web Driver API?
TakesScreenshot

83. Consider the below HTML code snippet.


Email ; <label id= “Email” class= “style1” name= “input”>
Which is the best locator to identify the email web element?
By.xpath(“//label[@id= ‘email’]”)
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?

Ans: No, webDriver won’t wait 20 more seconds.

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

Ans: sheet.getRow(rowno).getcell(col no).getStringCellValue()

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

Ans: (?) – single character search (*) – one or more


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

d There is no option in Eclipse to generate XML Suite file

e TestNG XML Suite file can be generated by Jenkins plugin


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>

<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 .

a selectByVisibleText()

b selectByValue()

c selectByIndex()

d All of the above

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

Actions act = new Actions(driverInstance)

Actions act = new Actions()

New Actions(driverInstance)

Actions act = (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

Cannot predict the name of error/ exception

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=”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)

selectByValue(2)

selectByVisibleText(“Lead”)

selectByValue(“2”)
Q1- Which expression is used in CSS selectors to match the attribute value with a prefix?

Ans: ^

Q2- public class TestClass

@Test(priority=1)

public void method1(){...}

@Test

public void method3(){...}

@Test

public void method2(){...}

@Test(priority=2)

public void method4(){...}

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.)

i. Write in correct 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- e,c,a,b,d

j. Kevin has designed a TestClass with the following methods:


public class TestClass {
@Test
public void testMehod1() {int a = 78;}
@Test
public void testMehod2() {Assert.assertEquals(67, 76);}
public void testMehod3() {System.out.println("Welcome");}
@Test
public void testMehod4(){Assert.assertEquals("Hello”, “Hello");}
}
Kevin executes the above TestClass as a TestNG test. Which of the following correctly
represents the test result?
ANS - Total tests run: 3, Passed: 2, Failed: 1

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- All of the above Correct

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. Correct

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 Correct

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?

Ans: web Correct

94. Which of the following is an invalid configuration element in Jmeter?

Ans: FTP cookie manager Correct

95. Which of the following input documents is used to create test scenarios and conditions?

Ans: Use cases Correct

96. Which of the following Java classes are from the extent API library?

Ans: ExtentReports, Status Correct Google: ExtentReports

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?

Ans: Yes, webDriver will wait 20 more seconds. Correct

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)

5)Which Ms office components(s) can be handled by apache POI library?

(a)ppt

(b)docs

(c)…

(d)…

(e)all the above


Ans: POIFS

6)Samanta has designed a testclass, with the….

Public class testclass

@beforeMethod
Public void method1() {…}

@afterMethod

Public void method2() {…}

@Test(dataProvider=”loginData”)

Public void method2(string u, string p) {…}

@data provider

Public object[][] login data() {…}

Suppose login data () generates 5 sets og login credentials …..

Choose right answer.

ANS: Method1 – 5 times…….

****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()

(c) sheet.getCell(collno) .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:

public class TestClass

@BeforeMethod

public void method1() {……}

@AfterMethod

public void method2() {……}

@Test(dataProvider=”loginData”)

public void method3(String u, String p) {…..}

@DataProvider

public Object[][] loginData() {….}

Suppose loginData() generates 5 sets of login credentials, how many times method1, method2 and
method 3 would be executed ?

Choose the appropriate option


a) Method1 – 5 times, Method2 – 5 times, Method3 – 5 times
b) Method1 – 1 time, Method2 – 1 time, Method3 – 5 times
c) Method1 – 1 time, Method2 – 1 time, Method3 – 1 time
d) Cannot predict the iterations

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.

Choose the appropriate 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?

Choose the appropriate option.

a) getAttributeValue(“attributeName”)
b) getAttribute(“attributeName”)
c) getValue(“attributeName”)
d) getText()

5. 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.

a) method2, method3, method1, method4


b) method1, method4, method3, method2
c) method1, method4, method2, method3
d) Random order of execution

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.

Choose the most appropriate option.

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

Ans: (c) WebElement

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>

Ans: (b) Set<String>

Sub-topics: Extent Reports

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.

Sub-topics: WebDriver API

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")

Sub-topics: WebDriver API


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.

(a) CSS = “ul:cities li:nth-child(2)”


(b) CSS = “ul:cities li:nth-of-type(“Hydrabad”)
(c) CSS =” ul:cities li:nth-child(“Hydrabad”)
(d) CSS= “ul:cities li:nth-child(])”

Ans: (b) css="ul.cities li:nth-of-type("Hyderabad")

Sub-topic: WebDriver Api

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

None of the above

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.

Choose the most appropriate option.

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

Choose the most appropriate option

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

Cannot predict the name of error/ exception

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.

(e)TestNG XML suite file can be generated by Jenkins

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().body()

driver.switch To().mainDocument()

driver switch To().defaultDocument()

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”)

Ans: (a) driver.get("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.

(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(])”

Ans: (b) css="ul.cities li:nth-of-type("Hyderabad")

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:

<input id="nowPassword" type="password">

Choose the most appropriate option.

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:

<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’]”)

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

Ans: (c) WebElement

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

to store the Log out test object.

Choose the best option

a) String

b) WebDnver

c) WebElement

d) List

2Q) Consider the below hlml code snippet

Email : <label id='Email' class='style 1' name='input>

Which is the best localor to identify the Email web element?

Choose the most appropnate option.

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 for designing the CSS Selector?


Choose all the appropnate options.

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

Choose all the appropriate options.

a) Actions act=new Actions(driverInstance)

b) Actions act=new Actions()

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 checkboxes. These checkboxes have a name attribute as "hobbies". Assist

Samantha by choosing the correct command

Choose the most appropriate option

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?

Choose the most appropriate option.

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

Choose the most appropriate option.

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?

Choose all the appropriate options.

Ans: driver. switch To() .frame(int index)

driver. switch To(). frame(String nameOrid)

driver switch To().frame(WebElement frameElement)

driver switch To().frame()

driver switch To().iframe(String name)

9Q) Identify the correct way of launching the Chrome browser through WebDriver Instance with

the correct property

Choose the most appropriate option.

a) System.setProperty("webdriver.chrome.driver”, "src/test/resources");

WebDriver driver=new ChromeDriver();

b) System.setProperty("webdriver.chrome.driver","src/test/resources/chromedriver.exe");

WebDriver driver=new ChromeDriver();

c) 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

11Q) Kevin has designed a TestClass with the following methods:

public class TestClass

@Test

public void testMethod1() {int a = 78; }

@Test

public void testMethod2() { Assert.assertEquals(67,76); }

public void testMethod3() { System.out.println("Welcome"); }

@Test

public void testMethod4() {Assert.assertEquals("Hello", "Hello"); }

Kevin executes the above TestClass as a TestNG test. Which of the following correctly

represents the test results?

Choose the most appropriate option

A Total Tests Run: 3 Passed 2 Faited 1

B Total Tests Run: 4 Passed 3 Failed. 1

C Total Tests Run: 4 Passed 1 Failed 1

D Total Tests Run: 3 Passed: 1 Failed: 1

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

D No Messages displays on Console

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

the most appropriate option

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 the most appropriate option.

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

2….Sarah is coding an automation script.where she has to fetch(HTML


CODE)------webelement desired table=driver.find element(by.id(“table3”)); List <Web
element>
rows=desiredtable.findelements(by.tagname(“tr”));system.out println(rows.size());

3…GIT CLONE

4….sarah has on automation engineer triggers anew-----JRE,JDK OR JRE,JDE,MAVEN 5----when

a maven project ijob in jenkinsis triggers-------TESTING XML-→POM XML--→TETINGC

6…..which MSoffice components can be handled by apache Poi libraery ----POIFS

7….. which plugin can be used as an IDE (like eclipse extension that helps to detect and fix
quality issues-----SONARTLINT

8……sean is coding to automate mouse interaction-----move to element()

,movebyoffset(),release() 9…..which method in the webdriver library is

used----GETATTRIBUTE(“ATTRIBUTENAME”) 10….which plugin can be used as an IDE (like eclipse

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

14….has to execute automation scripts across multiple platforms like windows,mac,and


linux.which tool in-----SELENIUM GRID

15…… sean is performing verification using assert class functions testing.suggest him the correct
…- ------ASSERTSAME(OBJECT1,OBJECT2)

16….kevin is debugging an automation test ,where test data-----c1.SETCELLVALUE(“DATA”)

17….A3,B1,C2------ GIT >SOFTWARETHAT HANDLES

GITLAB>A CLOUD SERVICE

SONARQUBE>OPEN-SOURCE

18….samantha is automating a test

scenario-----DRIVER.SWITCHTO().ALERT()DISMISS(); 19---TAKESSCREENSHOT

20---ISMULTIPLE()

21---NOSUCHELEMENTEXCEPTION

22----MARKUPHELPER

23----WEBELEMENT….sean is coding an automation element script test a web application.he has


to store thelogout link------

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?

Ans: No, webDriver won’t wait 20 more seconds.

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

Ans: sheet.getRow(rowno).getcell(col no).getStringCellValue()

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

Ans: (?) – single character search (*) – one or more

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

d There is no option in Eclipse to generate XML Suite file

e TestNG XML Suite file can be generated by Jenkins plugin


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>

<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 .

a selectByVisibleText()

b selectByValue()

c selectByIndex()

d All of the above

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

Actions act = new Actions(driverInstance)

Actions act = new Actions()

New Actions(driverInstance)

Actions act = (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

Cannot predict the name of error/ exception

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=”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)

selectByValue(2)

selectByVisibleText(“Lead”)ᤰᤱ

selectByValue(“2”)ᤰᤱ
Q1- Which expression is used in CSS selectors to match the attribute value with a prefix? Ans: ^

Q2- public class TestClass

@Test(priority=1)

public void method1(){...}

@Test

public void method3(){...}

@Test

public void method2(){...}

@Test(priority=2)

public void method4(){...}

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.)

i. Write in correct 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-
e,c,a,b,d

j. Kevin has designed a TestClass with the following methods:


public class TestClass {
@Test
public void testMehod1() {int a = 78;}
@Test
public void testMehod2() {Assert.assertEquals(67, 76);}
public void testMehod3() {System.out.println("Welcome");}
@Test
public void testMehod4(){Assert.assertEquals("Hello”, “Hello");}
}
Kevin executes the above TestClass as a TestNG test. Which of the following correctly represents
the test result?
ANS - Total tests run: 3, Passed: 2, Failed: 1

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-

All of the above Correct

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. Correct

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 Correct

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?

Ans: web Correct

94. Which of the following is an invalid configuration element in Jmeter?

Ans: FTP cookie manager Correct

95. Which of the following input documents is used to create test scenarios and conditions? Ans:

Use cases Correct

96. Which of the following Java classes are from the extent API library?

Ans: ExtentReports, Status Correct Google: ExtentReports

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?

Ans: Yes, webDriver will wait 20 more seconds. Correct

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)

5)Which Ms office components(s) can be handled by apache POI library?

(a)ppt

(b)docs

(c)…

(d)…

(e)all the above

Ans: POIFS

6)Samanta has designed a testclass, with the….

Public class testclass

@beforeMethod
Public void method1() {…}

@afterMethod

Public void method2() {…}

@Test(dataProvider=”loginData”)

Public void method2(string u, string p) {…}

@data provider

Public object[][] login data() {…}

Suppose login data () generates 5 sets og login credentials …..

Choose right answer.


ANS: Method1 – 5 times…….

****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()

(c) sheet.getCell(collno) .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:

public class TestClass

@BeforeMethod

public void method1() {……}


@AfterMethod

public void method2() {……}

@Test(dataProvider=”loginData”)

public void method3(String u, String p) {…..}

@DataProvider

public Object[][] loginData() {….}

Suppose loginData() generates 5 sets of login credentials, how many times method1, method2
and method 3 would be executed ?

Choose the appropriate option

a) Method1 – 5 times, Method2 – 5 times, Method3 – 5 times


b) Method1 – 1 time, Method2 – 1 time, Method3 – 5 times
c) Method1 – 1 time, Method2 – 1 time, Method3 – 1 time
d) Cannot predict the iterations

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.

Choose the appropriate 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?

Choose the appropriate option.

a) getAttributeValue(“attributeName”)
b) getAttribute(“attributeName”)
c) getValue(“attributeName”)
d) getText()

5. 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.

a) method2, method3, method1, method4


b) method1, method4, method3, method2
c) method1, method4, method2, method3
d) Random order of execution

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.

Choose the most appropriate option.

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

Ans: (c) WebElement

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>

Ans: (b) Set<String>

Sub-topics: Extent Reports

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.

Sub-topics: WebDriver API

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")

Sub-topics: WebDriver API


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.

(a) CSS = “ul:cities li:nth-child(2)”


(b) CSS = “ul:cities li:nth-of-type(“Hydrabad”)
(c) CSS =” ul:cities li:nth-child(“Hydrabad”)
(d) CSS= “ul:cities li:nth-child(])”

Ans: (b) css="ul.cities li:nth-of-type("Hyderabad")

Sub-topic: WebDriver Api

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

None of the above

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.

Choose the most appropriate option.

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

Choose the most appropriate option

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

Cannot predict the name of error/ exception

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.

(e)TestNG XML suite file can be generated by Jenkins

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().body()

driver.switch To().mainDocument()

driver switch To().defaultDocument()

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”)

Ans: (a) driver.get("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.
(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(])”

Ans: (b) css="ul.cities li:nth-of-type("Hyderabad")

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:

<input id="nowPassword" type="password">

Choose the most appropriate option.

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:

<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’]”)

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

Ans: (c) WebElement

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 to store the Log out test object.

Choose the best option

a) String

b) WebDnver

c) WebElement
d) List

2Q) Consider the below hlml code snippet

Email : <label id='Email' class='style 1' name='input>

Which is the best localor to identify the Email web element?

Choose the most appropnate option.

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 for designing the CSS Selector?

Choose all the appropnate options.

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

Choose all the appropriate options.

a) Actions act=new Actions(driverInstance)

b) Actions act=new Actions()

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

checkboxes. These checkboxes have a name attribute as "hobbies". Assist Samantha by

choosing the correct command

Choose the most appropriate option

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?

Choose the most appropriate option.

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

Choose the most appropriate option.

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?

Choose all the appropriate options.

Ans: driver. switch To() .frame(int index)

driver. switch To(). frame(String nameOrid)

driver switch To().frame(WebElement frameElement)

driver switch To().frame()

driver switch To().iframe(String name)

9Q) Identify the correct way of launching the Chrome browser through WebDriver Instance with

the correct property

Choose the most appropriate option.

a) System.setProperty("webdriver.chrome.driver”, "src/test/resources");

WebDriver driver=new ChromeDriver();

b) System.setProperty("webdriver.chrome.driver","src/test/resources/chromedriver.exe");
WebDriver driver=new ChromeDriver();

c) 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

11Q) Kevin has designed a TestClass with the following methods:

public class TestClass

@Test

public void testMethod1() {int a = 78; }

@Test

public void testMethod2() { Assert.assertEquals(67,76); }

public void testMethod3() { System.out.println("Welcome"); }

@Test

public void testMethod4() {Assert.assertEquals("Hello", "Hello"); }

Kevin executes the above TestClass as a TestNG test. Which of the following correctly represents

the test results?

Choose the most appropriate option

A Total Tests Run: 3 Passed 2 Faited 1

B Total Tests Run: 4 Passed 3 Failed. 1

C Total Tests Run: 4 Passed 1 Failed 1

D Total Tests Run: 3 Passed: 1 Failed: 1


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

D No Messages displays on Console

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 the most appropriate option

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

the most appropriate option.

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?

Ans: No, webDriver won’t wait 20 more seconds.

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

Ans: sheet.getRow(rowno).getcell(col no).getStringCellValue()

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

Ans: (?) – single character search (*) ­– one or more

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

d There is no option in Eclipse to generate XML Suite file

e TestNG XML Suite file can be generated by Jenkins plugin

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>

<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 .

a selectByVisibleText()

b selectByValue()

c selectByIndex()

d All of the above

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

Actions act = new Actions(driverInstance)

Actions act = new Actions()

New Actions(driverInstance)

Actions act = (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

Cannot predict the name of error/ exception

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=”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)

selectByValue(2)

selectByVisibleText(“Lead”) ✔️
selectByValue(“2”) ✔️
Q1- Which expression is used in CSS selectors to match the attribute value with a prefix?

Ans: ^

Q2- public class TestClass


{

@Test(priority=1)

public void method1(){...}

@Test

public void method3(){...}

@Test

public void method2(){...}

@Test(priority=2)

public void method4(){...}

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.)
i. Write in correct 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- e,c,a,b,d

j. Kevin has designed a TestClass with the following methods:

public class TestClass {

@Test

public void testMehod1() {int a = 78;}

@Test

public void testMehod2() {Assert.assertEquals(67, 76);}

public void testMehod3() {System.out.println("Welcome");}

@Test

public void testMehod4(){Assert.assertEquals("Hello”, “Hello");}

Kevin executes the above TestClass as a TestNG test. Which of the following correctly
represents the test result?

ANS - Total tests run: 3, Passed: 2, Failed: 1

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- All of the above Correct

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. Correct

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 Correct

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?

Ans: web Correct

94. Which of the following is an invalid configuration element in Jmeter?

Ans: FTP cookie manager Correct

95. Which of the following input documents is used to create test scenarios and conditions?

Ans: Use cases Correct

96. Which of the following Java classes are from the extent API library?

Ans: ExtentReports, Status Correct Google: ExtentReports

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?

Ans: Yes, webDriver will wait 20 more seconds. Correct


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)

5)Which Ms office components(s) can be handled by apache POI library?

(a)ppt

(b)docs

(c)…

(d)…

(e)all the above

Ans: POIFS

6)Samanta has designed a testclass, with the….

Public class testclass

@beforeMethod

Public void method1() {…}

@afterMethod

Public void method2() {…}


@Test(dataProvider=”loginData”)

Public void method2(string u, string p) {…}

@data provider

Public object[][] login data() {…}

Suppose login data () generates 5 sets og login credentials …..

Choose right answer.

ANS: Method1 – 5 times…….

****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()

(c) sheet.getCell(collno) .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:

public class TestClass

@BeforeMethod

public void method1() {……}

@AfterMethod

public void method2() {……}

@Test(dataProvider=”loginData”)

public void method3(String u, String p) {…..}

@DataProvider

public Object[][] loginData() {….}

Suppose loginData() generates 5 sets of login credentials, how many times method1, method2 and
method 3 would be executed ?

Choose the appropriate option

a) Method1 – 5 times, Method2 – 5 times, Method3 – 5 times


b) Method1 – 1 time, Method2 – 1 time, Method3 – 5 times

c) Method1 – 1 time, Method2 – 1 time, Method3 – 1 time

d) Cannot predict the iterations

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.

Choose the appropriate 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?

Choose the appropriate option.

a) getAttributeValue(“attributeName”)

b) getAttribute(“attributeName”)

c) getValue(“attributeName”)

d) getText()

5. 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.

a) method2, method3, method1, method4

b) method1, method4, method3, method2

c) method1, method4, method2, method3

d) Random order of execution

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.

Choose the most appropriate option.

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

Ans: (c) WebElement

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>

Ans: (b) Set<String>

Sub-topics: Extent Reports


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.

Sub-topics: WebDriver API

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")

Sub-topics: WebDriver API

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.

(a) CSS = “ul:cities li:nth-child(2)”

(b) CSS = “ul:cities li:nth-of-type(“Hydrabad”)

(c) CSS =” ul:cities li:nth-child(“Hydrabad”)

(d) CSS= “ul:cities li:nth-child(])”

Ans: (b) css="ul.cities li:nth-of-type("Hyderabad")

Sub-topic: WebDriver Api

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

None of the above

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.

Choose the most appropriate option.

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

Choose the most appropriate option

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

Cannot predict the name of error/ exception

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.

(e)TestNG XML suite file can be generated by Jenkins

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().body()

driver.switch To().mainDocument()

driver switch To().defaultDocument()

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”)

Ans: (a) driver.get("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.

(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(])”

Ans: (b) css="ul.cities li:nth-of-type("Hyderabad")

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:

<input id="nowPassword" type="password">

Choose the most appropriate option.

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:

<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’]”)

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

Ans: (c) WebElement

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 to store the Log out test object.

Choose the best option

a) String

b) WebDnver

c) WebElement

d) List

2Q) Consider the below hlml code snippet

Email : <label id='Email' class='style 1' name='input>

Which is the best localor to identify the Email web element?

Choose the most appropnate option.

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

for designing the CSS Selector?

Choose all the appropnate options.

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

Choose all the appropriate options.

a) Actions act=new Actions(driverInstance)

b) Actions act=new Actions()


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

checkboxes. These checkboxes have a name attribute as "hobbies". Assist Samantha by

choosing the correct command

Choose the most appropriate option

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?

Choose the most appropriate option.

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

Choose the most appropriate option.

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?

Choose all the appropriate options.

Ans: driver. switch To() .frame(int index)

driver. switch To(). frame(String nameOrid)

driver switch To().frame(WebElement frameElement)

driver switch To().frame()

driver switch To().iframe(String name)

9Q) Identify the correct way of launching the Chrome browser through WebDriver Instance with
the

correct property

Choose the most appropriate option.

a) System.setProperty("webdriver.chrome.driver”, "src/test/resources");

WebDriver driver=new ChromeDriver();

b) System.setProperty("webdriver.chrome.driver","src/test/resources/chromedriver.exe");

WebDriver driver=new ChromeDriver();

c) 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

11Q) Kevin has designed a TestClass with the following methods:

public class TestClass

@Test

public void testMethod1() {int a = 78; }

@Test

public void testMethod2() { Assert.assertEquals(67,76); }

public void testMethod3() { System.out.println("Welcome"); }

@Test

public void testMethod4() {Assert.assertEquals("Hello", "Hello"); }

Kevin executes the above TestClass as a TestNG test. Which of the following correctly

represents the test results?

Choose the most appropriate option

A Total Tests Run: 3 Passed 2 Faited 1

B Total Tests Run: 4 Passed 3 Failed. 1

C Total Tests Run: 4 Passed 1 Failed 1

D Total Tests Run: 3 Passed: 1 Failed: 1

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

D No Messages displays on Console

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 the most appropriate option

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 the most appropriate option.

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. The test language usually used in Selenium is ________________.

A. PHP

B. Python

C. JavaScript

D. None of the above

Ans: C

2. The term AJAX expands to ________.

A. Asynchronous Java and XML

B. Asynchronous JavaScript and XML

C. Accumulated Java and XML

D. None of the above

Ans: B

3. The term JSON refers to ______________.

A. JavaScript Object Notation


B. Java Object Notation

C. Java Object Naming

D. None of the above

Ans: A

4. Selenium tests _____________.

A. DOS applications

B. Browser-based applications

C. GUI applications

D. None of the above

Ans: B

5. Selenium variables are stored in _____________.

A. storedVars

B. stored variables

C. VariablesStore

D. None of the above

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

7. What does the term CSS refer to?

A. Cascade Style Sheets

B. Cascading Style Sheets


C. Clear Style Sheets

D. Catering Style Sheets

Ans: B

8. What is Selenium IDE?

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

C. Selenium Web driver

D. Selenium NG

Ans: A

10. Where is XPath used in?

A. XML documents

B. MS-Word documents

C. MS-Excel documents

D. MS-PowerPoint documents

Ans: A

11. What does the term DOM refer to?

A. Dynamic Object Model

B. Document Object Model


C. Data Object Model

D. Document Flow Object Model

Ans: B

12. What does the term regex expand to?

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

14. What is a test suite made of?

A. Test packs

B. Tests

C. Test blocks

D. Test pattern

Ans: B

15. What does the assertTitle checks?

A. Element title

B. Page title
C. Block title

D. Title of an element under focus

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

19. Is Web Driver a component of the Selenium?

A. No

B. Yes

Ans: B
20. Selenium IDE stands for

A. Selenium Initialization Development Environment

B. Selenium Interrelated Development Environment

C. Selenium Integrated Development Environment

D. Selenium Information Development Environment

Ans: C

21. Select the Browser which is supported by Selenium IDE

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

23. The Web driver is used

A. To execute tests on the HtmlUnit browser.

B. To design a test using Selenese

C. To quickly create tests

D. To test a web application against Firefox only.

Ans: A
24. The Selenium IDE is used

A. To create customized test results.

B. To deploy your tests across multiple environments using Selenium Grid

C. To test with HTMLUnit

D. To test a web application against Firefox only.

Ans: D

25. The Selenium RC is used

A. To run your test against different browsers (except HtmlUnit) on different operating systems.

B. To create tests with little or no prior knowledge in programming.

C. To test a web application against Firefox only.

D. To run a huge test suite, that can be executed on multiple machines.

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

29. The Selenium can

A. access controls within the desktop

B. both web and desktop applications

C. only test web applications

Ans: C

30. The Selenium

A. Provides professional customer support

B. Test Reports are generated automatically

C. Comes with a built-in object repository

D. Cannot access elements outside of the web application under test

Ans: D

31. Can Google chrome be supported by Selenium IDE?

A. Yes

B. No

Ans: B

32. Can the Unix operating system be supported by Selenium IDE?

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

35. Which Selenium component supports All Operating System?

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

38. The Actions commands

A. are commands that directly interact with page elements.

B. are commands that allow you to store values to a variable.

C. are commands that verify if a certain condition is met.

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.

A. The ‘display’ command

B. The ‘echo’ command

C. The ‘print’ command

D. The ‘printr’ command

Ans: B

41. Which component of Selenium can create customized test results?

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

D. wait for load

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

50. What is TestNG?


A. TestNextGeneration

B. TestNewGenerlization

C. TestNewGeneration

D. TestNextGenerations

Ans: A

SELENIUM Objective Questions pdf free download::

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

B. Selenium Web driver

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

B. The Source View

C. The Editor View

D. The Field 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

63. Out of the following which is NOT a wait command.

A. wait for title

B. waitForTextPresent

C. wait for active

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

66. By Default time of WAITFOR command is :


A. 15 sec

B. 20 sec

C. 25 sec

D. 30 sec

Ans: D

67. Selenium is compatible with

A. CSS1.0 and CSS 2.0,

B. CSS1.0, CSS 2.0, and CSS 3.0 selectors.

C. CSS 2.0, and CSS 3.0 selectors.

D. CSS1.0, CSS 2.0, CSS 3.0 and CSS 4.0 selectors.

Ans: B

68. In Selenium variables are stored in _________ .

A. storedVars

B. stored variables

C. VariablesStore

D. All of the above

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

70. Which is the following is true in case of waitFor command?


A. waitForAlertPresent

B. waitForTextPresent

C. waitForFramePresent

D. waitForPageToLoad

Ans: B

71. How to execute a specific command?

A. Highlight a command. Press Ctrl + F9.

B. Highlight a command. Press Alt + F9.

C. Highlight a command. Press Ctrl + X.

D. Highlight a command. Press X.

Ans: D

72. Which is the odd one out?

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?

A. Extend waitFor (time in sec)

B. wait for (time in sec) extend

C. setTimeout (time in sec)

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

75. In Selenium, Following Axis is related to:

A. Selects all the siblings after the current element

B. Selects all elements that follow the closing tab of the current elements.

C. Selects all of the siblings before the current element

D. Selects all elements that are before the current element

Ans: B

76. The // tells the query that

A. It needs to stop at the first element that it finds.

B. This is comment

C. The path of the file or folder

D. All of these

Ans: A

77. In regular Expression * quantifier refers to:

A. 0 or more of the preceding character.

B. 1 or more of the preceding character

C. 0 or 1 of the preceding character

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

79. Which is a procedure?

A. Wait

B. Exit

C. WaitForProperty

D. None of these.

Ans: A

80. Variable can be saved in which format?

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

B. Working with AJAX applications


C. Working with multiple windows

D. All of these

Ans: B

83. What is the most common way to find an element on a page?

A. ID

B. XPath

C. CSS selector

D. Name

Ans:

84. Which is not true in case of Globs, in Selenium?

A. Globs are used as the default pattern matching technique.

B. It is similar to regular expressions.

C. The syntax of Globs is much wider than Regular expression

D. B and C

Ans: C

85. Which process uses the JavaScript to find an element?

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

89. What is the default port number used by a hub in selenium?

A. 4444

B. 2222

C. 1111

D. 3333

Ans: A

90. Which two commands you use to validate a button?

A. VerifyTextPresent and assertTextPresent

B. VerifyElementPresent and assertElementPresent

C. VerifyAlertPresent and assertAlertPresent

D. VerifyAlert and assertAlert


Ans: B

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

93. Variable can be saved in which format?

A. ${variableName}

B. storedVars[‘variableName’].

C. Both of these

D. None of these

Ans: C

94. echo(): is used

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

What is the most common way to find an element on a page?

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

Will a findElements type call throw a NoSuchElementException when it can't

find the element?

Ans: No, it will not throw an exception. It will return an empty list.

What versions of Internet Explorer does WebDriver support?

Ans: All versions of IE6, IE7, IE8, and IE9 for both 32-bit and 64-bit installations

Which of the following expression is used for "anything"?

Ans : .*

Select the odd one using in Selenium

Ans: Pattern Matching

Which of the following is not a wait command in Selenium?

Ans: waitForActive

Selenium command for entering text into text boxes?

Ans: sendKeys()

Which of the following language is not supported by Selenium


Ans: ASP

Which of the following method is used to work with multiple browser windows?

Ans: (B) getWindowHandles()

(C) getWindowhandle()

Which one is a class in Selenium ?

Ans: WebDriverWait

Selenium method to get content which is inside any HTML tags?

Ans: getText()

What is the best element locator in selenium webdriver?

Ans: ID

This set of Software Engineering Multiple Choice Questions & Answers (MCQs) focuses
on “Software Control”.

1. SCM stands for

a) Software Control Management

b) Software Configuration Management

c) Software Concept Management

d) None of the mentioned

View Answer

Answer: b

Explanation: In software engineering, software configuration management (SCM) is


the task of tracking and controlling changes in the software, part of the larger
cross-discipline field of configuration management.

2. When code is made available to others, it goes in a/an

a) hard drive

b) access-controlled library
c) servers

d) access control

View Answer

Answer: b

Explanation: None.

3. Which of the following is not a main phase in Configuration Management (CM)


Process?

a) CM Planning

b) Executing the CM process

c) CM audits

d) None of the mentioned

View Answer

Answer: d

Explanation: All are main phases of CM.

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

d) Version Control and Access control

View Answer

Answer: a

Explanation: It allows software engineers to continue development along a branch


even when a line of development is frozen.

6. Which of the following is not a change management process?

a) Log the changes

b) Estimate impact on effort and schedule

c) Review impact with stakeholders

d) None of the mentioned

View Answer

Answer: d

Explanation: All are required for a change.

7. Configuration management (CM) is needed to deliver product to the client

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

Explanation: In configuration management, a “baseline” is an agreed-to description of


the attributes of a product, at a point in time, which serves as a basis for defining
change.

9. How are baselines verified?

a) By reviews

b) By inspections

c) By testing of code

d) All of the mentioned

View Answer

Answer: c

Explanation: Testing verifies the agreed-to description.

10. Which of the following is a example of Configuration Items ?

a) SCM procedures

b) Source code

c) Software design descriptions

d) All of the mentioned


View Answer

Answer: d

Explanation: All are covered in CM.

11. SCM controls only the products of the development process.

a) True

b) False

View Answer

Answer: a

Explanation: None.

12. CCB stands for

a) Change Control Board

b) Change Control Baseline

c) Cumulative Changes in Baseline

d) None of the mentioned

View Answer

Answer: a

Explanation: None.

13. What information is required to process a change to a baseline?

a) Reasons for making the changes

b) A description of the proposed changes

c) List of other items affected by the changes


d) All of the mentioned

View Answer

Answer: d

Explanation: A baseline is an agreed-to description of the product, changes require


multiple reasons.

1. What are the two basics of git

Ans. Recording change and Safety

2. What is a repository

Ans. A container for snapshot and history

3. You are installing Git.whats the default editor

Ans. Vim

4. You are configuring git for the first time

Ans. git config--global user.email ’[email protected]

5. You want to configure git so it

Ans. git config --global core.autoCrlf true

6. You want to configure git so it remember your password

Ans. git config --global credential.helper wincred

7. You want to use one of the two core edito

Ans. Vim and Emacs

8. You want to change the default editor using git

Ans. git config --global core.editor”emacs”

9. Why might you want to install the adobe

Ans. It has a live preview

10. When you perform the command git

Ans. Initializes the current directory

11. You’ve just cloned a project and now you want

Ans. git log --oneline --graph

12. You want to edit the configuration


Ans. git config -e --local

13. You want to create a global alias called list

Ans. git config --global alias.list

14. You want to use a Git status to chech the state of a file

Ans. Tracked

15. Why is version control an important facet of software development

Ans.The work of different teams

16. List the steps that we need to complete before we can set

Ans. Complete initial configuration, Install git remote codecommit

17. Specify the commands that we can use to add and manage

Ans. Git push beanstalk --all, git remote add beanstalk

18. Identify the environments provided in beanstalk

Ans. Production, Deployment

19. Identify the asure devops server

Ans. Azure pipeline, Azure Artifacts

20. Specify some of the key technologies that are involved in the cloud computing

Ans. Grid computing, virtualisation

21. What are the key tasks involved in enabling aws

Ans. Generate static user name, Use IAM

22. List some of the key tasks that we can perform with

Ans. Custimize work items, Manage builds

23. List some of the key features of concurrent Version System

Ans. Provides configurable loggin support, Supports repository event trigger

24. Recall some of the benefits of using gitLab for CI/CD

Ans. Git lab provides the capability to run jobs in parallel on multiple machines

Git lab provides the capability to run distributed jobs on separate

25. Specify some of the essential features provided by aws codecommit

Ans. Support collaborative, Enables the implementation

26. Identify steps the steps that we need to complete to create


Ans Create a repository, Accept incoming

27. List some of the key terms that we use when

Ans. Repository, Master

28. Recall some of the svn commands

Ans. svn cat, svn checkout

29. Recall the commands that we can use to create a directory tree

Ans. cvs import, cvs co

30. Identify the tasks involved in the cleansing data

Ans. Identify aggregation requirement, Handle missing value

31. Specify some of the common problem

Ans. clustering, Regression

32. Which statement is true regarding to machine learning

Ans. Clustering algorithm, decision tree are easier

33. Recall some of the essential benefits afforded

Ans Speedup development, helpfix

34. Whick tasks are involved in deriving machine

Ans. creating mathematical model, Testing Algorithm

35. What components are required to create a code coverage

Ans. Key to authenticate, Sonar runner

36. Recall the approaches of extracting features using clones

Ans. Clone history features, relative location

37. What refactoring techniques are

Ans. Apply inline declaration , Extract methods

38. Identify the elements that can contribute to technical

Ans. code paths, System dependencies

39. With packages need to be installed to configure

Ans. Atomic, Docker

40. What are the essential node js packages

Ans. @sentry/iteration, @Sentry/Browser


41. Which commands can be used to build images

Ans. docker tag, docker login

42. Identify critical components

Ans Environment, landing zone

43. Select the critical operational challenges

Ans. sustainability, System design

44. Which attributes do we need to setup to configure smtp

Ans. port, host

45. Identify approaches of implement infracture as code

Ans.Imperative, Declarative

46. Identify some of the key features afforded

Ans. Orchestration, Replication

47. Which git repositories are supported by blue ocean to create

Ans.BitBucket, GitHub

48. Select some of the key tasks involved in the setting up agile teams

Ans. Aligning, participating

49. Which git secret command can be used to configure

Ans. git secret tell, git secret add

50. Select some of the essential features of sensu

Ans. Multicloud, self service

51. Identify Threshold measures of quality

Ans. Traditional , Security

52. Identify valid types of application

Ans. Generation, Application

53. What are the features of testNG

Ans. Annotations based, parallel testing, build

54. Closes all the associates windows

Ans. close
55. Consider there are three frames in a web page

Ans. switchTo.mainWindow()

56. Which of the given option are structure based locators

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. Data driven testing

59. getText() method extracts the text from an element

Ans. True

60. What is/are the tool/tools available with selenium suite

Ans. All

61. Webdriver implements the following class/classes

Ans. All of the above

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?

Ans: No, webDriver won’t wait 20 more seconds.

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

Ans: sheet.getRow(rowno).getcell(col no).getStringCellValue()

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

Ans: (?) – single character search (*) – one or more

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

d There is no option in Eclipse to generate XML Suite file

e TestNG XML Suite file can be generated by Jenkins plugin


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>

<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 .

a selectByVisibleText()

b selectByValue()

c selectByIndex()

d All of the above

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

Actions act = new Actions(driverInstance)

Actions act = new Actions()

New Actions(driverInstance)

Actions act = (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

Cannot predict the name of error/ exception

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=”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)

selectByValue(2)

selectByVisibleText(“Lead”)

selectByValue(“2”)
Q1- Which expression is used in CSS selectors to match the attribute value with a prefix?

Ans: ^

Q2- public class TestClass

@Test(priority=1)

public void method1(){...}

@Test

public void method3(){...}

@Test

public void method2(){...}

@Test(priority=2)

public void method4(){...}

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.)

i. Write in correct 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- e,c,a,b,d

j. Kevin has designed a TestClass with the following methods:


public class TestClass {
@Test
public void testMehod1() {int a = 78;}
@Test
public void testMehod2() {Assert.assertEquals(67, 76);}
public void testMehod3() {System.out.println("Welcome");}
@Test
public void testMehod4(){Assert.assertEquals("Hello”, “Hello");}
}
Kevin executes the above TestClass as a TestNG test. Which of the following correctly
represents the test result?
ANS - Total tests run: 3, Passed: 2, Failed: 1

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- All of the above Correct

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. Correct

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 Correct

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?

Ans: web Correct

94. Which of the following is an invalid configuration element in Jmeter?

Ans: FTP cookie manager Correct

95. Which of the following input documents is used to create test scenarios and conditions?

Ans: Use cases Correct

96. Which of the following Java classes are from the extent API library?

Ans: ExtentReports, Status Correct Google: ExtentReports

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?

Ans: Yes, webDriver will wait 20 more seconds. Correct

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)

5)Which Ms office components(s) can be handled by apache POI library?

(a)ppt

(b)docs

(c)…

(d)…

(e)all the above

Ans: POIFS

6)Samanta has designed a testclass, with the….

Public class testclass

@beforeMethod
Public void method1() {…}

@afterMethod

Public void method2() {…}

@Test(dataProvider=”loginData”)

Public void method2(string u, string p) {…}

@data provider

Public object[][] login data() {…}

Suppose login data () generates 5 sets og login credentials …..

Choose right answer.

ANS: Method1 – 5 times…….

****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()

(c) sheet.getCell(collno) .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:

public class TestClass

@BeforeMethod

public void method1() {……}

@AfterMethod

public void method2() {……}

@Test(dataProvider=”loginData”)

public void method3(String u, String p) {…..}

@DataProvider

public Object[][] loginData() {….}

Suppose loginData() generates 5 sets of login credentials, how many times method1, method2 and
method 3 would be executed ?

Choose the appropriate option

a) Method1 – 5 times, Method2 – 5 times, Method3 – 5 times


b) Method1 – 1 time, Method2 – 1 time, Method3 – 5 times
c) Method1 – 1 time, Method2 – 1 time, Method3 – 1 time
d) Cannot predict the iterations

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.

Choose the appropriate 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?

Choose the appropriate option.

a) getAttributeValue(“attributeName”)
b) getAttribute(“attributeName”)
c) getValue(“attributeName”)
d) getText()

5. 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.

a) method2, method3, method1, method4


b) method1, method4, method3, method2
c) method1, method4, method2, method3
d) Random order of execution

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.

Choose the most appropriate option.

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

Ans: (c) WebElement

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>

Ans: (b) Set<String>

Sub-topics: Extent Reports

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.

Sub-topics: WebDriver API

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")

Sub-topics: WebDriver API


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.

(a) CSS = “ul:cities li:nth-child(2)”


(b) CSS = “ul:cities li:nth-of-type(“Hydrabad”)
(c) CSS =” ul:cities li:nth-child(“Hydrabad”)
(d) CSS= “ul:cities li:nth-child(])”

Ans: (b) css="ul.cities li:nth-of-type("Hyderabad")

Sub-topic: WebDriver Api

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

None of the above

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.

Choose the most appropriate option.

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

Choose the most appropriate option

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

Cannot predict the name of error/ exception

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.

(e)TestNG XML suite file can be generated by Jenkins

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().body()

driver.switch To().mainDocument()

driver switch To().defaultDocument()

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”)

Ans: (a) driver.get("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.

(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(])”

Ans: (b) css="ul.cities li:nth-of-type("Hyderabad")

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:

<input id="nowPassword" type="password">

Choose the most appropriate option.

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:

<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’]”)

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

Ans: (c) WebElement

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 to store the Log out test object.

Choose the best option

a) String

b) WebDnver

c) WebElement

d) List

2Q) Consider the below hlml code snippet

Email : <label id='Email' class='style 1' name='input>

Which is the best localor to identify the Email web element?

Choose the most appropnate option.

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

for designing the CSS Selector?

Choose all the appropnate options.

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

Choose all the appropriate options.

a) Actions act=new Actions(driverInstance)

b) Actions act=new Actions()

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

checkboxes. These checkboxes have a name attribute as "hobbies". Assist Samantha by

choosing the correct command

Choose the most appropriate option

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?

Choose the most appropriate option.

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

Choose the most appropriate option.

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?

Choose all the appropriate options.

Ans: driver. switch To() .frame(int index)

driver. switch To(). frame(String nameOrid)

driver switch To().frame(WebElement frameElement)

driver switch To().frame()

driver switch To().iframe(String name)

9Q) Identify the correct way of launching the Chrome browser through WebDriver Instance with the

correct property

Choose the most appropriate option.

a) System.setProperty("webdriver.chrome.driver”, "src/test/resources");

WebDriver driver=new ChromeDriver();

b) System.setProperty("webdriver.chrome.driver","src/test/resources/chromedriver.exe");

WebDriver driver=new ChromeDriver();

c) 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

11Q) Kevin has designed a TestClass with the following methods:

public class TestClass

@Test

public void testMethod1() {int a = 78; }

@Test

public void testMethod2() { Assert.assertEquals(67,76); }

public void testMethod3() { System.out.println("Welcome"); }

@Test

public void testMethod4() {Assert.assertEquals("Hello", "Hello"); }

Kevin executes the above TestClass as a TestNG test. Which of the following correctly

represents the test results?

Choose the most appropriate option

A Total Tests Run: 3 Passed 2 Faited 1

B Total Tests Run: 4 Passed 3 Failed. 1

C Total Tests Run: 4 Passed 1 Failed 1

D Total Tests Run: 3 Passed: 1 Failed: 1

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

D No Messages displays on Console

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 the most appropriate option

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 the most appropriate option.

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();

2. 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)

3. 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.)

4. Write in correct 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- e,c,a,d,b

5. Kevin has designed a TestClass with the following methods:


public class TestClass {
@Test
public void testMehod1() {int a = 78;}
@Test
public void testMehod2() {Assert.assertEquals(67, 76);}
public void testMehod3() {System.out.println("Welcome");}
@Test
public void testMehod4(){Assert.assertEquals("Hello”, “Hello");}
}
Kevin executes the above TestClass as a TestNG test. Which of the
following correctly represents the test result?
ANS - Total tests run: 3, Passed: 2, Failed: 1
6. 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();

7. 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()

8. 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']")
By.cssSelector("input[id$='Password']")

9. 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”)

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

11. 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
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’]”)

13. Which of the following method causes a thread to pause for a


specified duration?
pause()

14. What are the features of TestNG?


Annotation Based
Parallel Testing
Reporting

15. __ Closes all the associated windows of webdriver.


Quit()

16. Which of the following components identify the artifacts in


Maven?
Artifact Id
Group ID
Version

17. What is the correct Syntax to instantiate a Firefox Browser


session?
WebDriver driver = new FirefoxDriver();
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()

19. Which of the following methods will be used to handle an alert


dialog box?
alert.accept()

20. Which of the given options are structure-based locators?


CSS
XPATH

21. Which of the following command should be used to extract more


than one element on web page?
findElements

22. Which of the following is a term used in thee testing of computer


software to describe testing done using a table of conditions directly
as test data inputs?
Data Driven Testing

23. getText() method extracts the text from an element.


True

24. 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?
YES , webDriver will wait 20 more seconds.

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()

28. Match the following tools with the correct description.


Tools Description
A. GIT 1. A cloud service for remote hosting of
git repositories. In addition to hosting
your code, the site helps manage
software development projects.
B. Git Lab 2. Open-Source platform or continuous
inspection of code quality to perform
automatic review with static analysis of
code to detect bugs.
C. SonarQube 3. Software that handles source code
versioning, letting you make and track
local file changes and share with remote
repository.
A-3, B-1, C-2
29. 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?
driver.switchTo().frame(int index)
driver.switchTo().frame(string nameOrld)
driver.switchTo().frame(WebElement frameElement)

30. 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?
driver.get(“URL”)
driver.navigate().to(“URL”)

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.

32. 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.
wb.getSheetAt(1)

33. 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 retrieved by driver.getWindowHandles().
Suggest Sarah with a compatible return type to store the window
references.
set <string>

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”)

36. In distributed version control system for SCM, which of the


following is not true?
Only online commits are allowed.

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

38. Sarah is an Automation Engineer and wants to build a job from


Jenkins server. The Jenkins server is up and running. What is the
default port number that Sarah needs to remember to access the
Jenkins server with URL?
8080

39. Which of the following are supporting attributes for @Test?


priority
enabled

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)

43. Which of the following is used to pass data from a source to a


particular test method to replace the constant values with variables
in TestNG?
Data Provider

44. In the TestNG framework, which of the following contains


Single/Multiple Test Cases?
Test Suite

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)

49. 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.
WebElement

50. 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?
isMultiple()

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

52. 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.
Set<String>
53. 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>Hyderabad</li>
<li>Mumbai</li>
<li>Pune</li>
</ul>
</body>
</html>
Sarah wants to locate the 3rd child element i.e., Hyderabad.
Suggest the appropriate locator strategy for Sarah.
CSS = "ul.cities li:nth-of-type("Hyderabad")

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”)

59. Sean is coding to automate mouse interactions on a web browser.


Assist Sean to identify the mouse event specific methods from the
below options. Choose the appropriate options.
moveToElement()
moveByOffset()
release()

60. Samantha has designed a TestClass with the following methods:


public class TestClass
{
@BeforeMethod
public void method1() {……}
@AfterMethod
public void method2() {……}
@Test(dataProvider=”loginData”)
public void method3(String u, String p) {…..}
@DataProvider
public Object[][] loginData() {….}
}
Suppose loginData() generates 5 sets of login credentials, how many
times method1, method2 and method 3 would be executed ? Choose
the appropriate option.
Method1 – 5 times, Method2 – 5 times, Method3 – 5 times

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

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"

65. 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.
c1.setCellValue("data")

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”)

68. 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

69. What are the various status options available in the Extent reports
library?
PASS,FAIL,SKIP,FATAL,ERROR,WARNING,INFO
70. Kevin wants to fetch all the data from the country drop down
menu and verify the data against data from the database. He is
looking into the library for a method to fetch all the data from the
country drop down box. Which method will help Kevin?
getOptions()

71. Samantha has to execute automation scripts across multiple


platforms like windows, mac, Linux which tool in the selenium suite
will be used by Samantha? Choose the most appropriate option.
selenium RC

72. 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 ?
By.partialLinkText()

73. 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.
mobileTxtBox.clear(); mobileTxtBox.sendKeys(“xxxxxxxxxx”);

74. Which MS office component(s) can be handled by Apache POI


Library?
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

76. 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?
assertSame(object1,object2)
77. Samantha has to execute automation scripts across multiple
platforms like windows, max and Linux. Which tool in the
Selenium suite will be useful for Samantha?
Selenium Grid

78. 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.switchTo().frame() immediately
will not move the context to 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 frame. Which method is used to switch back
to the main document from the frame?
switchTo.defaultContent()

79. Samantha is automating a test scenario. This scenario involves a


pop-up of confirmation window. She wants to interact with the pop-
up window and decline the confirmation. Pop-up window shows a
message “Do you want to cancel the payment?”
Driver.switchTo().alert().dismiss()

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()

82. Which java interface is used to capture screenshot of web page


using Web Driver API?
TakesScreenshot

83. Consider the below HTML code snippet.


Email ; <label id= “Email” class= “style1” name= “input”>
Which is the best locator to identify the email web element?
By.xpath(“//label[@id= ‘email’]”)
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();

2. 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)

3. 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.)

4. Write in correct 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- e,c,a,d,b

5. Kevin has designed a TestClass with the following methods:


public class TestClass {
@Test
public void testMehod1() {int a = 78;}
@Test
public void testMehod2() {Assert.assertEquals(67, 76);}
public void testMehod3() {System.out.println("Welcome");}
@Test
public void testMehod4(){Assert.assertEquals("Hello”, “Hello");}
}
Kevin executes the above TestClass as a TestNG test. Which of the
following correctly represents the test result?
ANS - Total tests run: 3, Passed: 2, Failed: 1
6. 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();

7. 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()

8. 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']")
By.cssSelector("input[id$=’Password’]”)

9. 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”)

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

11. 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()
New Actions(driverInstance)

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’]”)

13. Which of the following method causes a thread to pause for a


specified duration?
pause()

14. What are the features of TestNG?


Annotation Based
Parallel Testing
Reporting

15. __ Closes all the associated windows of webdriver.


Quit()

16. Which of the following components identify the artifacts in Maven?


Artifact Id
Group ID
Version

17. What is the correct Syntax to instantiate a Firefox Browser session?


WebDriver driver = new FirefoxDriver();

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()

19. Which of the following methods will be used to handle an alert


dialog box?
alert.accept()

20. Which of the given options are structure-based locators?


CSS
XPATH

21. Which of the following command should be used to extract more


than one element on web page?
findElements

22. Which of the following is a term used in thee testing of computer


software to describe testing done using a table of conditions directly
as test data inputs?
Data Driven Testing

23. getText () method extracts the text from an element.


True

24. 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?
No, WebDriver will not wait 20 more seconds.

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()

28. Match the following tools with the correct description.


Tools Description
A. GIT 1. A cloud service for remote hosting of git
repositories. In addition to hosting your code,
the site helps manage software development
projects.
B. Git Lab 2. Open-Source platform or continuous inspection
of code quality to perform automatic review
with static analysis of code to detect bugs.
C. SonarQube 3. Software that handles source code versioning,
letting you make and track local file changes
and share with remote repository.
A-3, B-1, C-2

29. 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?
driver.switchTo().frame(int index)
driver.switchTo().frame(string nameOrld)
driver.switchTo().frame(WebElement frameElement)
30. 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?
driver.get(“URL”)
driver.navigate().to(“URL”)

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.

32. 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.
wb.getSheetAt(1)

33. 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 retrieved by driver.getWindowHandles(). Suggest
Sarah with a compatible return type to store the window references.
set <string>

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”)

36. In distributed version control system for SCM, which of the


following is not true?
Only online commits are allowed.

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

38. Sarah is an Automation Engineer and wants to build a job from


Jenkins server. The Jenkins server is up and running. What is the
default port number that Sarah needs to remember to access the
Jenkins server with URL?
8080

39. Which of the following are supporting attributes for @Test?


priority
enabled

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)
43. Which of the following is used to pass data from a source to a
particular test method to replace the constant values with variables
in TestNG?
Data Provider

44. In the TestNG framework, which of the following contains


Single/Multiple Test Cases?
Test Suite

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)

49. 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.
WebElement
50. 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?
isMultiple()

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

52. 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.
Set<String>

53. 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>Hyderabad</li>
<li>Mumbai</li>
<li>Pune</li>
</ul>
</body>
</html>
Sarah wants to locate the 3rd child element i.e., Hyderabad.
Suggest the appropriate locator strategy for Sarah.
CSS = "ul.cities li:nth-of-type("Hyderabad")

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”)

59. Sean is coding to automate mouse interactions on a web browser.


Assist Sean to identify the mouse event specific methods from the
below options. Choose the appropriate options.
moveToElement()
moveByOffset()
release()

60. Samantha has designed a TestClass with the following methods:


public class TestClass
{
@BeforeMethod
public void method1() {……}
@AfterMethod
public void method2() {……}
@Test(dataProvider=”loginData”)
public void method3(String u, String p) {…..}
@DataProvider
public Object[][] loginData() {….}
}
Suppose loginData() generates 5 sets of login credentials, how many
times method1, method2 and method 3 would be executed ? Choose
the appropriate option.
Method1 – 5 times, Method2 – 5 times, Method3 – 5 times

61. Identify the correct flow of Jenkins build, when a maven project job
in Jenkins is triggered for build.

pom.xml >testng.xml- >testng 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

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"

65. 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.
c1.setCellValue("data")

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”)

68. 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

69. What are the various status options available in the Extent reports
library?
PASS,FAIL,SKIP,FATAL,ERROR,WARNING,INFO

70. Kevin wants to fetch all the data from the country drop down menu
and verify the data against data from the database. He is looking
into the library for a method to fetch all the data from the country
drop down box. Which method will help Kevin?
getOptions()

71. Samantha has to execute automation scripts across multiple


platforms like windows, mac, Linux which tool in the selenium suite
will be used by Samantha? Choose the most appropriate option.
Selenium Grid

72. 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?
By.partialLinkText()

73. 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.
mobileTxtBox.clear(); mobileTxtBox.sendKeys(“xxxxxxxxxx”);

74. Which MS office component(s) can be handled by Apache POI


Library?

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

76. 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?
assertSame(object1,object2)

77. Samantha has to execute automation scripts across multiple


platforms like windows, max and Linux. Which tool in the Selenium
suite will be useful for Samantha?
Selenium Grid

78. 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.switchTo().frame() immediately
will not move the context to 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 frame. Which method is used to switch back to the
main document from the frame?
switchTo.defaultContent()

79. Samantha is automating a test scenario. This scenario involves a


pop-up of confirmation window. She wants to interact with the pop-
up window and decline the confirmation. Pop-up window shows a
message “Do you want to cancel the payment?”
Driver.switchTo().alert().dismiss()

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()

82. Which java interface is used to capture screenshot of web page


using Web Driver API?
TakesScreenshot

83. Consider the below HTML code snippet.


Email; <label id= “Email” class= “style1” name= “input”>
Which is the best locator to identify the email web element?
By.id(‘Email’)

You might also like