CSS Attribute Selectors
CSS attribute selectors match elements based on their attributes:
[attr] - has attribute
[attr='value'] - exact match
[attr^='value'] - starts with
[attr$='value'] - ends with
[attr*='value'] - contains
Relevant HTML structure:
<input type="text" id="lastNameWithPlaceholder"
class="last-name-input"
placeholder="Enter your last name..." name="lastName">
<input type="text" id="preFilledTextField"
name="preFilledTextField" value="Codekru">
Task:
- Navigate to
https://testkru.com/Elements/TextFields
- Find the input with
placeholder='Enter your last name...' using CSS attribute selector
- Print its ID
- Find the input whose name starts with
pre using [name^='pre']
- Print its value
Expected output:
Found by placeholder: lastNameWithPlaceholder
Found by name prefix: Codekru