Playwright · Junior · Question 27 of 75

How do you press Enter in a focused search field?

Show the answer

Correct answer: await locator.press('Enter')

Explanation

press() sends a key or combination like Control+A. page.keyboard gives lower-level control when needed.

Further reading

Problem with a question

Playwright · Junior · question 27

Test yourself

Take the Playwright · Junior quiz: questions and options are shuffled, and you get a review of your mistakes at the end.

Take this quiz