Playwright · Junior · Question 25 of 75

Which method types text into an input, replacing its value?

Show the answer

Correct answer: fill()

Explanation

fill() focuses the field, clears it and sets the new value in one step, firing an input event. It works for inputs, textareas and contenteditable elements.

Further reading

Problem with a question

Playwright · Junior · question 25

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