<form>
<input type='text' name='user'/>
</form>
Tying to get the input element via aria role 'textbox'. I've tried many different ways and everything comes back as 'not found'
cy.get('role=input')
cy.get('[role=input]')
cy.get('role="input")
cy.get('[role="input"])
cy.get('role=textbox')
cy.get('[role=textbox]')
cy.get('role="textbox")
cy.get('[role="textbox"])
cy.get('form[role="textbox"]')
cy.get('form[role=textbox]')
I've tried other things as well like capitalizing role. it's my understanding from the documentation that
cy.get('[role="textbox"]')
should work but returns not found.
You can see from dev-tools that it does have the role
If a role is explicitly set, then you can assert like that: cy.get([role="${role}"]
, ...rest)
If the role is implied by tag name, you can assert to the tag name as suggested by Rosen.
If you want to assert a specific input, you can use e.g. the name like: cy.get('input[name="user"]')
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With