Does playwright enter text differently than setValue or sendKeys would in selenium-based automation frameworks? The UI I am automating has a drop down list + text input control that let's one type an exact value or click expand and select the value from the list. The former is preferred for reliability and works in selenium, but calling .fill on the same locator in playwright causes the text to appear, but it doesn't register like it isn't triggering the same event so I am forced to select the value from the expanded drop down.
Is there a gotcha with .fill that people coming from selenium are aware of?
This thread is trying to answer question "Does Playwright's .fill method enter text differently than Selenium's setValue or sendKeys, and are there any known issues with .fill not triggering the same events?"
Generally fill()
should work; it focuses the element, clears any existing text, and types the text. Sometimes it doesn't work if there's special keyboard handling on the element though, in which case you should be able to use pressSequentially()
https://playwright.dev/docs/api/class-locator#locator-press-sequentially
Rayrun is a community for QA engineers. I am constantly looking for new ways to add value to people learning Playwright and other browser automation frameworks. If you have feedback, email [email protected].