简体   繁体   中英

How to type emojis in node.js puppeteer?

How would I accomplish this? I'm looking to do something like

const xpath = page.$x(‘thexpath’)

xpath[0].type(fireemoji)

and have the fire emoji show up on the page. Is there an npm module for this?

You should be able to just copy and paste the emoji directly in there like so

xpath[0].type(🔥);

if you look here puppeteer did have some emoji issues but it seems as if it was fixed in this release

so also make sure you have the most recent version of puppeteer installed

this code is taken directly from a puppeteer unit test

await page.type('textarea', '👹 Tokyo street Japan 🇯🇵');

so make sure you are implementing .type() correctly

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM