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

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.

Related

Selenium: Using a Chrome Profile for Remote Webdriver: unknown error: cannot create default profile directory

Using ChromeDriver v102 (since there's a current bug open for v103 https://bugs.chromium.org/p/chromedriver/issues/detail?id=4121)
I get the error (full log information listed below):
Response code 500. Message: unknown error: cannot create default profile directory
when I run ChromeDriver remotely on the selenium node grid.
I am able to use a specific chrome profile when running the ChromeDriver locally. The driver for Firefox also works remotely, so I have to conclude that this is a "remote ChromeDriver" issue.
I download the chrome profile from the cloud into my current working directory. The directory is detected/located in my code.
There are no spaces in my path to the profile directory. The chrome profile only contains essential files I want to keep.
save_file_list = ["Bookmarks", "History", "History-journal", "Cookies", "Cookies-Journal", "Favicons", "Favicons-journal"]
When I use the ChromeDriver locally, I download the chrome profile, it loads the essential files and the driver creates the rest on its own. The same code works (and runs in an executable) when I run it on windows and mac machines.
However, this fails to work at all when using the remote driver. The remote driver works perfectly when I do not use a specific user-data-dir. It even works using an authenticated proxy. Therefore there are no issues with my connection. The code fails in both cases: when I use a virtual environment to run the code and when I run a docker image. Therefore I know it's not a docker issue.
This is the code for loading a chrome profile to my chrome options:
def add_profile(self, chrome_options):
if self.download_profile():
arg = f'--user-data-dir={os.getcwd()}/{self.profile_path}'
logging.info(f'Adding arg: {arg}')
chrome_options.add_argument(arg)
logging.info("Successfully added profile to chrome driver.")
return chrome_options
def setup_chrome(self) -> webdriver.Remote:
prefs = {
"credentials_enable_service": False,
"profile.password_manager_enabled": False,
}
chrome_options = webdriver.ChromeOptions()
chrome_options.add_argument("--enable-javascript")
chrome_options.add_argument("--disable-blink-features=AutomationControlled")
chrome_options.add_experimental_option("useAutomationExtension", False)
chrome_options.add_experimental_option("excludeSwitches", ["enable-automation"])
chrome_options.add_experimental_option("prefs", prefs)
chrome_options = self.proxy.add_proxy_plugin(chrome_options, use_proxy=True)
chrome_options = self.chrome_profile.add_profile(chrome_options) #currently not working
capabilities = {
"browserName": "chrome",
"chromeOptions": {
"useAutomationExtension": False,
"forceDevToolsScreenshot": True,
"args": ["--start-maximized", "--disable-infobars"],
},
}
remote_driver_host = os.environ.get("SELENIUM_URL")
logging.info("Setting up remote connection")
try:
selenium_connection = RemoteConnectionV2(
remote_driver_host, keep_alive=False
)
selenium_connection.set_remote_connection_authentication_headers()
driver = webdriver.Remote(
command_executor=selenium_connection, # for prod
# command_executor="http://localhost:4444/wd/hub", # for local development
desired_capabilities=capabilities,
options=chrome_options,
keep_alive=True,
)
logging.info("SUCCESS: created remote chrome using connection")
except Exception as ex:
logging.error(f"Failed to initiate Chrome browser: {ex}")
raise
try:
driver.get("https://www.google.com")
except Exception as e:
logging.error(f"Failed to connect using proxy: {e}")
return driver
This is the log:
27-Jun-22 10:04:53 AM EDT | INFO | SUCCESS: downloaded proxy assignment:
27-Jun-22 10:04:54 AM EDT | INFO | Successfully downloaded & extracted _zGF_23_CHROME_PROFILE.
27-Jun-22 10:04:54 AM EDT | INFO | Adding arg: --user-data-dir=/Users/<myuser>/Repos<my-repo>/_zGF_23_CHROME_PROFILE
27-Jun-22 10:04:54 AM EDT | INFO | Successfully added profile to chrome driver.
27-Jun-22 10:04:54 AM EDT | INFO | Setting up remote connection
[Authentication] No identity token was found in the environment. Requesting a new one.
[Authentication] An identity token found successfully.
27-Jun-22 10:04:55 AM EDT | ERROR | Failed to initiate Chrome browser: Message: Could not start a new session. Error while creating session with the driver service. Stopping driver service: Could not start a new session. Response code 500. Message: unknown error: cannot create default profile directory
Build info: version: '4.2.2', revision: '683ccb65d6'
System info: host: 'localhost', ip: '127.0.0.1', os.name: 'Linux', os.arch: 'amd64', os.version: '4.4.0', java.version: '11.0.15'
Driver info: driver.version: unknown
Build info: version: '4.2.2', revision: '683ccb65d6'
System info: host: 'localhost', ip: '127.0.0.1', os.name: 'Linux', os.arch: 'amd64', os.version: '4.4.0', java.version: '11.0.15'
Driver info: driver.version: unknown
Stacktrace:
at org.openqa.selenium.grid.node.config.DriverServiceSessionFactory.apply (DriverServiceSessionFactory.java:194)
at org.openqa.selenium.grid.node.config.DriverServiceSessionFactory.apply (DriverServiceSessionFactory.java:67)
at org.openqa.selenium.grid.node.local.SessionSlot.apply (SessionSlot.java:145)
at org.openqa.selenium.grid.node.local.LocalNode.newSession (LocalNode.java:362)
at org.openqa.selenium.grid.distributor.local.LocalDistributor.startSession (LocalDistributor.java:618)
at org.openqa.selenium.grid.distributor.local.LocalDistributor.newSession (LocalDistributor.java:544)
at org.openqa.selenium.grid.distributor.local.LocalDistributor$NewSessionRunnable.handleNewSessionRequest (LocalDistributor.java:791)
at org.openqa.selenium.grid.distributor.local.LocalDistributor$NewSessionRunnable.lambda$run$1 (LocalDistributor.java:752)
at java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1128)
at java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:628)
at java.lang.Thread.run (Thread.java:829)
27-Jun-22 10:04:55 AM EDT | ERROR | Message: Could not start a new session. Error while creating session with the driver service. Stopping driver service: Could not start a new session. Response code 500. Message: unknown error: cannot create default profile directory
Build info: version: '4.2.2', revision: '683ccb65d6'
System info: host: 'localhost', ip: '127.0.0.1', os.name: 'Linux', os.arch: 'amd64', os.version: '4.4.0', java.version: '11.0.15'
Driver info: driver.version: unknown
Build info: version: '4.2.2', revision: '683ccb65d6'
System info: host: 'localhost', ip: '127.0.0.1', os.name: 'Linux', os.arch: 'amd64', os.version: '4.4.0', java.version: '11.0.15'
Driver info: driver.version: unknown
Stacktrace:
at org.openqa.selenium.grid.node.config.DriverServiceSessionFactory.apply (DriverServiceSessionFactory.java:194)
at org.openqa.selenium.grid.node.config.DriverServiceSessionFactory.apply (DriverServiceSessionFactory.java:67)
at org.openqa.selenium.grid.node.local.SessionSlot.apply (SessionSlot.java:145)
at org.openqa.selenium.grid.node.local.LocalNode.newSession (LocalNode.java:362)
at org.openqa.selenium.grid.distributor.local.LocalDistributor.startSession (LocalDistributor.java:618)
at org.openqa.selenium.grid.distributor.local.LocalDistributor.newSession (LocalDistributor.java:544)
at org.openqa.selenium.grid.distributor.local.LocalDistributor$NewSessionRunnable.handleNewSessionRequest (LocalDistributor.java:791)
at org.openqa.selenium.grid.distributor.local.LocalDistributor$NewSessionRunnable.lambda$run$1 (LocalDistributor.java:752)
at java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1128)
at java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:628)
at java.lang.Thread.run (Thread.java:829)

