webapp-testing element_discovery.py reports <textarea> and <select> as type "text"
What happened
skills/webapp-testing/examples/element_discovery.py is the reference example SKILL.md points agents at for "Discovering buttons, links, and inputs on a page" (skills/webapp-testing/SKILL.md:94). Its input-discovery loop reports the control kind incorrectly for every element that is not an <input>:
Found 5 input fields:
- city (text)
- notype (text)
- csrf (hidden)
- bio (text)
- tier (text)The page really contains city = <input type=text>, notype = <input> with no type, csrf = <input type=hidden>, bio = <textarea>, tier = <select>. So two of the five reported types are wrong, and the two that are wrong are exactly the two non-<input> controls the selector deliberately includes.
Cause
skills/webapp-testing/examples/element_discovery.py:33:
input_type = input_elem.get_attribute('type') or 'text''text' is the HTML default type of an <input> element — it is not a sensible fallback for <textarea> and <select>, which have no type attribute and no text semantics. The selector on line 29 ('input, textarea, select') deliberately asks for all three kinds, and then the fallback collapses two of them onto the third.
Why it matters (measured, not theoretical)
This output is the agent's map of the form. Trusting tier (text), the natural next call is page.fill(), which Playwright rejects for a <select>:
consumer treating select as text -> {'fill_error': 'Page.fill: Error: Element is not an <input>, <textarea> or [contenteditable] element',
'select_option': 'OK value=b'}page.select_option('#s1', 'b') succeeds on the very same element, so the only thing standing between the agent and a working call is the correct kind in the discovery report. (<textarea> happens to be fill-able, so it is mis-reported but harmless — the <select> case is the one that turns into a failed action.)
Reproduction
Environment: Windows 10.0.26200, Python 3.14.6, playwright 1.63.0, Chromium build 1243 (headless).
Test page served over http://127.0.0.1:<port>/index.html:
<input id="i1" type="text" name="city">
<input id="i2" name="notype">
<input id="i3" type="hidden" name="csrf" value="1">
<textarea id="t1" name="bio"></textarea>
<select id="s1" name="tier"><option value="a">A</option><option value="b">B</option></select>Run the example verbatim, substituting only the placeholder URL (that value is the documented "replace with your URL" stand-in):
python element_discovery.pyObserved: bio (text) and tier (text). Cross-checked against the live DOM in the same page context:
[{"name":"city","tag":"input","type":"text"},
{"name":"notype","tag":"input","type":null},
{"name":"csrf","tag":"input","type":"hidden"},
{"name":"bio","tag":"textarea","type":null},
{"name":"tier","tag":"select","type":null}]Expected behaviour
Report the element's own kind when it has no type attribute, while keeping the correct <input> default:
- city (text)
- notype (text)
- csrf (hidden)
- bio (textarea)
- tier (select)i.e. 'text' should be the fallback for <input> only:
tag = input_elem.evaluate("el => el.tagName.toLowerCase()")
input_type = input_elem.get_attribute('type') or ('text' if tag == 'input' else tag)Verified after that change: the three <input> rows are byte-identical to before (text, text, hidden — the no-type case still correctly reports the HTML default), and bio/tier become textarea/select.
For what it is worth, this is the only occurrence of the pattern in the repo: grep -rn "or 'text'" --include="*.py" . returns just this line.
Source: anthropics/skills