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
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') '
//@ts-ignore
await page.locator(‘input[id="color"]’).evaluate(function(element){element.value =’#fca8ac’});