Always getting a "Failed: sendKeysToActiveElement" error while working on any of the keyboard actions of the actions class in protractor

I am always getting a "Failed: sendKeysToActiveElement" error while working on any of the keyboard actions of the actions class in protractor.
Below is my code -
it(' Tests to handle keyboard actions in Protractor ', async () => {
browser.manage().timeouts().implicitlyWait(15000);
browser.get("https://letcode.in/selectable")
browser.sleep(5000)
let elem_1 = element(by.xpath("(//h3[#id='clour'])[2]"))
let elem_2 = element(by.xpath("(//h3[#id='clour'])[4]"))
let elem_3 = element(by.xpath("(//h3[#id='clour'])[5]"))
let elem_4 = element(by.xpath("(//h3[#id='clour'])[9]"))
await browser.actions()
.click(await elem_1.getWebElement())
.keyDown(protractor.Key.CONTROL)
.click(await elem_2.getWebElement())
.keyUp(protractor.Key.CONTROL)
.perform();
});
My conf.js -
require("babel-register")({
presets: ["es2015"]
});
exports.config = {
framework: 'jasmine',
SELENIUM_PROMISE_MANAGER: true,
specs: ['selectMultiElement.js'],
capabilities: {
'browserName': 'chrome',
'chromeOptions': {
'args': ['show-fps-counter=true', '--window-size=1920x1280']
}
}
};
I am getting the error as -
UnsupportedOperationError: sendKeysToActiveElement
Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:25:53'
System info: host: 'LAPTOP-HGJU6DES', ip: '192.168.1.6', os.name: 'Windows 11', os.arch: 'amd64', os.version: '10.0', java.version: '18.0.1.1'
Driver info: driver.version: unknown
Can anyone suggest what can be the solution of this error please.
I am using chrome 102 version.
I tried adding 'w3c': false in chromeOptions but that also showed some different error. Running the code with this argument it is opening 3 instances of the chromedriver but not being able to proceed with any command in the script thus eventually failing the script.
Changing the framework from jasmine to jasmine2 worked for me.

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

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.

Chrome Automation Extension Error using Selenium with Protractor/Jasmine

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.