type
The command to type keys into a field, input or text box.
Syntax
Element.type(*args) -> ElementUsage
py.get("#username").type("my-username")
---or--- # combine with other keys and strings
# import the Keys from selenium
py.get("#search").type("puppies", Keys.ENTER)
---or--- # chain an Element command
py.get("#email").type("[email protected]").get_attribute("value")# Errors, 'type' may have no effect on other types of elements
py.get("a").type("foo")Arguments
*args (Any)- A comma-separated list of arguments to type
It's best to use strings and the Keys from Selenium
Yields
Element - The current Element so you can chain commands
Examples
Given this HTML:
We could type credentials into the fields and submit the form to login:
Last updated