optimistic-gold•3y ago
How to execute javascript code with Playwright?
How can I execute "document.execCommand("insertText", false, "25810") from playwright?
5 Replies
optimistic-goldOP•3y ago
this does now work
page.evaluate("insertText", element);
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
optimistic-goldOP•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?
Yes, inside page.evaluate.
optimistic-goldOP•3y ago
thanks I found a solution now