A4Q Selenium Tester Foundation-1
A4Q Selenium Tester Foundation-1
1
Business Outcomes
• Please join in
Ask questions
Make comments
Share experiences
Second opinions and disagreements welcome
• Why are you here?
• What do you want to learn, discuss, and teach?
2
Acronyms (1)
Acronyms (2)
3
Chapter 1
Test Automation Basics
Terms to Remember
4
Chapter 1
Test Automation Basics
Section 1: Test Automation Overview
Learning Objectives
STF-1.1 (K2)
Explain the objectives, advantages,
disadvantages, and limitations of test automation
10
5
What is Test Automation
11
12
6
Advantages of Automation
• Running automated tests may be more efficient that running them manually
• Perform some tests that cannot be performed at all or easily manually
• Reduce time needed for test execution allowing us to run more tests per build
• Increase the frequency that tests can be run
• Free up manual testers to test more interesting and complex manual tests
• Fewer mistakes made by bored or distracted manual testers
• Tests can be moved earlier in the process (e.g., placed on the continuous build machine to run
unit, component, and integration tests automatically)
• Give quicker feedback on system quality and allow defects to stay in the software less time
• Tests can be run outside of normal business hours
• Automated tests are repeatable, we can ensure that a test was run correctly (as compared to a
bored manual tester skipping steps and ignoring warning signs)
• Increased confidence in the build
13
14
7
Disadvantages of Automation (2)
15
16
8
Limitations of Automation (2)
17
Example (1)
18
9
Example (2) (cont.)
19
Chapter 1
Test Automation Basics
Section 2: Manual vs. Automated Tests
20
10
Learning Objective
STF-1.2 (K2)
Understand the relation between manual and
automated tests
21
Automation Issues
22
11
Context and Reasonableness
23
Programming Required
24
12
Manual vs. Automated Tests
• Not all tests can or should be automated
• A business case should be made before automating a test
• Does this test need to be run often enough to add value?
• How often will maintenance be needed?
• Can we understand the context and reasonableness needed?
• Is the dynamic thinking of the manual tester essential to this test?
• Exploratory testing
• Fault attacks
• Is there a good way to automate the evaluation of this test?
• Highly visual results
• Something that cannot be measured through the tool
• Does there need to be a manual intervention in the test?
• Manual tests are not obsolete; some will still be needed
25
Example (1)
26
13
Example (2) (cont.)
27
Chapter 1
Test Automation Basics
Section 3: Success Factors
28
14
Learning Objective
STF-1.3 (K2)
Identify technical success factors of a test
automation project
29
How to Succeed
30
15
Testability
• Getting buy-in and help from development can really help success
• The lower on that list, the less brittle and more robust will the automation likely to be
31
32
16
Success Factors (2)
33
Example
34
17
Example (2) (cont.)
Indeed, it seemed like they went out of their way to make it hard to
automate the SUT. That included using third-party controls that my tool
did not understand, refusing to use internal naming conventions that my
tool could read, and making so many tiny changes that caused my
automated tests to fail after almost every build.
The project failed “bigly.” And, as I left the project, I wrote a post-mortem
document that explained why in full detail and five part harmony and
delivered it to management.
When I saw that development manager a few years afterwards at a
conference, he blamed me for assassinating his career.
Can’t we all just get along?...
35
Chapter 1
Test Automation Basics
36
18
Learning Objective
STF-1.4 (K2)
Understand risks and benefits of using Selenium
WebDriver
37
Selenium WebDriver
• A programming interface for developing Selenium scripts
• WebDriver supports the following languages
• C#
• Haskell
• Java
• JavaScript
• Objective C
• Edge (MicrosoftWebDriver.msi)
• Firefox (geckodriver)
• Safari (safaridriver)
38
19
Benefits of Selenium WebDriver
39
40
20
Example
RISK: One of our clients had 300 test cases automated without first building a proper
test automation framework (TAF) and using the Page Object Pattern. Before releasing
each new version they calculated the effort to update the test scripts and the effort to
write them from scratch, and each time both efforts where comparable.
ADVANTAGE: During the beginning period of test automation for major Polish e-
commerce site we observed following efforts of test automation:
• 1st TC – 6 man-days
• 2nd TC – 3 man-days
• 3rd TC – 1.5 man-days
We used Keyword Driven approach and the Page Object Pattern and were able to reuse
parts of already written scripts
NOTE: Advantages come with well-designed test automation architecture (TAA),
without it you have only the risks.
41
Chapter 1
Test Automation Basics
Section 5:
Selenium WebDriver in Test Automation
Architecture
42
21
Learning Objective
STF-1.5 (K2)
Explain the place of Selenium WebDriver in TAA
43
TAA
44
22
Example TAA
45
46
23
WebDriver
• WebDriver, as part of the test adaptation level, provides a programming interface to the SUT
• WebDriver facilitates communication with the SUT
• Allows visibility of current values in SUT
• Allows controllability of objects in SUT
• The automated script uses the API as a translation level as follows:
• The test case calls for a task to be completed
• The script calls an API in WebDriver
• That API connects to the appropriate object in the SUT
• The SUT responds as requested
• The success (or failure) is communicated back to script
• If successful, the next step in the test case is called in the script
47
48
24
Chapter 1
Test Automation Basics
Section 6:
Reasons and Purpose for Metrics Collection
49
Learning Objective
STF-1.6 (K2)
Explain the reason and purpose for metric collection
in automation
50
25
Why Collect Metrics
51
52
26
Apples vs. Oranges
• Fixed automation costs tend to be very high
• Costs of a manual test can be determined fairly easily
• Because test case is abstract, once created only needs to change when major
changes to SUT occur
• Most future costs are simply time needed to run
• Few false positives because a knowledgeable tester runs it manually
• Costs of an automated test has far more variables
• Because test script is concrete, must be modified for almost any minor SUT change
• Future costs can be very high when changes are needed
• Trouble-shooting a false positive can be expensive in time
• Many of the costs of automation can only be estimated
• Such estimates tend to be manipulated to show what we want to show rather
than being realistic
© A4Q Copyright 2018 53
53
Meaningful Metrics
54
27
A Final Point
55
Example
The manager of the test team understood automation really well, but he had made a deal with the
devil. He promised that if his team was given the budget, he would succeed at automating a very
tricky and difficult set of applications. In return for the budget, he promised an immediate (1 year)
return on benefit that was provable by a specified set of metrics.
The applications turned out to be harder to automate than he had thought. His automators were
excellent programmers, but did not understand testing. I was called in at the 8 month mark. A
review of the tests already written showed that almost all were worthless as far as managing actual
risk. Few really mitigated any important risks; instead they simply flashed and did stuff to show
that they were … doing stuff.
Given time, and some trained automators, I believe that automation program could have really
added value to the organization. By insisting
on immediate, provable value, however, management doomed
the automation program to failure. All of the necessities of
good testing were sacrificed to try to prove, prematurely, that
the automation was paying for itself.
56
28
Chapter 1
Test Automation Basics
57
Learning Objective
STF-1.7 (K2)
Understand and can compare objectives of using
Selenium toolset (WebDriver, Selenium Server,
Selenium Grid)
58
29
Selenium
59
Selenium IDE
60
30
Example Selenium IDE
61
Selenium WebDriver
62
31
Selenium WebDriver Architecture
Web
Script Library WebDriver
Browser
63
Selenium Grid
64
32
Example – Selenium Grid
Script with
Remote
WebDriver
Selenium Grid
Selenium
Grid Nodes
Hub
65
66
33
Place of Selenium Standalone Server
Network
Selenium Web
Script Library WebDriver
Server Browser
67
Chapter 2
Internet Technologies for Test
Automation of Web Applications
68
34
Terms to Remember
CSS selector
HTML
tag
XML
XPath
69
Chapter 2
Internet Technologies for Test
Automation of Web Applications
Section 1: Understanding HTML and XML
70
35
Learning Objective
STF-2.1 (K3)
Understand and can write HTML and XML
documents
71
HTML
72
36
HTML Tags
73
74
37
Lists and Tables
75
HTML Forms
76
38
XML
77
XML Attributes
78
39
XML has a Tree Structure
• The current node is any arbitrary node that we choose.
• All other relationships derive from the current node
• In the slide below, we have chosen “Bonnie Tyler” as the current node
• All relationships then refer to that node
79
80
40
Chapter 2
Internet Technologies for Test
Automation of Web Applications
Section 2: XPath and Searching HTML
Documents
81
Learning Objective
82
41
Example XML document
83
XPath Expressions
84
42
Selecting Nodes
85
Wildcards in XPath
86
43
Predicates
87
Operators in Predicates
88
44
Useful String Functions
89
Useful Links
90
45
Chapter 2
Internet Technologies for Test
Automation of Web Applications
91
Learning Objective
STF-3.3 (K3)
Apply CSS locators to find elements of HTML
documents
92
46
Cascading Style Sheets
93
A CSS Rule-Set
94
47
CSS vs. XPath Selectors
95
96
48
CSS Selectors – Work with Attributes
97
98
49
CSS Selectors for Form Elements
99
100
50
Chapter 3
Using Selenium WebDriver
101
Terms to Remember
class attribute
DOM (Document Object Model)
function
ID
iframe
modal dialog
pytest
WebDriver
wrapper
102
51
Chapter 3
Using Selenium WebDriver
103
Learning Objective
STF-3.1 (K3)
Use appropriate logging and reporting mechanisms
104
52
Running Scripts
• Test automation simulates a human tester running a test via the
keyboard and mouse
• A tester running a test has a pretty good idea what happened
• An automated script relies on logging to understand what
happened
• Python scripts may be programmed from scratch
• Alternately, existing frameworks may be used to run tests
• “unittest”
• “pytest”
• Testing frameworks reduce the amount of work needed
• For this syllabus, we have chosen to work with pytest because it works
quite well with Selenium WebDriver
© A4Q Copyright 2018 105
105
• “pytest” runs all test cases in the current directory and child
subdirectories below it
• Searches for test_*.py or *_test.py files
• From those files collects:
• test_* : functions outside of a class
• test_* : methods inside Test* classes (without an __init__ method)
• Run behavior depends on execution flags
• pytest : (no flag) runs all tests
• pytest –v : verbose mode showing full names
• pytest –q : quiet version, displays less information
• pytest --html=report.html : run test with report to the HTML file
(must have pytest-html module installed)
106
53
Marks
107
108
54
Python Logging Library
109
110
55
Assertions
111
An Automated Step
112
56
Reporting
113
Report Contents
114
57
Chapter 3
Using Selenium WebDriver
115
Learning Objective
STF-3.2 (K3)
Navigate to different URLs using WebDriver
commands
116
58
Different Browser Drivers
117
118
59
Opening a Browser Screen
119
120
60
Closing the Browser
121
Chapter 3
Using Selenium WebDriver
122
61
Learning Objective
STF-3.3 (K3)
Change window context in web browsers using
WebDriver commands
123
Changing Contexts
124
62
Opening Two Browsers
125
126
63
Switching Between Tabs in a Browser
127
128
64
Changing Frames
129
130
65
Chapter 3
Using Selenium WebDriver
131
Learning Objective
STF-3.4 (K3)
Capture screenshots of web pages using WebDriver
commands
132
66
The Value of Screenshots
133
134
67
Different Snapshots
135
136
68
Chapter 3
Using Selenium WebDriver
137
Learning Objective
STF-3.5 (K4)
Locate GUI elements using various strategies
138
69
Locating GUI Elements
• Operating on a GUI element using WebDriver requires that you find it on the
screen first
• A variety of functions are available: two main flavors:
• To find a single object: find_element_by_xx
• To find multiple objects: find_elements_by_xx
• Each of the above uses different locators
• HTML locators
• By the ID: by_id(id_)
• By the class: by_class_name(name)
• By the tag name: by_tag_name(name)
• XPath locators: by_xpath(xpath)
• CSS selectors: by_css_selector(css_selector)
139
140
70
The DOM for a Simple HTML Page
141
Locate UI Elements by ID
• Advantages
• Efficient
• Each ID should be unique in the HTML document
• Testers can (theoretically) add IDs to the SUT
• Disadvantages
• IDs may change dynamically when auto-generated
• IDs not appropriate for code used in multiple places
• Testers may not be allowed to modify the SUT
142
71
Locate UI Elements by Tag Name
143
144
72
Locate UI Elements by Link Text (2)
• Advantages:
• Can find the element if unique to page
• The link text is visible to the user (in most cases), so it’s easy to
know what the test code is looking for
• Partial link text is slightly less likely than the full link text to change
• Disadvantages
• More likely to change than ID or class name
• Partial text may create more matches
145
146
73
Absolute Path vs. Relative Path
147
• Within an XPath string, you can look for ID, name, class, tag
name, etc
• Can create generic locator functions using XPath
• Pass in an attribute type to the function
• Pass a path string that specifies the attribute in it
• Generic functions reduce the amount of code you need to
write
148
74
Locate UI Elements by XPath – Generic
Locator (2)
149
• Advantages
• Can find elements with no unique attributes (ID, class, name, etc.)
• Can use XPath in generic locators, using the different x_by_ strategies (by
ID, by class, etc.) as needed
• Disadvantages
• Absolute XPath code is fragile; may break with the smallest changes to the
HTML structure
• Relative XPath code can find the wrong node if the attribute or element is
not unique on the page
• XPath may be implemented differently on different browsers or not
natively supported (e.g., IE); extra effort will be required to run WebDriver
tests in those environments
150
75
Locate UI Elements by CSS Selector
151
152
76
Locate via Expected Conditions (1)
153
154
77
Chapter 3
Using Selenium WebDriver
155
Learning Objective
STF-3.6 (K3)
Get state of GUI elements using WebDriver
commands
156
78
Get the State of UI Elements
157
158
79
Get a Text Value
159
Chapter 3
Using Selenium WebDriver
160
80
Learning Objective
STF-3.7 (K3)
Interact with GUI elements using WebDriver
commands
161
162
81
Working with Text Fields
163
164
82
Working with Checkbox Elements
165
166
83
Working with Select Controls
• Select controls (dropdown list boxes) allow user to select one or more
items from a list
• Selection options include
• Search the HTML to find the item desired and then click() on it
• Select by an item value (select_by_value(value))
• Select all items that display matching text (select_by_visible_text(text))
• Select an item by index (select_by_index(index))
• Deselection options include:
• Deselect all items (deselect_all())
• Deselect by index (deselect_by_index(index))
• Deselect by value (deselect_by_value(value))
• Deselect by visible text (deselect_by_visible_text(text))
167
168
84
Click on a Dropdown Option
169
170
85
© A4Q Copyright 2018 171
171
• All code for the modal dialog is actually placed in the HTML
of the invoking screen
• Working with modal dialog depends on finding modal
element in the HTML code
• In this ecommerce site, the ID for the modal element is
layer_cart
• Want to get a reference to this element
172
86
Dealing with Modal Dialogs (2)
173
174
87
Chapter 3
Using Selenium WebDriver
Section 8:
Interact with User Prompts in Web Browsers
175
Learning Objective
STF-3.8 (K3)
Interact with user prompts in web browsers using
WebDriver commands
176
88
User Prompt Dialog Boxes
177
178
89
Chapter 4
Preparing Maintainable Test
Scripts
179
Terms to Remember
fixture
persona
wrapper
180
90
Chapter 4
Preparing Maintainable Test
Scripts
Section 1: Maintainability of Test Scripts
181
Learning Objective
STF-4.1 (K2)
Understand which factors support and affect
maintainability of test scripts
182
91
Intelligent Automation
183
184
92
© A4Q Copyright 2018 185
185
186
93
Use Relative Paths
187
188
94
Consistent Names
and
189
190
95
Log Execution Progress
191
Logging Examples
192
96
Consistent File Names
• Use consistent file names that convey their place in the functional
hierarchy
• Rather than:
• Use:
193
Unnumbered Files
194
97
Chapter 4
Preparing Maintainable Test
Scripts
Section 2: Wait Mechanisms
195
Learning Objective
STF-4.1 (K3)
Use appropriate wait mechanisms
196
98
Why are Waits Needed?
197
• The sleep() function is always set for the worst possible case
and should not be used
• WebDriver with Python has two different waits:
• Implicit waits
• Explicit waits
198
99
Implicit Waits
199
Explicit Waits
200
100
Defined ExpectedCondition Methods
• title_contains • title_is
• presence_of_element_located • visibility_of
• element_to_be_clickable
• visibility_of_element_located • staleness_of
• presence_of_all_elements_located • element_to_be_selected
• text_to_be_present_in_element • alert_is_present
• text_to_be_present_in_element_value
• frame_to_be_available_and_switch_to_it
• invisibility_of_element_located
• element_located_to_be_selected
• element_selection_state_to_be
• element_located_selection_state_to_be
201
202
101
Chapter 4
Preparing Maintainable Test
Scripts
Section 3: Page Objects
203
Learning Objective
STF-4.3
(K4) Analyze GUI of SUT and use Page Objects to
make its abstractions
204
102
Use Page Objects
205
206
103
Sample Code Not Using Page Objects
207
208
104
Example of Page Object
209
210
105
Page Objects Example
Using an [XXXXX] page
211
212
106
Example
213
Chapter 4
Preparing Maintainable Test
Scripts
Section 4: Keyword Driven Testing
214
107
Learning Objective
STF-4.4 (K4)
Analyze test scripts and apply Keyword Driven Testing
principles to building test scripts
215
216
108
Keyword Driven Testing
• ISTQB® Definition:
A scripting technique that uses data files to contain not
only test data and expected results, but also keywords
related to the application being tested. The keywords are
interpreted by special supporting scripts that are called by
the control script for the test.
217
Keyword/Action Word
218
109
Keyword Example
219
220
110
Advantages of KDT (2)
221
Here keywords
are implemented
Here keywords as business steps
are implemented
in Page Objects
222
111
Things to Consider
223
Implementation of KDT
• Top-down
• Write test case steps as you would write manual tests, and then
implement them in your tool
• These steps can be written by test analysts
• More cost-effective when many keywords have already been
implemented or when tests scripts are updated
• Bottom-up
• Record a script and then refactor it to KDT architecture
• Usually used at the beginning of test automation
224
112
Tools for KDT
• Cucumber
• Robot Framework
• Katalon Studio
• Concordion
• HPE Unified Functional Testing
225
226
113
Example of a KWD Test
227
Appendix A (1)
class attribute: An HTML attribute that points to a class in a CSS style sheet. It can
also be used by a JavaScript to make changes to HTML elements with a specified
class
comparator: A tool to automate the comparison of expected results against the
actual results
CSS selector: Selectors are patterns that target the HTML elements you want to
style
Document Object Model (DOM): An application programming interface that
treats an HTML or XML document as a tree structure wherein each node is an
object representing a part of the document
fixture: A test fixture is a mock object or environment used to consistently test
some item, device, or piece of software
228
114
Appendix A (2)
229
Appendix A (3)
modal dialog: A screen or box which forces the user to interact with it before they
can access the underlying screen
Page Object Pattern: A test automation pattern which requires that technical logic
and business logic be dealt with at different levels
pesticide paradox: A phenomenon where repeating the same test multiple times
causes it to find fewer defects
persona: A user profile created to represent a user type that interacts with a
system in a common way
pytest: A Python testing framework
tag: HTML elements are delineated by tags, written using angle brackets
230
115
Appendix A (4)
WebDriver: The interface against which Selenium tests are written. Different
browsers can be controlled via different java classes, e.g., ChromeDriver,
FirefoxDriver, etc.
wrapper: A function in a software library whose main purpose is to call another
function, often adding or enhancing functionality while hiding complexity
XML (eXtensible Markup Language): A markup language that defines a set of rules
for encoding documents in a format that is both human-readable and machine-
readable
XPath (XML Path Language): A query language for selecting nodes from an XML
document
231
116
Exam Questions
A4Q Certified Selenium Tester Foundation
Participant
Please note: Your name will be printed on the certificate as stated above. Please write clearly and in block letters.
Phone (business): /
Prefix Number
Mobile phone: /
Prefix Number
E-Mail address:
Please note: E-Mail address that iSQI will use to send you the exam results. Please write clearly and in block letters.
Postal address
Please note: iSQI will use the following address to ship the certificate unless it get sent to your training provider.
Please write clearly and in block letters.
if applicable: Department
Address I:
Street, Zip code, City
Address II:
if applicable: PO box number Country
Training provider
Training provider
Instructor
Confirmation
(Please note: the confirmation is mandatory to conduct the examination)
I hereby confirm the correctness of all my personal information as given above - especially the name and
contact details.
I agree to have my personal data electronically stored and processed by the iSQI GmbH for general
reviewing purposes and for the purpose of issuing, administrating and recognizing certificates.
In addition, I hereby grant permission to the data being forwarded to the respectively responsible board.
By taking this exam you approve the iSQI Data Protection Clause. For further information please ask the
invigilator for the print-out of the Data Protection Clause or see www.isqi.org
Remarks
What is capture/playback?
A. A function in a software library whose main purpose is to call another function often
adding or enhancing functionality
B. The interface against which Selenium tests are written. Different browsers can be
controlled via different java classes, e.g., ChromeDriver, FirefoxDriver, etc.
C. Representation of the layers, components, and interfaces of a test automation architecture,
allowing for a structured and modular approach to implement test automation.
D. A test automation approach, where inputs to the System Under Test (SUT) are recorded
during manual testing in order to generate automated test scripts that could be executed
later (i.e., replayed).
Which two of the following five answers are advantages to using test automation?
A. Can perform some tests that we might not be able to run manually
B. Extra false positives can be collected and monitored
C. Allows the testers to concentrate on the technology rather than the risk
D. Reducing mistakes by bored or distracted testers
E. Technical debt is easier to add when automating
CERTiFYING PEOPLE
43-CSeT-F-Mock isqi.org
Page 5 of 26
A4Q – Certified Selenium Tester Foundation
A. Programming can add context and reasonableness to the test, mimicking a manual
tester’s thoughts
B. By adding programming, the programmer always reduces technical debt in the automation
project
C. Because an automated script requires more analysis and more design, maintenance
costs are less than a manual test
D. There is no actual need to add programming to a script; the tools work perfectly well
without it
Which of the following is NOT an interface level that we could use automation for testing?
Which of the following is a potential benefit that can be obtained by using Selenium
WebDriver?
CERTiFYING PEOPLE
43-CSeT-F-Mock isqi.org
Page 6 of 26
A4Q – Certified Selenium Tester Foundation
Into which part of the test adaptation layer does Selenium fit?
A. API
B. Services
C. GUI
D. None; Selenium fits into the test definition layer
Consider the following metrics that might be useful, given in the syllabus:
Which of the following Selenium tools can run tests across multiple machines?
A. Selenium IDE
B. Selenium WebDriver
C. Selenium Grid
D. Selenium Standalone Server
CERTiFYING PEOPLE
43-CSeT-F-Mock isqi.org
Page 7 of 26
A4Q – Certified Selenium Tester Foundation
What is XPath?
CERTiFYING PEOPLE
43-CSeT-F-Mock isqi.org
Page 8 of 26
A4Q – Certified Selenium Tester Foundation
Given the following code, which of the options best represents the resulting web page?
<html>
<body>
<h1>
Header Name
</h1>
<p>
paragraph text
</p>
<br/>
<!-- Here's the list:-->
<ul>
<li>first</li>
<li>second</li>
<li>third</li>
</ul>
</body>
</html>
A. Header Name
paragraph text
first
second
third
B. Header Name
paragraph text
1. first
2. second
3. third
C. Header Name
paragraph text
first
second
third
D. Header Name
paragraph text
Here's the list:
1. first
2. second
3. third
CERTiFYING PEOPLE
43-CSeT-F-Mock isqi.org
Page 9 of 26
A4Q – Certified Selenium Tester Foundation
Which of the following XPath expressions will find the value of UoM attribute for
temperature in New York?
A. //temperature[@city=“New York”]/text()
B. //temperature[@city=”New York”]/@UoM
C. //temperature[@city=”New York”]/@UoM/text()
D. @UoM[//temperature[@city=”New York”]]
CERTiFYING PEOPLE
43-CSeT-F-Mock isqi.org
Page 10 of 26
A4Q – Certified Selenium Tester Foundation
<html>
<head/>
<body>
<form class="odd first">
User: <input type="edit" class="user" name="user" />
<br/>
Password: <input type="edit" class="password" name="password" />
<br/>
<button type="submit" name="login" class="big button">Log in</button>
<button type="submit" name="cancel" class="big button">Cancel</button>
</form>
</body>
</html>
Which HTML element or elements will be found with the following CSS selector?
A. <head>
B. <p>
C. <br/>
D. <div>
CERTiFYING PEOPLE
43-CSeT-F-Mock isqi.org
Page 11 of 26
A4Q – Certified Selenium Tester Foundation
CERTiFYING PEOPLE
43-CSeT-F-Mock isqi.org
Page 12 of 26
A4Q – Certified Selenium Tester Foundation
A. An alert
B. An iframe
C. A prompt
D. A confirm
CERTiFYING PEOPLE
43-CSeT-F-Mock isqi.org
Page 13 of 26
A4Q – Certified Selenium Tester Foundation
What will be the output of the execution of following piece of code from the file “question.py”?
A. INFO:root:Line 3
WARNING:root:Line 5
ERROR:root:Line 6
INFO:root:Line 7
B. INFO:root:Line 3
WARNING:root:Line 5
ERROR:root:Line 6
Traceback (most recent call last):
File "question.py", line 8, in <module>
assert test_data == "Hello world", "Wrong test data"
AssertionError: Wrong test data
INFO:root:Line 7
C. INFO:root:Line 7
ERROR:root:Line 6
WARNING:root:Line 5
INFO:root:Line 3
D. INFO:root:Line 3
WARNING:root:Line 5
ERROR:root:Line 6
Traceback (most recent call last):
File "question.py", line 8, in <module>
assert test_data == "Hello world", "Wrong test data"
AssertionError: Wrong test data
CERTiFYING PEOPLE
43-CSeT-F-Mock isqi.org
Page 14 of 26
A4Q – Certified Selenium Tester Foundation
dr1 = webdriver.Chrome()
dr2 = webdriver.Firefox()
dr1.get(‘https://python.org’)
python_title = dr1.title
dr2.get(python_title)
dr2.get(‘https://perl.org’)
What will be the result of its execution (assume that the test environment is configured
correctly and all drivers are present)? Choose two:
Given a frame with an ID of "frameID", which of the following is/are the best line(s) of
code for changing the context of the test script back from the frame to the page that
the frame is in?
A. get('frameID').calling_page
B. element = driver.find_element_by_id('frameID')
element.back()
C. fr = driver.find_element_by_id('frameID')
driver.switch_to.frame(fr)
D. driver.switch_to.default_content()
CERTiFYING PEOPLE
43-CSeT-F-Mock isqi.org
Page 15 of 26
A4Q – Certified Selenium Tester Foundation
Which of the following answers contains the proper Python code for taking a screenshot
of the image python.png?
Assume that the variable driver contains the reference to the WebDriver object for the web browser dis-
playing the page from which the excerpt has been taken.
A. driver.find_element_by_id(“python.png”).screenshot(“my_new_pic.png”)
B. driver.find_element_by_id(“python”).screenshot(“my_new_pic.png”)
C. element = driver.find_element_by_id(“python”)
element.take_screenshot(“my_new_pic.png”)
D. element = driver.find_element_by_xpath(“a[@id=’python’]/img”)
element.take_screenshot(“my_new_pic.png”)
Given a checkbox with an ID = "checkbox1", which line(s) of code will get the Boolean
value for the selected state of the checkbox?
A. element = driver.find_element_by_id('checkbox1')
cb_state = element.is_selected()
B. element_state = element('checkbox1').is_selected
C. element = driver.find_element_by_id('checkbox1')
element_state = element.boolean
D. element = driver.find_element_by_state(id = 'checkbox1')
CERTiFYING PEOPLE
43-CSeT-F-Mock isqi.org
Page 16 of 26
A4Q – Certified Selenium Tester Foundation
A. element = driver.find_element_by_class_name('dropdown1.option3')
element.click()
B. dropdown = driver.find_element_by_id('dropdown1')
element = dropdown.find_element_by_class_name('option3')
element.click()
C. dropdown = driver.find_element_by_id(dropdown1)
element = dropdown.find_element_by_class(option3)
element.click
D. dropdown = driver.find_element_by_class_name(option3)
dropdown.click()
Which line(s) of code will allow you to get the text from an alert?
A. alert = driver.switch_to.alert
driver.find_element_by_text('text') in alert
B. alert = driver.switch_to.alert
assert 'alert_text' in alert
C. alert = driver.find_element_by_text('text').alert
D. alert = driver.switch_to.alert
alert_text = alert.text
CERTiFYING PEOPLE
43-CSeT-F-Mock isqi.org
Page 17 of 26
A4Q – Certified Selenium Tester Foundation
For efficiency, you want to create generic functions for locating WebElements.
Which of the following is the BEST approach for such a generic function?
A. Use IDs
B. Use class names
C. Use XPath
D. Use the link text
Which of the following sentences about logging and reporting in test automation is correct?
A. Logging is used to show the test results (pass/fail), and reporting is used to show the
trace of an automated test execution
B. Logging is used to show errors in an automated test execution only, and reporting is used
to show test data
C. Logging is used to show the trace of an automated test execution, and reporting is used to
show the test results (pass/fail)
D. Logging is not necessary an automated test execution as test scripts contain test steps,
and reporting is used to show the test results (pass/fail)
Assuming that multiple tabs are open in a Chrome browser whose webdriver object has an
identifier of “driver”, how can the entire browser and all of its tabs be closed at once?
A. driver.close(“ALL”)
B. driver.quit()
C. driver.close()
D. driver.quit(‘ALL’)
CERTiFYING PEOPLE
43-CSeT-F-Mock isqi.org
Page 18 of 26
A4Q – Certified Selenium Tester Foundation
After working with a specific frame in a web page, which one of the following is the BEST
approach to change the context back to the whole page?
Which method of webdriver object takes screenshot of the whole screen and writes it
to a file?
A. get_screenshot_as_file(<filename>)
B. screenshot(<filename>)
C. get_screenshot_as_file(<filename>, <filetype>)
D. there is no such method, one should use method screenshot and then save it
to a file separately
What is the main advantage of locating web page elements by their ID?
A. Because the method for finding elements by id has the shortest name
B. Because if a web page is valid XML, this attribute is unique, so element is found
unambiguously
C. Because all HTML tags have that attribute
D. Because this attribute can be used in all location strategies
CERTiFYING PEOPLE
43-CSeT-F-Mock isqi.org
Page 19 of 26
A4Q – Certified Selenium Tester Foundation
Under what conditions might you get the return value None?
In the web application you are testing, you need to type text in a textbox.
Which of the following is the BEST approach for typing text in a textbox using WebDriver?
A. Use the switch_to class to switch to the textbox element, and then typing the text
B. Use the cleartext() method, then use the send_keys(string_to_type)method
to enter the text
C. Click on the textbox and then call textbox("<text to enter">)
D. Use the text(string_to_type) method to enter the text
Which TWO of the following methods close an alert shown by web browser?
A. close()
B. dismiss()
C. escape()
D. accept()
E. quit()
CERTiFYING PEOPLE
43-CSeT-F-Mock isqi.org
Page 20 of 26
A4Q – Certified Selenium Tester Foundation
A. A test automation approach which requires that technical logic and business logic be dealt
with at different levels
B. A function in a software library whose main purpose is to call another function often
adding or enhancing functionality
C. An application programming interface that treats an HTML or XML document as a tree
structure wherein each node is an object representing a part of the document
D. An API in the SUT which is created predominately to provide enhanced testability
In the web application you are testing, you get the state of several checkboxes.
Which of the following is the BEST approach for making your test scripts maintainable?
CERTiFYING PEOPLE
43-CSeT-F-Mock isqi.org
Page 21 of 26
A4Q – Certified Selenium Tester Foundation
In the web application you are testing, a modal dialog should be dismissed when you click on
the cancel button. Given the following code:
A. title_is
B. element_to_be_clickable
C. invisibility_of_element_located
D. presence_of_element_located
CERTiFYING PEOPLE
43-CSeT-F-Mock isqi.org
Page 22 of 26
A4Q – Certified Selenium Tester Foundation
<form>
User: <input type="edit" id="user" name="user" />
<br/>
Password: <input type="edit" id="password" name="password" />
<br/>
<button type="submit" name="login">Log in</button>
<button type="submit" name="cancel" >Cancel</button>
</form>
A. def cancel_login():
drv.find_element_by_id("user").send_keys("admin")
drv.find_element_by_name("cancel").click()
B. def login():
drv.find_element_by_name("cancel").click()
C. def remind_password():
drv.find_element_by_link("remind").click()
D. def cancel_login():
drv.find_element_by_name("cancel").click()
Make a wire transfer from the customer account to the provider account as a
payment for purchased goods.
Which of the following sets of data will be the best parameter set for a keyword implementing this
test step?
CERTiFYING PEOPLE
43-CSeT-F-Mock isqi.org
Page 23 of 26
A4Q – Certified Selenium Tester Foundation
Declaration
☒ I hereby confirm that I have answered the questions myself, without the use of prohibited material.
I undertake, such obligation being unlimited in time, to keep confidential the content of the present test
questions and the answer choices, and to refrain from forwarding them to third parties.
CERTiFYING PEOPLE
43-CSeT-F-Mock isqi.org
Page 24 of 26
A4Q – Certified Selenium Tester Foundation
CERTiFYING PEOPLE
43-CSeT-F-Mock isqi.org
Page 25 of 26
A4Q – Certified Selenium Tester Foundation
CERTiFYING PEOPLE
43-CSeT-F-Mock isqi.org
Page 26 of 26
1
A4Q
Selenium Tester
Foundation
Released
Version 2018
Version 2018
© A4Q Copyright 2018
2
All contents of this work, in particular texts and graphics, are protected by copyright. The use and
exploitation of the work is exclusively the responsibility of the A4Q. In particular, the copying or
duplication of the work but also of parts of this work is prohibited. The A4Q reserves civil and penal
consequences in case of infringement.
Revision History
Version Date Remarks
Version 2018 5 August 2018 1. Release version
Version 2018
© A4Q Copyright 2018
3
Answer Key
Question Number Correct Answer K-Level LO
1 D Keywords 1
2 B Keywords 1
3 A, D STF-1.1 K2
4 A STF-1.2 K2
5 D STF-1.3 K2
6 B STF-1.4 K2
7 C STF-1.5 K2
8 A STF-1.6 K2
9 C STF-1.7 K2
10 C Keywords K1
11 C Keywords K1
12 C STF-2.1 K3
13 B STF-2.2 K3
14 C STF-2.3 K3
15 D STF-2.1 K2
16 A STF-2.2 K2
17 B STF-2.3 K2
18 A Keywords K1
19 B Keywords K1
20 A STF-3.1 K3
21 B, D STF-3.2 K3
22 D STF-3.3 K3
23 B STF-3.4 K3
24 A STF-3.6 K3
25 B STF-3.7 K3
26 D STF-3.8 K3
27 C STF-3.5 K4
28 C STF-3.1 K2
29 B STF-3.2 K2
30 A STF-3.3 K2
31 A STF-3.4 K2
32 B STF-3.5 K2
33 D STF-3.6 K2
34 B STF-3.7 K2
35 B, D STF-3.8 K2
36 A Keywords K1
37 C STF-4.1 K2
38 C STF-4.2 K3
39 D STF-4.3 K4
40 C STF-4.4 K4
Version 2018
© A4Q Copyright 2018
4
Question 1 Keywords K1
What is capture/playback?
A. Incorrect. This is the definition of a wrapper given in the Glossary appendix in STF syllabus
B. Incorrect. This is the syllabus definition for WebDriver
C. Incorrect. This is the ISTQB Glossary for generic test automation architecture
D. Correct. This is the ISTQB Glossary definition
Question 2 Keywords K1
A. Incorrect. This does not align with ISTQB Glossary definition of a test oracle
B. Correct. The ISTQB Glossary defines a test oracle as a source to determine expected results
to compare with the actual result of the system under test
C. Incorrect. This does not align with ISTQB Glossary definition of of a test oracle
D. Incorrect. This does not align with ISTQB Glossary definition of of a test oracle
Question 3 STF-1.1 K2
Which two of the following five answers are advantages to using test automation?
A. Correct. As per section 1.1, automation allows us to run tests that manual testers cannot,
for example, some reliability and performance testing
B. Incorrect. As per section 1.1, false positives occur when automation failures are not SUT
failures, but are due to defects in the automation itself
C. Incorrect. As per section 1.1, concentrating on automation can make testers lose sight of
risk management for the project
D. Correct. As per section 1.1, long, boring, brain numbing tests can be automated to keep the
testers from making inattention mistakes
E. Incorrect. While the statement is true, technical debt is not a good thing, as per section 1.1
and the glossary
Version 2018
© A4Q Copyright 2018
5
Question 4 STF-1.2 K2
What is the value of adding additional intelligence via programming to an automated script?
A. Correct. As per section 1.2, by adding extra intelligence to the script, automation can add
more value by more often actually completing the test rather than failing it early
B. Incorrect. As per section 1.1, the added programming can add technical debt, especially if
done poorly
C. Incorrect. As per section 1.2, because an automated script requires more analysis, more
design, more engineering and more maintenance than a manual script, we must figure in the
cost of creating it
D. Incorrect. As per section 1.2, adding intelligence to the script through added programming
can prevent many failures and add value to the testing
Question 5 STF-1.3 K2
Which of the following is NOT an interface level that we could use automation for testing?
A. Incorrect. The GUI level can be used for automation as per section 1.3
B. Incorrect. The service level can be used for SOAP, REST, etc. testing as per section 1.3
C. Incorrect. The protocol level can be used for HTTP, HTTPS, etc. testing as per section 1.3
D. Correct. The abstract level is not an automation level that we can use automation for. As
per section 1.3, this is not a level of interface that automation would use. Instead, we
discuss in section 1.2, and in several other places in the syllabus the advantage of using
abstraction in different ways
Question 6 STF-1.4 K2
Which of the following is a potential benefit that can be obtained by using Selenium WebDriver?
A. Incorrect. Per section 1.4, this is a risk, rather than a potential benefit
B. Correct. Per section 1.4, this is a potential benefit, rather than a risk
C. Incorrect. The pesticide paradox (explained in the ISTQB Foundation syllabus) tells us that
automated tests, when run over and over, tend to find fewer and fewer bugs. As section 1.4
says, “Manual testers are more efficient at finding bugs than is automation”
D. Incorrect. As explained in section 1.6, “automation tends to be quite expensive in both
human effort and tool resources. There is little to no positive return on investment in the
short run; value comes over the long run. Years rather than months.”
Version 2018
© A4Q Copyright 2018
6
Question 7 STF-1.5 K2
Into which part of the test adaptation layer does Selenium fit?
As stated in section 1.5, “Selenium WebDriver fits into the test adaptation layer, providing a
programmatic way to access the SUT through the browser interface.” Since the browser interface is
a graphical user interface, the correct answer is C.
Question 8 STF-1.6 K2
Consider the following metrics that might be useful, given in the syllabus:
Of the metrics, i, ii, and iii are generally useful to measure regression test automation return on
investment. Selenium is used to test application features across various browsers, as explained in
the syllabus, so vi and vii are useful. Selenium is less useful for integration testing and unit testing, so
iv and v are unlikely to be useful.
Therefore, the correct answer is A.
Question 9 STF-1.7 K2
Which of the following Selenium tools can run tests across multiple machines?
As stated in section 1.7 of the syllabus, “Selenium Grid…enables running test scripts across many
machines with many configurations.” Therefore, C is correct.
Question 10 Keywords K1
What is XPath?
A. Incorrect. This is the definition of a CSS selector from the syllabus appendix
B. Incorrect. This is the definition of a python function from the syllabus appendix
C. Correct. This is the definition from the syllabus appendix
D. Incorrect. This is the definition of an iframe from the syllabus appendix
Version 2018
© A4Q Copyright 2018
7
Question 11 Keywords K1
Question 12 STF-2.1 K3
Given the following code, which of the options best represents the resulting web page?
A. Incorrect. Per section 2.1, the h1 heading should be more visually important than paragraph
text, and the list should be unordered
B. Incorrect. Per section 2.1, the list should be unordered
C. Correct. Per section 2.1, the h1 heading is more visually important than paragraph text, and
the list is unordered
D. Incorrect. Per section 2.1, the comment should not be displayed and the list should be
unordered
Question 13 STF-2.2 K3
A. Incorrect. This XPath expression gives the text of the node, not an attribute
B. Correct. This XPath finds the UoM attribute of the proper node
C. Incorrect. There is no need to add text() function to the value of a node
D. Incorrect. This is not a valid XPath expression
Version 2018
© A4Q Copyright 2018
8
Question 14 STF-2.3 K3
The correct answer is C. Let’s decompose the selector given in the question:
.first – finds the form with the “first” class
> – finds all children of that form
.big – finds all children of the form, which have the “big” class (there are two of them)
+ – finds an element, which is next to the element from previous line of justification
.button – finds an element with the “button” class; there are two such elements, but only one is
preceded by an element with the “big” class
Question 15 STF-2.1 K2
In section 2.1, table 2, the “<div>” tag “defines a section in the document.”
Therefore, the correct answer is D.
Question 16 STF-2.2 K2
Which of the following statements BEST captures the purpose of XPath in Selenium automation?
Version 2018
© A4Q Copyright 2018
9
Question 17 STF-2.3 K2
Section 2.3 lists external style sheets, internal style sheets, and inline styles as the three ways CSS is
used. Outboard style does not exist.
Therefore, the correct answer is B.
Question 18 Keywords K1
Question 19 Keywords K1
A. Incorrect. An alert pops up as a modal dialog which forces the user to deal with it before
dealing with the underlying screen as described in section 3.8
B. Correct. An iframe is an HTML inline frame which can hold another HTML document as
defined in the glossary
C. Incorrect. A prompt is similar to an alert in that it pops up as a modal dialog which forces
the user to deal with it before dealing with the underlying screen as described in section 3.8
D. Incorrect. A confirm is similar to an alert in that it pops up as a modal dialog which forces
the user to deal with it before dealing with the underlying screen as described in section 3.8
Question 20 STF-3.1 K3
What will be the output of the execution of following piece of code from the file “question.py”?
A. Correct. This is the proper sequence of the proper lines that will be printed by Python
logging facility
B. Incorrect. The assertion will not throw an exception because test_data equals “Hello world”
C. Incorrect. Wrong sequence of printed lines
D. Incorrect. The assertion will not throw an exception because test_data equals “Hello world”
Version 2018
© A4Q Copyright 2018
10
Question 21 STF-3.2 K3
Question 22 STF-3.3 K3
Given a frame with an ID of "frameID", which of the following is/are the best line(s) of code for
changing the context of the test script to back from the frame to the page that the frame is in?
Question 23 STF-3.4 K3
Which of the following answers contains the proper Python code for taking a screenshot of the
image python.png? Assume that the variable driver contains the reference to the WebDriver object
for the web browser displaying the page from which the excerpt has been taken.
A. Incorrect. This piece of code does not find the proper HTML element
B. Correct. This piece of code first finds the element enclosing the picture we are interested in,
and then takes a picture of it with screenshot method
C. Incorrect. This piece of code uses wrong method to take a picture
D. Incorrect. This piece of code uses the wrong method to take a picture
Version 2018
© A4Q Copyright 2018
11
Question 24 STF-3.6 K3
Given a checkbox with an ID = "checkbox1", which line(s) of code will get the Boolean value for the
selected state of the checkbox?
A. Correct. Per section 3.6, after you locate the UI element, you can use the is_selected()
method to get the selected state of the element as a boolean value
B. Incorrect. Per section 3.6, you need to locate the UI element first, and that is not done in this
option
C. Incorrect. boolean is not an available Selenium WebDriver method in Python
D. Incorrect. find_element_by_state() is not an available Selenium WebDriver method
in Python
Question 25 STF-3.7 K3
Given a dropdown menu with an ID = "dropdown1" and a dropdown option in the dropdown with a
class name = "option3", which line(s) of code will select the dropdown option?
A. Incorrect. Per section 3.7, you need to locate the dropdown first, and that is not done in this
option
B. Correct. Per section 3.7, after you locate the dropdown, you can use the
find_element_by_class_name method to find the option, and then use the
click() method to click on the option
C. Per section 3.5 and 3.7, find_element_by_class should be
find_element_by_class_name and click should be click(). Also, the ID and
class name should be in quotes
D. Incorrect. Per section 3.7, you need to locate the dropdown first, and that is not done in this
option. Also, the class name should be in quotes
Version 2018
© A4Q Copyright 2018
12
Question 26 STF-3.8 K3
Which line(s) of code will allow you to get the text from an alert?
A. Incorrect. Per section 3.8, you need the text method applied to the alert in the second
line to get the text within the alert; 'in alert' applies to assert statements, not
find_element_by_text
B. Incorrect. Per section 3.8, you need the text method applied to the alert in the second
line to get the text within the alert; this is not done
C. Incorrect. Per section 3.8, you should switch context to the alert first, but you don't. Also,
you need the text method applied to the alert in the second line to get the text within the
alert
D. Correct. Per section 3.8, you need to switch context to the alert first, then get the alert text
via the text method
Question 27 STF-3.5 K4
For efficiency, you want to create generic functions for locating WebElements. Which of the
following is the BEST approach for such a generic function?
A. Incorrect. Per section 3.5, IDs are not appropriate for code which is used in multiple places;
also a tester may not be allowed to modify the SUT to add IDs
B. Incorrect. Per section 3.5, a tester may not be allowed to modify the SUT to add class names
C. Correct. Per section 3.5, you can use XPath in generic locators, using the different "By"
strategies (by id, by class, etc.)
D. Incorrect. There is no indication that there is link text assigned to the WebElements you
need to locate
Question 28 STF-3.1 K2
Which of the following sentences about logging and reporting in test automation is correct?
A. Incorrect. Logging shows details of test execution and reporting shows which test passed
and which failed
B. Incorrect. Logging in test execution usually shows errors of execution, but it also can show
test data and which steps have been executed. Reporting shows which test passed and
which failed.
C. Correct. See STF syllabus section 3.1 for explanation
D. Incorrect. Script sometimes contain decisions and loops, and exact execution sequence
cannot be determined from the code of test scripts only. Logging is necessary. Also log
usually contains concrete test data that have been used during test executions.
Version 2018
© A4Q Copyright 2018
13
Question 29 STF-3.2 K2
Assuming that multiple tabs are open in a Chrome browser whose webdriver object has an identifier
of “driver”, how can the entire browser and all of its tabs be closed at once?
A. Incorrect. driver.close() does not take an argument as defined in section 3.2.3 and our
exercises
B. Correct. This is the correct syntax as defined in section 3.2.3 and our exercises
C. Incorrect. This will close the active window only, not the entire browser as defined in our
exercises and section 3.2.3
D. Incorrect. driver.quit() does not take an argument as defined in our exercises and section
3.2.3
Question 30 STF-3.3 K2
After working with a specific frame in a web page, which one of the following is the BEST approach
to change the context back to the whole page?
A. Correct. Per section 3.3, the switch_to.default_content() method is the best approach
B. Incorrect. There is no JavaScript frame.back
C. Incorrect. There is no method called getpage()
D. Incorrect. Per section 3.3, windows have handles, not frames
Question 31 STF-3.4 K2
Which method of webdriver object takes screenshot of the whole screen and writes it to a file?
A. Correct. Per section 3.4, this method takes a screenshot and saves it to PNG file
B. Incorrect. This is a method of webelement not webdriver
C. Incorrect. Method get_screenshot_as_file takes one argument
D. Incorrect. Method get_screenshot_as_file(<filename>), takes a screenshot
and writes it to a file
Version 2018
© A4Q Copyright 2018
14
Question 32 STF-3.5 K2
What is the main advantage of locating web page elements by their ID.
A. Incorrect. While it is true, this is not a very important trait of this location strategy
B. Correct. See the XML standard
C. Incorrect. This is not true. The HTML and XML tags do not have to have an id attribute to
form valid HTML and XML documents
D. Incorrect. This is not true. It can be used in locating elements by id, CSS selector and XPath,
but not in e.g., partial link or tag name strategy
Question 33 STF-3.6 K2
You want to get information on a particular WebElement. You ensure that the element does exist,
and then call the method
ret_value = target_element.get_attribute('text')
Under what conditions might you get the return value None? Choose the most correct answer.
A. Incorrect. While partially correct, if the WebElement had a property of 'text' it would
return that value as discussed in section 3.6 of the syllabus
B. Incorrect. While partially correct, if the WebElement had an attribute of 'text' it would
return that value as discussed in section 3.6 of the syllabus
C. Incorrect. Visibility has no bearing on the get_attribute() method as discussed in
section 3.6
D. Correct. Only if neither property nor attribute of 'text' existed, the method would return
None as discussed in section 3.6
Question 34 STF-3.7 K2
In the web application you are testing, you need to type text in a textbox. Which of the following is
the BEST approach for typing text in a textbox using WebDriver?
A. Incorrect. Per section 3.8 and the course for 3.3, the switch_to class is used for switching
the context to windows, frames, and alerts, not for locating an element
B. Correct. Per section 3.7, you will want to first clear the element, then type the string desired
C. Incorrect. Per section 3.5, an absolute XPath is discouraged because it can break with the
smallest change to the HTML structure
D. Incorrect. There is no WebDriver text(string_to_type)method
Version 2018
© A4Q Copyright 2018
15
Question 35 STF-3.8 K2
Which two of the following methods close an alert shown by web browser?
Question 36 Keywords K1
Question 37 STF-4.1 K2
In the web application you are testing, you get the state of several checkboxes. Which of the
following is the BEST approach for making your test scripts maintainable?
A. Incorrect. Per section 3.5, IDs must be unique in the DOM, and since the checkbox could be
in reused code, more information is required to know if this is sound; also, it not possible to
assign an ID to a state
B. Incorrect. In HTML, tags are reserved words that identify elements and they cannot be
interpreted if a programmer creates one
C. Correct. Per section 4.1, code that is used repeatedly should be put in functions
D. Incorrect. Per section 4.4, keywords are business actions or steps in a test case, and they
would not apply in this case
Version 2018
© A4Q Copyright 2018
16
Question 38 STF-4.2 K3
In the web application you are testing, a modal dialog should be dismissed when you click on the
cancel button. Given the following code:
Which of the following wait convenience methods is the MOST appropriate to replace
[convenience method] above to know that the dialog has been dismissed?
A. Incorrect. title_is does not tell you if an element is visible or invisible, and we want to
know that it is invisible
B. Incorrect. It should be inferred that if an is clickable, it is visible
C. Correct. It should be inferred that when a dialog element is invisible, the dialog has been
dismissed
D. Incorrect. Being present means that an element may be visible or invisible, but we want to
know that it is invisible
Version 2018
© A4Q Copyright 2018
17
Question 39 STF-4.3 K4
<form>
User: <input type="edit" id="user" name="user" />
<br/>
Password: <input type="edit" id="password" name="password" />
<br/>
<button type="submit" name="login">Log in</button>
<button type="submit" name="cancel" >Cancel</button>
</form>
Which of the following functions is the best implementation of a method of a Page Object class for
this form:
A. Incorrect. This implementation does something else than its name says. Apart from clicking
Cancel button it also writes “admin” in the user edit box.
B. Incorrect. This function clicks Cancel button, but its name says login
C. Incorrect. This form has no link remind
D. Correct. This function clicks the Cancel button. This is one of the business operations, that
can be done using this form.
Question 40 STF-4.4 K4
Make a wire transfer from the customer account to the provider account as a payment for
purchased goods.
Which of the following sets of data will be the best parameter set for a keyword implementing this
test step?
A. Incorrect. Customer name and provider name are not sufficient to make a wire transfer.
Their account numbers are needed.
B. Incorrect. Payment date is not sufficient to make a wire transfer, it actually is not
mandatory. Amount to be payed and currency is needed for every wire transfer.
C. Correct. There are three data items mentioned in this test step: customer data, provider
data and payment data. The latter is decomposed in this answer into amount and currency.
D. Incorrect. There is no provider data in this set
Version 2018
© A4Q Copyright 2018