英文:
How to mask more than 1 locator in playwright visual comparison
问题
我想在使用Playwright进行视觉比较时屏蔽多个定位器,该如何操作?目前我只能屏蔽一个定位器。
我尝试了多个屏蔽命令,但没有起作用。
我想在使用Playwright进行视觉比较时屏蔽多个定位器,该如何操作?目前我只能屏蔽一个定位器。
我尝试了多个屏蔽命令,但没有起作用。
英文:
I would like to mask more than 1 locator in visual comparison using playwright ? How to do that ? Currently I can mask only 1 locator.
I tried more than 1 mask command, its not working
I would like to mask more than 1 locator in visual comparison using playwright ? How to do that ? Currently I can mask only 1 locator.
I tried more than 1 mask command, its not working
答案1
得分: 0
你可以将定位器数组传递给mask:
const maskedElement1 = await page.locator('element1');
const maskedElement2 = await page.locator('element2');
await expect(page).toHaveScreenshot({mask: [maskedElement1, maskedElement2]});
英文:
You can pass an array of locators to mask:
const maskedElement1 = await page.locator('element1);
const maskedElement2 = await page.locator('element2);
await expect(page).toHaveScreenshot({mask: [maskedElement1,maskedElement2]});
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论