Last active
April 26, 2017 03:11
-
-
Save skratchdot/35e3778da042b68912ee609005854757 to your computer and use it in GitHub Desktop.
Chrome Canary Headless Audio
This file contains hidden or 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 webdriver from 'selenium-webdriver'; | |
| const getDriver = async () => | |
| new webdriver.Builder() | |
| .forBrowser('chrome') | |
| .withCapabilities({ | |
| browserName: 'chrome', | |
| chromeOptions: { | |
| args: ['headless'], | |
| binary: '/Applications/Google Chrome Canary.app/Contents/MacOS/Google Chrome Canary' | |
| } | |
| }) | |
| .build(); | |
| const delay = async time => new Promise(resolve => setTimeout(resolve, time)); | |
| const visitSite = async (url, time) => { | |
| const driver = await getDriver(); | |
| await driver.get(url); | |
| await delay(time); | |
| await driver.quit(); | |
| }; | |
| visitSite('http://jsbin.com/fobavidipa/edit?html,js,output', 2000); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment