Created
January 23, 2023 06:02
-
-
Save zac11/97046c9bc5a66e754408d9204dc6c90e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { chromium, expect, test } from "@playwright/test"; | |
test.use({ viewport: { width: 1400, height: 1000 } }); | |
test("Launch the Selectors hub test page", async () => { | |
const browser = await chromium.launch({ | |
headless: false, | |
}); | |
const context = await browser.newContext(); | |
const page = await context.newPage(); | |
await page.goto("https://selectorshub.com/xpath-practice-page/"); | |
await page.waitForSelector(".dropbtn", { | |
state: "visible", | |
}); | |
// we want to mask this locator | |
const btn = await page.locator(".dropbtn"); | |
//await expect(btn).toHaveCSS('background-color','#4CAF50'); // it will fail | |
//await expect(btn).toHaveCSS('background-color','rgb(76,175,80)'); // it will also fail due to spaces | |
await expect(btn).toHaveCSS('background-color','rgb(76, 175, 80)'); | |
await page.waitForTimeout(2000); | |
await page.close(); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment