Last active
July 9, 2018 23:36
-
-
Save acdvorak/25bca2b1ce9987938aa1750487e46e67 to your computer and use it in GitHub Desktop.
Firefox Windows Selenium Bug - CrossBrowserTesting.com
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 Base64 = require('base64-js'); | |
const fs = require('fs'); | |
const {Builder, Capabilities} = require('selenium-webdriver'); // version 4.0.0-alpha.1 | |
const CBT_USERNAME = process.env.CBT_USERNAME; | |
const CBT_AUTHKEY = process.env.CBT_AUTHKEY; | |
const SELENIUM_SERVER_URL = `http://${CBT_USERNAME}:${CBT_AUTHKEY}@hub.crossbrowsertesting.com:80/wd/hub`; | |
async function runAsync() { | |
const builder = new Builder() | |
.usingServer(SELENIUM_SERVER_URL) | |
.withCapabilities(new Capabilities({ | |
'browserName': 'Firefox', | |
'version': '60x64', | |
'platform': 'Windows 10', | |
'record_video': true, | |
'record_network': true, | |
})) | |
; | |
console.log('Step 1 of 6 - Starting browser...'); | |
const driver = await builder.build(); | |
console.log('Step 2 of 6 - Done starting browser!'); | |
try { | |
console.log('Step 3 of 6 - Navigating to URL...'); | |
await driver.get('https://www.google.com/search?q=flowers'); | |
console.log('Step 4 of 6 - Done navigating to URL!'); | |
console.log('Step 5 of 6 - Taking screenshot...'); | |
const base64Str = await driver.takeScreenshot(); | |
const pngBuffer = Buffer.from(Base64.toByteArray(base64Str)); | |
fs.writeFileSync('/tmp/screenshot.png', pngBuffer, {encoding: null}); | |
console.log('Step 6 of 6 - Done taking screenshot!'); | |
console.log('/tmp/screenshot.png'); | |
} finally { | |
await driver.quit(); | |
} | |
} | |
runAsync(); |
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
Step 1 of 6 - Starting browser... | |
---> HANGS INDEFINITELY <--- |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment