skip to Main Content

While testing website where input type is equal to color is not working while testing with playwright. I have tried by using all the methods or code in the playwright but got failed. I have using locator with Path and also index i have error in chromium, Firefox and also in web kit,You can use the below code:-

await page.locator(‘//input[@id="color"]’).click();
// @ts-ignore
await page.locator(‘input[id="color"]’).evaluate(function(element){element.value =’#fca8ac’});
await page.locator(‘//input[@id="color"]’).press(‘Enter’)

2

Answers


  1. Chosen as BEST ANSWER

    I got answer where you use the below code:

    ' await page.locator('//input[@id="color"]').click(); // @ts-ignore await page.locator('input[id="color"]').evaluate(function(element){element.value ='#fca8ac'}); await page.locator('//input[@id="color"]').press('Enter') '


  2. //@ts-ignore
    await page.locator(‘input[id="color"]’).evaluate(function(element){element.value =’#fca8ac’});

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search