-
-
Save lusarz/b00d54c89c899bd4549c0ed6b74d3482 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
const puppeteer = require('puppeteer'); | |
const HTML = ` | |
<!doctype html> | |
<html> | |
<body> | |
<div> | |
<div class="form form-group" data-test-automation-id="selector"> | |
<label class="control-label" for="Selector" data-test-automation-id="label">Current service provider</label> | |
<span class="select"> | |
<select name="select" class="form-control" id="selector" data-test-automation-id="select"> | |
<option value="">Please select</option> | |
<option value="100" data-test-automation-id="choose100">Test1</option> | |
<option value="101" data-test-automation-id="choose101">Test2</option> | |
<option value="102" data-test-automation-id="choose102">Test3</option> | |
</select> | |
</span> | |
</div> | |
</div> | |
</body> | |
</html> | |
`; | |
(async () => { | |
const browser = await puppeteer.launch(); | |
const page = await browser.newPage(); | |
page.setViewport({ width: 200, height: 60 }); | |
await page.setContent(HTML); | |
await page.select('#selector', '101'); | |
await page.screenshot({path: 'select.png'}); | |
await browser.close(); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment