0

Selenium with ruby how to identify an object by its type? e.g

<input type="text" name="FirstName" value=""> 

What is the ruby code to identify this kind of element?

1 Answer 1

0

You can identify an element by it's type using CSS and passing in the type as the locator. In this case I'm using find_element to do identify it:

@driver.find_element(css: '[type="text"]')

You could also do this for the name attribute:

@driver.find_element(css: '[name="FirstName"]')

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.