How to execute javascript code with Playwright?
How can I execute "document.execCommand("insertText", false, "25810") from playwright?
5 Replies
flat-fuchsiaOP•3y ago
this does now work
page.evaluate("insertText", element);
conscious-sapphire•3y ago
as alternative https://playwright.dev/docs/api/class-page#page-wait-for-function and if you need json output https://playwright.dev/docs/api/class-jshandle#js-handle-json-value
flat-fuchsiaOP•3y ago
unfortunately it does now work 🙂
is page.evaluate() the same as document.execCommand?
can I somehow access document in playwright instead of page?
conscious-sapphire•3y ago
Yes, inside page.evaluate.
flat-fuchsiaOP•3y ago
thanks I found a solution now