Skip to content

Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.

test(selectors): should auto-detect css selector with attributes (#477)

Dmitry Gozman929b7d979baf
diff --git a/test/queryselector.spec.js b/test/queryselector.spec.js
index 7e4b70983c..85b37d1cfb 100644
--- a/test/queryselector.spec.js
+++ b/test/queryselector.spec.js
@@ -61,6 +61,11 @@ module.exports.describe = function({testRunner, expect, product, FFOX, CHROMIUM,
const idAttribute = await page.$eval('section', e => e.id);
expect(idAttribute).toBe('testAttribute');
});
+ it('should auto-detect css selector with attributes', async({page, server}) => {
+ await page.setContent('<section id="testAttribute">43543</section>');
+ const idAttribute = await page.$eval('section[id="testAttribute"]', e => e.id);
+ expect(idAttribute).toBe('testAttribute');
+ });
it('should accept arguments', async({page, server}) => {
await page.setContent('<section>hello</section>');
const text = await page.$eval('section', (e, suffix) => e.textContent + suffix, ' world!');