Created
December 19, 2022 16:54
-
-
Save zac11/e9cabd74a5fe06e4d487942ce18838d7 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,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" | |
}); | |
await page.waitForTimeout(5000); | |
// set disabled attribute | |
await page.evaluate(()=>{ | |
const selector = document.querySelector("input[placeholder$='Enter your company']"); | |
selector.setAttribute('disabled','disabled'); | |
}); | |
await page.waitForTimeout(5000); | |
// now remove the attribute and make the input enabled | |
await page.evaluate(()=>{ | |
const selector = document.querySelector("input[placeholder$='Enter your company']"); | |
selector.removeAttribute('disabled') | |
}); | |
await page.waitForTimeout(5000); | |
}); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment