Chrome Automation Extension Error using Selenium with Protractor/Jasmine - selenium

EDITS: New direction for troubleshooting. Original Issue will remain below dashed lines.
After further investigation I realized it was my screenshot reported causing the crash. I'm using protractor-jasmine2-screenshot-reporter to generate reports and screenshots on failing test cases. Thus, when a spec would fail, it would take a screenshot, and crash using Chrome.
I've found a debug log with the following:
[1026/090128:ERROR:process_reader_win.cc(114)] NtOpenThread: {Access Denied} A process has requested access to an object, but has not been granted those access rights. (0xc0000022)
[1026/090128:ERROR:exception_snapshot_win.cc(87)] thread ID 46316 not found in process
[1026/090128:WARNING:crash_report_exception_handler.cc(56)] ProcessSnapshotWin::Initialize failed
[1026/093428:ERROR:process_reader_win.cc(114)] NtOpenThread: {Access Denied} A process has requested access to an object, but has not been granted those access rights. (0xc0000022)
Here is the code from index.js from the reporting tool
this.specDone = function (spec) {
spec.filename = {};
spec = getSpecClone(spec);
spec._finished = Date.now();
if (!isSpecValid(spec)) {
spec.skipPrinting = true;
return;
}
_.each(browser.forkedInstances, function (browserInstance, key) {
if (!browserInstance) return;
browserInstance.takeScreenshot().then(function (png) {
browserInstance.getCapabilities().then(function (capabilities) {
var screenshotPath,
metadataPath,
metadata;
var file = opts.pathBuilder(spec, suites, capabilities);
spec.filename[key] = file + '.png';
screenshotPath = path.join(opts.dest, spec.filename[key]);
metadata = opts.metadataBuilder(spec, suites, capabilities);
if (metadata) {
metadataPath = path.join(opts.dest, file + '.json');
mkdirp(path.dirname(metadataPath), function (err) {
if (err) {
throw new Error('Could not create directory for ' + metadataPath);
}
writeMetadata(metadata, metadataPath);
});
}
mkdirp(path.dirname(screenshotPath), function (err) {
if (err) {
throw new Error('Could not create directory for ' + screenshotPath);
}
writeScreenshot(png, spec.filename[key]);
});
});
});
});
};
The issue is coming from the line browserInstance.takeScreenshot()
So the new question is: How do I grant access to Chrome to allow screenshots?
I've tried "--disable-extensions" and "--disable-web-securities" all with no luck.
ORIGINAL:
For some time now I haven't been able to run my E2E Protractor/Jasmine tests in Chrome due to a "WebDriverError: unknown error: cannot get automation extension" issue.
Previously, when running a test in Chrome, it would attempt to load the page and then just crash with the above error. As of recently, I've done some updating to my tools and can at least get my tests running in Chrome again. However, this time I get the same automation extension error whenever a spec fails and it does not log or report the spec, nor does it continue to the remaining specs in the file.
Tests that pass successfully work fine. Tests that have failures within them time out and do not log. Anyone have any insight on if this is still a browser thing or if I'm doing some wrong?
Protractor Version: 4.0.9
NPM Version: 3.10.9
Node Version: 4.4.3
Chrome Version: 54.0.2840.71
ChromeDriver Version: 2.24
Selenium Standalone: 2.53.1
I'm launching the web server directly as follows:
java -jar C:/.../node_modules/protractor/node_modules/webdriver-manager/selenium/selenium-server-standalone-2.53.1.jar \
-Dwebdriver.chrome.driver=C:/.../node_modules/protractor/node_modules/webdriver-manager/selenium/chromedriver.exe \
Bits of my config file:
multiCapabilities: [
{
'shardTestFiles': 'true',
'browserName': 'chrome',
'ignoreZoomSetting': 'true',
'platform': "ANY",
'marionette': 'true',
'chromeOptions': {
'args': ['start-maximized']
},
},
],
seleniumAddress: 'http://localhost:4444/wd/hub',
directConnect: true,
Error:
[74.302][SEVERE]: Timed out receiving message from renderer: -11.004
13:48:15.377 WARN - Exception thrown
org.openqa.selenium.WebDriverException: unknown error: cannot get automation extension
from timeout: cannot determine loading status
from timeout: Timed out receiving message from renderer: -11.004
(Session info: chrome=54.0.2840.71)
(Driver info: chromedriver=2.24.417431 (9aea000394714d2fbb20850021f6204f2256b9cf),platform=Windows NT 10.0.14393 x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 21.02 seconds
Build info: version: '2.53.1', revision: 'a36b8b1', time: '2016-06-30 17:37:03'
System info: host: 'SIWKSTN18', ip: '10.0.0.165', os.name: 'Windows 8.1', os.arch: 'amd64', os.version: '6.3', java.version: '1.7.0_67'
Session ID: a4a6e50c6de395381639c6fa4885a9ab
Driver info: org.openqa.selenium.chrome.ChromeDriver
Capabilities [{platform=WIN8_1, acceptSslCerts=true, javascriptEnabled=true, browserName=chrome, chrome={userDataDir=C:\Users\DRODRI~1\AppData\Local\Temp\scoped_dir200_9106, chromedriverVersion=2.24.417431 (9aea000394714d2fbb20850021f6204f2256b9cf)}, networkConnectionEnabled=false, rotatable=false, locationContextEnabled=true, mobileEmulationEnabled=false, version=54.0.2840.71, pageLoadStrategy=normal, takesHeapSnapshot=true, cssSelectorsEnabled=true, databaseEnabled=false, handlesAlerts=true, browserConnectionEnabled=false, webStorageEnabled=true, nativeEvents=true, hasTouchScreen=false, applicationCacheEnabled=false, takesScreenshot=true}]
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:206)
at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:158)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:678)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:701)
at org.openqa.selenium.remote.RemoteWebDriver.getScreenshotAs(RemoteWebDriver.java:335)
at org.openqa.selenium.remote.server.handler.CaptureScreenshot.call(CaptureScreenshot.java:36)
at org.openqa.selenium.remote.server.handler.CaptureScreenshot.call(CaptureScreenshot.java:1)
at java.util.concurrent.FutureTask.run(Unknown Source)
at org.openqa.selenium.remote.server.DefaultSession$1.run(DefaultSession.java:176)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
13:48:15.378 WARN - Exception: unknown error: cannot get automation extension
from timeout: cannot determine loading status
from timeout: Timed out receiving message from renderer: -11.004

When Protractor reads in your configuration, it'll see that you have set directConnect to true. It'll try to launch Chrome with direct connect (see runner.ts). The file that Protractor will assume is the file path that is downloaded by webdriver-manager. So it'll probably be looking for chromedriver_2.24.exe.
I'm confused by your configuration and launch statements. Your launch has a chromedriver.exe. The file name should also have the version number appended to it. So I'm not sure how direct connect is actually working and how you are getting those log statements.
Also, it appears you want to use the selenium standalone feature based on your java launch command. What you'll need to do is remove the directConnect property from your configuration.

Related

Running headless Firefox with Selenium on OpenShift - Connection refused

So I have setup some Selenium tests to run on OpenShift on headless Chrome + Firefox. They run fine on my Windows machine on a browser with GUI, and Chrome headless also works fine.
For Firefox I get the error message "connection refused" and geckodriver doesnt seem to be able to connect to Firefox.
I found a dozen of posts about this matter, but no solution so far.
Anyone got any advice on this?
thanks a lot!
Desired Capabilities
public static DesiredCapabilities getFirefoxCapabilities () {
DesiredCapabilities caps = DesiredCapabilities.firefox();
caps.setPlatform(org.openqa.selenium.Platform.ANY);
FirefoxOptions options = new FirefoxOptions();
options.setBinary("/usr/lib64/firefox/firefox-bin");
options.setHeadless(true);
options.addArguments("--disable-gpu");
options.addArguments("--allow-insecure-localhost");
options.addArguments("--remote-debugging-port=9222");
options.setAcceptInsecureCerts(true);
FirefoxProfile profile = new FirefoxProfile();
profile.setPreference("sanity-test.running", true);
options.setProfile(profile);
caps.merge(options);
return caps;
}
Setup of Webdriver implementation
System.setProperty("webdriver.gecko.driver", openshift_browserDriverPath_Firefox);
try {
driver.set(new FirefoxDriver(headlessDriverCapabilityFactory.getCapabilities(getBrowserName())));
}
catch(Exception e) {
System.out.println("setup headless ff: " + e.getMessage() + "failed at " + e.getStackTrace());
}
Excerpt from Jenkins Log
1565697695283 mozrunner::runner INFO Running command:
"/usr/lib64/firefox/firefox-bin" "-marionette" "-headless" "--disable-
gpu" "--allow-insecure-localhost" "--remote-debugging-port=9222" "-
foreground" "-no-remote" "-profile" "/tmp/rust_mozprofile.LMzPtqcIh6wS"
*** You are running in headless mode.
1565697700885 addons.xpi WARN Can't get modified time of
/usr/lib64/firefox/browser/features/aushelper#mozilla.org.xpi
1565697701079 addons.xpi-utils WARN addMetadata: Add-on
aushelper#mozilla.org is invalid: [Exception... "Component returned
failure code: 0x80520006 (NS_ERROR_FILE_TARGET_DOES_NOT_EXIST)
[nsIFile.isFile]" nsresult: "0x80520006
(NS_ERROR_FILE_TARGET_DOES_NOT_EXIST)" location: "JS frame ::
resource://gre/modules/addons/XPIInstall.jsm :: loadManifestFromFile ::
line 925" data: no] Stack trace:
loadManifestFromFile()#resource://gre/modules/addons/XPIInstall.jsm:925 syncLoadManifestFromFile()#resource://gre/modules/addons/XPIProvider.jsm:940
addMetadata()#resource://gre/modules/addons/XPIProvider.jsm ->
resource://gre/modules/addons/XPIProviderUtils.js:1173
processFileChanges()#resource://gre/modules/addons/XPIProvider.jsm ->
resource://gre/modules/addons/XPIProviderUtils.js:1529
checkForChanges()#resource://gre/modules/addons/XPIProvider.jsm:3304
startup()#resource://gre/modules/addons/XPIProvider.jsm:2196
callProvider()#resource://gre/modules/AddonManager.jsm:253
_startProvider()#resource://gre/modules/AddonManager.jsm:728
startup()#resource://gre/modules/AddonManager.jsm:892
startup()#resource://gre/modules/AddonManager.jsm:298 observe()#jar:file:///usr/lib64/firefox/omni.ja!/components/addonManager.js
:63
1565697701094 addons.xpi-utils WARN Could not uninstall invalid
item from locked install location
Aug 13, 2019 12:01:44 PM org.openqa.selenium.remote.ProtocolHandshake
createSession
INFO: Detected dialect: W3C
#Test - internal test: Chrome browser headless
Aug 13, 2019 12:01:46 PM cucumber.runtime.java.ObjectFactoryLoader
loadSingleObjectFactory
WARNING: Use deprecated reflections to load ObjectFactory.
setup headless ff: connection refused
Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-
14T08:17:03'
System info: host: 'ifx-java-slave-browsers.latest-6llvz', ip:
'10.125.24.3', os.name: 'Linux', os.arch: 'amd64', os.version: '3.10.0-
862.el7.x86_64', java.version: '1.8.0_222'
Driver info: driver.version: FirefoxDriver
#Daniel Davison's article on OpenShift Templates for Selenium can provide you with all the steps required to leverage openshift with Selenium within Docker containers in creating a scale-able framework for Selenium.
Here are the required links:
Configuration for Selenium Hub
Configuration for Selenium Node - Chrome
Configuration for Selenium Node - Firefox

org.openqa.selenium.NoAlertPresentException: no alert open while invoking Actions class method sendKeys through Selenium

EDIT: I found the solution. You can't use the right click in Selenium with the native context menu, only custom context menus
Updating the code to right click on a custom context menu, it worked fine.
I have looked at a dozen solutions and none of them work, so I have to share my code. Note, this solution works on my Mac. It does not work on my work laptop (Windows). I am using Chrome, Java 8, and Selenium 3.8.1
#Test
public void contextClickTest() {
WebElement contextRegion;
// Arbitrary collection of Keys to execute to navigate context menu
Keys[] keys = { Keys.ARROW_DOWN, Keys.ENTER };
// this site has a good context click demo
driver.get("https://swisnl.github.io/jQuery-contextMenu/demo.html");
// get the context region of the button using xpath
contextRegion = driver.findElement(By.xpath("/html/body/div/section/div/div/div/p/span"));
// Perform action to select some value in the context menu
Actions act = new Actions(driver).moveToElement(contextRegion).contextClick(contextRegion);
for(CharSequence cs : keys) {
act = act.sendKeys(cs);
}
act.build().perform();
// if successful an alert will appear.
// If not, this will throw an exception
driver.switchTo().alert().accept();
}
What could be the reason for not working when run on a different machine? Do I need to use different Keys for different platforms?
EDIT: This is the exception thrown by failing open the alert window:
FAILED: contextClickTest
org.openqa.selenium.NoAlertPresentException: no alert open
(Session info: chrome=68.0.3440.106)
(Driver info: chromedriver=2.33.506106 (8a06c39c4582fbfbab6966dbb1c38a9173bfb1a2),platform=Mac OS X 10.12.6 x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 0 milliseconds
Build info: version: '3.8.1', revision: '6e95a6684b', time: '2017-12-01T18:33:54.468Z'
System info: host: 'Seans-MacBook-Pro.local', ip: '10.0.0.104', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.12.6', java.version: '1.8.0_92'
Driver info: org.openqa.selenium.chrome.ChromeDriver
Capabilities {acceptSslCerts: true, applicationCacheEnabled: false, browserConnectionEnabled: false, browserName: chrome, chrome: {chromedriverVersion: 2.33.506106 (8a06c39c4582fb..., userDataDir: /var/folders/h7/0637cbz907d...}, cssSelectorsEnabled: true, databaseEnabled: false, handlesAlerts: true, hasTouchScreen: false, javascriptEnabled: true, locationContextEnabled: true, mobileEmulationEnabled: false, nativeEvents: true, networkConnectionEnabled: false, pageLoadStrategy: normal, platform: MAC, platformName: MAC, rotatable: false, setWindowRect: true, takesHeapSnapshot: true, takesScreenshot: true, unexpectedAlertBehaviour: , unhandledPromptBehavior: , version: 68.0.3440.106, webStorageEnabled: true}
Session ID: d7788e0a9788a597df727cfbaa4a26bd
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:214)
at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:166)
at org.openqa.selenium.remote.http.JsonHttpResponseCodec.reconstructValue(JsonHttpResponseCodec.java:40)
at org.openqa.selenium.remote.http.AbstractHttpResponseCodec.decode(AbstractHttpResponseCodec.java:80)
at org.openqa.selenium.remote.http.AbstractHttpResponseCodec.decode(AbstractHttpResponseCodec.java:44)
at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:164)
at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:83)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:601)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:658)
at org.openqa.selenium.remote.RemoteWebDriver$RemoteTargetLocator.alert(RemoteWebDriver.java:987)
at com.revature.testsuites.ContextClickTest.contextClickTest(ContextClickTest.java:40)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:80)
at org.testng.internal.Invoker.invokeMethod(Invoker.java:714)
at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:901)
at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1231)
at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:127)
at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:111)
at org.testng.TestRunner.privateRun(TestRunner.java:767)
at org.testng.TestRunner.run(TestRunner.java:617)
at org.testng.SuiteRunner.runTest(SuiteRunner.java:334)
at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:329)
at org.testng.SuiteRunner.privateRun(SuiteRunner.java:291)
at org.testng.SuiteRunner.run(SuiteRunner.java:240)
at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)
at org.testng.TestNG.runSuitesSequentially(TestNG.java:1198)
at org.testng.TestNG.runSuitesLocally(TestNG.java:1123)
at org.testng.TestNG.run(TestNG.java:1031)
at org.testng.remote.AbstractRemoteTestNG.run(AbstractRemoteTestNG.java:114)
at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:251)
at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:77)
This error message...
org.openqa.selenium.NoAlertPresentException: no alert open
...implies that the ChromeDriver was unable to invoke the Action class related methods.
Your main issue is the incompatibility between the version of the binaries you are using as follows:
You are using chromedriver=2.33
Release Notes of chromedriver=2.33 clearly mentions the following :
Supports Chrome v60-62
You are using chrome=68.0
Release Notes of ChromeDriver v2.41 clearly mentions the following :
Supports Chrome v67-69
Your Selenium Client version is 3.8.1 of 2017-12-01T18:33:54.468Z which is a bit older.
Your JDK version is 1.8.0_92 which is pretty ancient.
So there is a clear mismatch between the JDK v8u92 , Selenium Client v3.8.1 , ChromeDriver v2.33 and the Chrome Browser v68.0
Solution
Upgrade JDK to recent levels JDK 8u181.
Upgrade Selenium to current levels Version 3.14.0.
Upgrade ChromeDriver to current ChromeDriver v2.41 level.
Keep Chrome version between Chrome v67-69 levels. (as per ChromeDriver v2.41 release notes)
Clean your Project Workspace through your IDE and Rebuild your project with required dependencies only.
(WindowsOS only) Use CCleaner tool to wipe off all the OS chores before and after the execution of your Test Suite.
(LinuxOS only) Free Up and Release the Unused/Cached Memory in Ubuntu/Linux Mint before and after the execution of your Test Suite.
If your base Web Client version is too old, then uninstall it through Revo Uninstaller and install a recent GA and released version of Web Client.
Execute your #Test.
You may handle it by try-catch where it throws Alert Exception,
Sample Example:
try {
driver.switchTo().alert().accept();
} catch (Exception Ex) {
System.out.println("Alert was not present");
}

Protractor e2e tests using selenium are not running on IE11 | TimeOut issue

I am trying to run protractor e2e tests on IE11. tests are failing with timeout error.
[Test Error Output]
A Jasmine spec timed out. Resetting the WebDriver Control Flow.
[19:03:47]
[should not allow Clifton to create a sub-folder inside a folder previously created by Emmett] Failed: JavaScript error in async script. (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 1.29 seconds
Build info: version: '2.53.1', revision: 'a36b8b1', time: '2016-06-30 17:37:03'
System info: host: '', ip: '10.50.10.158', os.name: 'Windows Server 2008 R2', os.arch: 'amd64', os.version: '6.1', java.version: '1.7.0_79'
Driver info: org.openqa.selenium.ie.InternetExplorerDriver
Capabilities [{platform=WINDOWS, javascriptEnabled=true, elementScrollBehavior=1, ignoreZoomSetting=false, enablePersistentHover=false, ie.ensureCleanSession=false, browserName=internet explorer, enableElementCacheCleanup=true, ie.enableFullPageScreenshot=true, unexpectedAlertBehaviour=dismiss, ie.fileUploadDialogTimeout=3000, ie.forceShellWindowsApi=false, version=11, pageLoadStrategy=normal, ignoreProtectedModeSettings=false, requireWindowFocus=true, initialBrowserUrl=http://localhost:48570/, ie.forceCreateProcessApi=false, nativeEvents=true, browserAttachTimeout=0, ie.browserCommandLineSwitches=}]
I tried below this as mentioned in different blogs or post /issue links
Increase the test case time out from protractor e2e configuration.
Updating the protractor and selenium IE driver version.
Adding IE specific configuration setting in e2e configuration. e.g
capabilities: {
elementScrollBehavior: 1,
browserName: 'chrome',
// IE specific, enables modifier keys (eg. CTRL+CLICK)
requireWindowFocus: true,
// If this is set to be true, specs will be sharded by file (i.e. all
// files to be run by this set of capabilities will run in parallel).
// Default is false.
shardTestFiles: false,
// Maximum number of browser instances that can run in parallel for this
// set of capabilities. This is only needed if shardTestFiles is true.
// Default is 1.
maxInstances: 1,
loggingPrefs: {
//this is a chrome specific setting - no effect on other browser runs
performance: "OFF"
},
nativeEvents: false,
unexpectedAlertBehaviour: 'accept',
ignoreProtectedModeSettings: true,
enablePersistentHover: true,
requireWindowFocus: true,
ignoreZoomSetting: true,
INTRODUCE_FLAKINESS_BY_IGNORING_SECURITY_DOMAINS: true
}
Configuring the IE browser settings as recommended in the below link http://elgalu.github.io/2014/run-protractor-against-internet-explorer-vm/#
Protractor test in IE
Using browser.driver.get() instead of browser.get() as mentioned in link: https://github.com/angular/protractor/issues/4268
Is their any limitations running protractor e2e tests on IE11 ?

Selenium GeckoDriver with Protractor: "Failed: Timed out"

My automation test suite uses Selenium WebDriver with Protractor and Jasmine to run against a variety of browsers. When using GeckoDriver to run the tests on Firefox, I am intermittently getting an error message that just says "Failed: Timed out":
. ✓ WHEN I visit the favorites page
. ✓ THEN it should say I havent added anything
F ✗ WHEN I open the inspirations page
- Failed: Timed out
Build info: version: '3.8.1', revision: '6e95a6684b', time: '2017-12-01T19:05:32.194Z'
System info: host: 'admins-MacBook-Pro-3.local', ip: 'fe80:0:0:0:10a7:9b8d:6ff5:f46%en0', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.12.6', java.version: '1.8.0_144'
Driver info: driver.version: unknown
F ✗ AND I click on an inspiration preview pane to open an inspiration
I have tried padding it with hard-coded sleep on either side, and I've searched for other errors, but everything else I can find in regards to Protractor timeouts is for other errors that have some kind of a description about what is actually timing out.
Has anyone seen JUST the message "Failed: Timed out" here who can help determine what might be timing out?
As requested, here is the gulp task that kicks off my protractor:
gulp.task('test-frontend-firefox', 'Run feature tests locally', function() {
gulp.src(['test/feature/**/*.spec.js'])
.pipe(protractor({
configFile: __dirname + '/../test/protractor_local_ff.conf.js',
args: ['--baseUrl', 'http://localhost:9099'],
}));
});
And here is protractor_local_ff.conf.js as referenced by the gulp task:
var private_config = require('./private.conf.js');
var golden_config = require('./golden.conf.js');
exports.config = {
params: {
private: private_config,
golden: golden_config,
localhost: true
},
onPrepare: function(){
var SpecReporter = require('jasmine-spec-reporter').SpecReporter;
jasmine.getEnv().addReporter(new SpecReporter({displayStacktrace: 'all'}));
},
framework: 'jasmine2',
// seleniumAddress: 'http://hub-cloud.browserstack.com/wd/hub',
seleniumAddress: 'http://localhost:4444/wd/hub',
capabilities: {
'browserName': 'firefox'
}
};
As you can see, it's set up to be able to run against the hosted app in either browserstack or on my localhost, but the error gets thrown intermittently in either environment.

WebDriverException: Error: Permission denied to access property "navigator"

Here is the deal with the "magic" encountered: The code works fine on Ubuntu 16.04, Ubuntu 15.10 on a fall with errors:
org.openqa.selenium.WebDriverException: Error: Permission denied to access property "navigator"
org.openqa.selenium.WebDriverException: Error: Permission denied to access property "document"
I have following code:
import geb.spock.GebReportingSpec
import geb.waiting.WaitTimeoutException
class LoginSpec extends GebReportingSpec {
def "#0 go to login FB"() {
when:
browser.go("https://www.facebook.com/")
then:
delay(9)
if (browser.title != "Facebook") {
browser.title == "Facebook - Log In or Sign Up"
browser.currentUrl == "https://www.facebook.com/"
waitFor(30){
$("#loginbutton").size() == 1
}
$("#email").value(Config.FB_USERNAME)
$("#pass").value(Config.FB_PASSWORD)
println("entered credentials")
$("#loginbutton").click()
}
delay(9)
}
void delay(Long seconds){
try {
waitFor(seconds){ }
} catch (WaitTimeoutException ignored){ }
}
}
GebConfig.groovy :
import org.openqa.selenium.firefox.FirefoxDriver
waiting {
timeout = 2
}
environments {
firefox {
driver = { new FirefoxDriver() }
}
}
baseUrl = "https://google.com"
testReportDir = new File("$buildDir/test-reports/UT")
testResultsDir = new File("$buildDir/test-results/UT")
And at build.gradle lines
firefoxTest {
systemProperty "webdriver.gecko.driver", "/usr/bin/geckodriver"
}
Error:
LoginSpec > #0 go to login FB FAILED
org.openqa.selenium.WebDriverException: Error: Permission denied to access property "navigator"
Build info: version: '3.0.0-beta4', revision: '3169782', time: '2016-09-29 10:30:04 -0700'
System info: host: 'tb-buildagent01-infrastructure-ci', ip: '10.4.1.4', os.name: 'Linux', os.arch: 'amd64', os.version: '4.2.0-30-generic', java.version: '1.8.0_66-internal'
Driver info: org.openqa.selenium.firefox.FirefoxDriver
Capabilities [{rotatable=false, raisesAccessibilityExceptions=false, marionette=true, appBuildId=20160606114238, version=, platform=LINUX, proxy={}, command_id=1, specificationLevel=0, acceptSslCerts=false, browserVersion=47.0, platformVersion=4.2.0-30-generic, XULappId={ec8030f7-c20a-464f-9b0e-13a3a9e97384}, browserName=Firefox, takesScreenshot=true, takesElementScreenshot=true, platformName=Linux, device=desktop}]
Session ID: 5af3ae72-af52-4760-9b9c-5a1261b52113
at org.openqa.selenium.remote.http.W3CHttpResponseCodec.createException(W3CHttpResponseCodec.java:126)
at org.openqa.selenium.remote.http.W3CHttpResponseCodec.decode(W3CHttpResponseCodec.java:93)
at org.openqa.selenium.remote.http.W3CHttpResponseCodec.decode(W3CHttpResponseCodec.java:42)
at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:163)
at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:82)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:602)
at org.openqa.selenium.remote.RemoteWebElement.execute(RemoteWebElement.java:284)
at org.openqa.selenium.remote.RemoteWebElement.getAttribute(RemoteWebElement.java:136)
at geb.navigator.NonEmptyNavigator.setInputValue(NonEmptyNavigator.groovy:687)
at geb.navigator.NonEmptyNavigator.setInputValues_closure40(NonEmptyNavigator.groovy:680)
at groovy.lang.Closure.call(Closure.java:414)
at geb.navigator.NonEmptyNavigator.setInputValues(NonEmptyNavigator.groovy:679)
at geb.navigator.NonEmptyNavigator.value(NonEmptyNavigator.groovy:417)
at LoginSpec.#0 go to login FB(LoginSpec.groovy:81)
org.openqa.selenium.WebDriverException: Error: Permission denied to access property "document"
Build info: version: '3.0.0-beta4', revision: '3169782', time: '2016-09-29 10:30:04 -0700'
System info: host: 'tb-buildagent01-infrastructure-ci', ip: '10.4.1.4', os.name: 'Linux', os.arch: 'amd64', os.version: '4.2.0-30-generic', java.version: '1.8.0_66-internal'
Driver info: org.openqa.selenium.firefox.FirefoxDriver
Capabilities [{rotatable=false, raisesAccessibilityExceptions=false, marionette=true, appBuildId=20160606114238, version=, platform=LINUX, proxy={}, command_id=1, specificationLevel=0, acceptSslCerts=false, browserVersion=47.0, platformVersion=4.2.0-30-generic, XULappId={ec8030f7-c20a-464f-9b0e-13a3a9e97384}, browserName=Firefox, takesScreenshot=true, takesElementScreenshot=true, platformName=Linux, device=desktop}]
Session ID: 5af3ae72-af52-4760-9b9c-5a1261b52113
I understand, that something wrong with environment, but I don't know where I made mistake? Please, give me advice, how can I fix this. Thank you.
In general, the reason was different versions of Ubuntu and Firefox free. If such a mistake to see someone, I recommend to execute "apt-cache policy firefox" from terminal.
On Ubuntu 16.04 now, you can see:
Installed: 49.0+build4-0ubuntu0.16.04.1
Candidate: 49.0+build4-0ubuntu0.16.04.1
Version table:
*** 49.0+build4-0ubuntu0.16.04.1 500
500 http://ua.archive.ubuntu.com/ubuntu xenial-updates/main amd64 Packages
500 http://security.ubuntu.com/ubuntu xenial-security/main amd64 Packages
100 /var/lib/dpkg/status
45.0.2+build1-0ubuntu1 500
500 http://ua.archive.ubuntu.com/ubuntu xenial/main amd64 Packages
And on Ubuntu 15.10 :
Candidate: 47.0+build3-0ubuntu0.15.10.1
Version table:
47.0+build3-0ubuntu0.15.10.1 0
500 http://azure.archive.ubuntu.com/ubuntu/ wily-updates/main amd64 Packages
500 http://security.ubuntu.com/ubuntu/ wily-security/main amd64 Packages
100 /var/lib/dpkg/status
41.0.2+build2-0ubuntu1 0
500 http://azure.archive.ubuntu.com/ubuntu/ wily/main amd64 Packages
And they have to be addressed. And the rollback version of selenium and other dependencies data base can not help, because at the front end may be things that are not supported by the browser (not to speak of the FB), for example: var result = window.Notification.requestPermission(callback) and it is https://developer.mozilla.org/ru/docs/Web/API/Notification/requestPermission :) And yes, you're right it seemed (to view error) that the page is empty - for ajax not work out. On the one hand you may find a bug (not every customer he uses the latest version of the browser), but in my case - this is a plus pain in the ass. And to update the entire system - entertainment for the fan, although it may be in your team has a person who is expressed as procrastination, and in this case, you're in luck.
I was getting the error:
org.openqa.selenium.JavascriptException: Error: Permission denied to access property "navigator"
When I was using Firefox 45.7 and gecko driver
I upgraded Firefox to 52.2, and the error is gone.