DEV Community

Devknl
Devknl

Posted on

[puppeteer] How to set Value for a Input Element

input1
input2
Hi there,
I would like to test my app with Puppeteer.
I used REACT and TypeScript.
how can I set the input correctly? Please see the attachment.

I try the following, but without success:

1.try:

await page.waitForSelector('#MuiButtonBase-root');
// await page.select('#MuiTouchRipple-root');
await page.waitForSelector('#name');
await page.type('#name', 'Hello');
Enter fullscreen mode Exit fullscreen mode

2.try:

await page.$eval('#MuiDialogContent-root input:MuiFormControl-root:nth-child(1)', el => el.value = 'Hello');  
Enter fullscreen mode Exit fullscreen mode

Top comments (0)