Skip to content

How do I type ESC, ENTER and other keys? #1346

Answered by mdmintz
HellShuro asked this question in Q&A
Discussion options

You must be logged in to vote

For using special keys, you can use:

from selenium.webdriver.common.keys import Keys
...
    ...
    self.send_keys(SELECTOR, Keys.ESCAPE)

But for hitting ENTER/RETURN, you can use \n. Example:

self.type("input#password", "secret_sauce\n")

Replies: 3 comments 5 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by mdmintz
Comment options

You must be logged in to vote
5 replies
@mdmintz
Comment options

@mdmintz
Comment options

@akunteseterwork
Comment options

@wackydude
Comment options

@mdmintz
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
4 participants