Skip to content

Commit 4c37e74

Browse files
committed
added additional locator example
1 parent 8c4eecc commit 4c37e74

3 files changed

Lines changed: 6 additions & 3 deletions

File tree

java/testingapps/seleniumtestpages/src/main/resources/pagehtml/locatorapproaches/about.html

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@ <h3 id="exercises-for-automating">Exercises for Automating</h3>
2323
<li><code>by xpath li</code> - find the <code>li</code> with a child span which has an id <code>child-of-li</code> using an XPath selector</li>
2424
<li><code>image</code> button - find the image with the alt tag <code>an image of a button</code></li>
2525
<li><code>testid li</code> - find the <code>li</code> with a test id attribute <code>data-testid</code></li>
26-
<li><code>labeled input value</code> - find the input field with the label <code>labeled</code></li>
26+
<li><code>labeled wrapped input value</code> - find the input field with the label <code>label wrapped</code> (the input field is a child of the label)</li>
27+
<li><code>label for labeled input</code> - the label element <code>label for</code> is &#39;for&#39; the input element (the input is a peer of the label, the <code>for</code> matches the <code>id</code>) </li>
2728
<li><code>find by placeholder</code> - find the input field with the placeholder <code>inputplaceholder</code></li>
2829
<li><code>titled li</code> - find the <code>li</code> with title <code>li with title</code></li>
2930
<li><code>presentation role li</code> - find the <code>li</code> with the Aria role <code>presentation</code></li>

java/testingapps/seleniumtestpages/src/main/resources/pagehtml/locatorapproaches/about.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,8 @@ Locate each of the items below and automate an assertion against the element.
3030
- `by xpath li` - find the `li` with a child span which has an id `child-of-li` using an XPath selector
3131
- `image` button - find the image with the alt tag `an image of a button`
3232
- `testid li` - find the `li` with a test id attribute `data-testid`
33-
- `labeled input value` - find the input field with the label `labeled`
33+
- `labeled wrapped input value` - find the input field with the label `label wrapped` (the input field is a child of the label)
34+
- `label for labeled input` - the label element `label for` is 'for' the input element (the input is a peer of the label, the `for` matches the `id`)
3435
- `find by placeholder` - find the input field with the placeholder `inputplaceholder`
3536
- `titled li` - find the `li` with title `li with title`
3637
- `presentation role li` - find the `li` with the Aria role `presentation`

java/testingapps/seleniumtestpages/src/main/resources/web/styled/locator-approaches.html

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,8 @@ <h1 id="approaches">Locator Approaches</h1>
5151
<li><span id="child-of-li">by xpath</span> li</li>
5252
<li>by alt <img id="image-button" alt="an image of a button" src="/images/buttons/button_image.png" onclick="clickImageButton()"/></li>
5353
<li data-testid="testid">testid li</li>
54-
<li><label>labeled <input type="text" size="15" name="input-value" value="input value"/></label></li>
54+
<li><label>label wrapped <input type="text" size="15" name="input-value" value="input value"/></label></li>
55+
<li><label for="labeled-input">label for</label> <input id="labeled-input" type="text" size="15" name="labeled-input" value="labeled input"/></label></li>
5556
<li><input type="text" placeholder="inputplaceholder" name="by-placeholder" value="find by placeholder" size="20" onclick="clickPlaceholderInput()" /></li>
5657
<li title="li with title">titled li</li>
5758
<li role="presentation">presentation role li</li>

0 commit comments

Comments
 (0)