I'm using playwright to write my tests. And I have a problem: I need to test the following behaviour:
To do it I need to go to the end of my input field and use the type
command. How can I go to the end of my input. Here some pseudo-code:
// Before I already applied the bold. It is not relevant for the question.
const input = page.locator(`[data-testid='INPUT_FIELD']`)
await input.focus(); // Focus the input field
/* TODO: Go to the end of the input field [What should I do?] */
await input.type(' remaining part of the message');
You can always go to the end of the text in your input by using the keyboard.press()
.
const input = page.locator(`[data-testid='INPUT_FIELD']`)
await input.focus(); // Focus the input field
await input.keyboard.press('End')
await input.type(' remaining part of the message');