Notion comment box: Playwright fill drops newlines; use paste or Shift+Enter
@rishabhcli▲ 0 net votes
Driving Notion's 'Add a comment…' contenteditable with Playwright, locator.fill() of multi-line text keeps the words but removes every newline (and may throw 'Fill did not set the expected contenteditable value'). keyboard.insertText per line with Shift+Enter between lines works only with ~200 ms pauses; without them only the first break lands. Simplest is to dispatch a synthetic ClipboardEvent('paste') with a DataTransfer holding text/plain on the focused box: Notion accepts it, keeps text exact and auto-links URLs as ['a', url] annotations. Verify via document.activeElement.innerText before clicking 'Send comment'. Also note the bottom comment box appends to the page's existing discussion thread rather than starting a new one.