Skip to content

Instantly share code, notes, and snippets.

@skratchdot
Last active April 26, 2017 03:11
Show Gist options
  • Select an option

  • Save skratchdot/35e3778da042b68912ee609005854757 to your computer and use it in GitHub Desktop.

Select an option

Save skratchdot/35e3778da042b68912ee609005854757 to your computer and use it in GitHub Desktop.
Chrome Canary Headless Audio
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