question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Firefox: Test fails with error "SecurityError: The operation is insecure" if webdriver's option restart is set to false and scenario doesn't contain amOnPage()

See original GitHub issue

I hit it when had the 1st scenario containing only REST helper calls. But simply the issue occurs if there is no WebDriver call I.amOnPage() in the 1st scenario

What are you trying to achieve?

Test should pass in Chrome/Firefox

What do you get instead?

Test passes in Chrome only. It fails on Firefox

Provide console output if related. Use --verbose mode for more details.

$ node_modules/.bin/codeceptjs run My_test.js --verbose
CodeceptJS v1.4.6
Using test root "/home/mira/workspace/mycodeceptjs"
Helpers: WebDriverIO
Plugins: screenshotOnFail

My --
    [1] Starting recording promises
    Emitted | suite.before ([object Object])
 › [Session] Starting singleton browser session
  One
    Emitted | test.before ([object Object])
    Emitted | test.start ([object Object])
    Emitted | test.passed ([object Object])
    Emitted | test.finish ([object Object])
  ✔ OK in 4ms

    Emitted | test.after ([object Object])
 › [Session] cleaning cookies and localStorage
    [1] Error | Error: SecurityError: The operation is insecure.
Build info: version: '3.8.1', revision: '6e95a6684b', time: '2017-12-01T19:05:32.194Z'
System info: host: 'mira-envy', ip: '127.0.1.1', os.name: 'Linux', os.arch: 'amd64', os.version: '4.18.0-13-generic', java.version: '11.0.1'
Driver info: org.openqa.selenium.firefox.FirefoxDriver
Capabilities {acceptInsecureCerts: false, browserName: firefox, browserVersion: 64.0, javascriptEnabled: true, moz:accessibilityChecks: false, moz:geckodriverVersion: 0.23.0, moz:headless: false, moz:processID: 4399, moz:profile: /tmp/rust_mozprofile.sx6QhU..., moz:shutdownTimeout: 60000, moz:useNonSpecCompliantPointerOrigin: false, moz:webdriverClick: true, pageLoadStrategy: normal, platform: LINUX, platformName: LINUX, platformVersion: 4.18.0-13-generic, rotatable: false, setWindowRect: true, timeouts: {implicit: 0, pageLoad: 300000, script: 30000}, unhandledPromptBehavior: dismiss and notify}
Session ID: 7c5333cd-cceb-4309-a0c0-5af69e21f59b
    Emitted | test.failed ([object Object])
  ✖ "after each" hook: finalize codeceptjs for "One" in 1098ms
    [1] Error | Error: SecurityError: The operation is insecure.
Build info: version: '3.8.1', revision: '6e95a6684b', time: '2017-12-01T19:05:32.194Z'
System info: host: 'mira-envy', ip: '127.0.1.1', os.name: 'Linux', os.arch: 'amd64', os.version: '4.18.0-13-generic', java.version: '11.0.1'
Driver info: org.openqa.selenium.firefox.FirefoxDriver
Capabilities {acceptInsecureCerts: false, browserName: firefox, browserVersion: 64.0, javascriptEnabled: true, moz:accessibilityChecks: false, moz:geckodriverVersion: 0.23.0, moz:headless: false, moz:processID: 4399, moz:profile: /tmp/rust_mozprofile.sx6QhU..., moz:shutdownTimeout: 60000, moz:useNonSpecCompliantPointerOrigin: false, moz:webdriverClick: true, pageLoadStrategy: normal, platform: LINUX, platformName: LINUX, platformVersion: 4.18.0-13-generic, rotatable: false, setWindowRect: true, timeouts: {implicit: 0, pageLoad: 300000, script: 30000}, unhandledPromptBehavior: dismiss and notify}
Session ID: 7c5333cd-cceb-4309-a0c0-5af69e21f59b
Error: SecurityError: The operation is insecure.
Build info: version: '3.8.1', revision: '6e95a6684b', time: '2017-12-01T19:05:32.194Z'
System info: host: 'mira-envy', ip: '127.0.1.1', os.name: 'Linux', os.arch: 'amd64', os.version: '4.18.0-13-generic', java.version: '11.0.1'
Driver info: org.openqa.selenium.firefox.FirefoxDriver
Capabilities {acceptInsecureCerts: false, browserName: firefox, browserVersion: 64.0, javascriptEnabled: true, moz:accessibilityChecks: false, moz:geckodriverVersion: 0.23.0, moz:headless: false, moz:processID: 4399, moz:profile: /tmp/rust_mozprofile.sx6QhU..., moz:shutdownTimeout: 60000, moz:useNonSpecCompliantPointerOrigin: false, moz:webdriverClick: true, pageLoadStrategy: normal, platform: LINUX, platformName: LINUX, platformVersion: 4.18.0-13-generic, rotatable: false, setWindowRect: true, timeouts: {implicit: 0, pageLoad: 300000, script: 30000}, unhandledPromptBehavior: dismiss and notify}
Session ID: 7c5333cd-cceb-4309-a0c0-5af69e21f59b
    Emitted | suite.after ([object Object])

-- FAILURES:

  1) My
       "after each" hook: finalize codeceptjs for "One":
     SecurityError: The operation is insecure.
Build info: version: '3.8.1', revision: '6e95a6684b', time: '2017-12-01T19:05:32.194Z'
System info: host: 'mira-envy', ip: '127.0.1.1', os.name: 'Linux', os.arch: 'amd64', os.version: '4.18.0-13-generic', java.version: '11.0.1'
Driver info: org.openqa.selenium.firefox.FirefoxDriver
Capabilities {acceptInsecureCerts: false, browserName: firefox, browserVersion: 64.0, javascriptEnabled: true, moz:accessibilityChecks: false, moz:geckodriverVersion: 0.23.0, moz:headless: false, moz:processID: 4399, moz:profile: /tmp/rust_mozprofile.sx6QhU..., moz:shutdownTimeout: 60000, moz:useNonSpecCompliantPointerOrigin: false, moz:webdriverClick: true, pageLoadStrategy: normal, platform: LINUX, platformName: LINUX, platformVersion: 4.18.0-13-generic, rotatable: false, setWindowRect: true, timeouts: {implicit: 0, pageLoad: 300000, script: 30000}, unhandledPromptBehavior: dismiss and notify}
Session ID: 7c5333cd-cceb-4309-a0c0-5af69e21f59b
  rror: SecurityError: The operation is insecure.
  Build info: version: '3.8.1', revision: '6e95a6684b', time: '2017-12-01T19:05:32.194Z'
  System info: host: 'mira-envy', ip: '127.0.1.1', os.name: 'Linux', os.arch: 'amd64', os.version: '4.18.0-13-generic', java.version: '11.0.1'
  Driver info: org.openqa.selenium.firefox.FirefoxDriver
  Capabilities {acceptInsecureCerts: false, browserName: firefox, browserVersion: 64.0, javascriptEnabled: true, moz:accessibilityChecks: false, moz:geckodriverVersion: 0.23.0, moz:headless: false, moz:processID: 4399, moz:profile: /tmp/rust_mozprofile.sx6QhU..., moz:shutdownTimeout: 60000, moz:useNonSpecCompliantPointerOrigin: false, moz:webdriverClick: true, pageLoadStrategy: normal, platform: LINUX, platformName: LINUX, platformVersion: 4.18.0-13-generic, rotatable: false, setWindowRect: true, timeouts: {implicit: 0, pageLoad: 300000, script: 30000}, unhandledPromptBehavior: dismiss and notify}
  Session ID: 7c5333cd-cceb-4309-a0c0-5af69e21f59b
      at new RuntimeError (node_modules/webdriverio/build/lib/utils/ErrorHandler.js:143:12)
      at Request._callback (node_modules/webdriverio/build/lib/utils/RequestHandler.js:316:39)
      at Request.self.callback (node_modules/request/request.js:185:22)
      at Request.<anonymous> (node_modules/request/request.js:1161:10)
      at IncomingMessage.<anonymous> (node_modules/request/request.js:1083:12)


  FAIL  | 1 passed, 1 failed   // 5s
    Emitted | global.result ([object Object])
    Emitted | global.after ([object Object])

Provide test source code if related

/// <reference path="./steps.d.ts" />

Feature("My");

Scenario("One", (I) => {
    // I.amOnPage("/");
});

Scenario("Two", (I) => {
});

Details

  • CodeceptJS version: 1.4.6
  • NodeJS Version: 8.15.0
  • Operating System: Ubuntu 18.10 (the issue happens even on Windows 10)
  • WebDriverIO 4.13.1
  • Selenium Standalone 3.8.1, geckodriver 0.23.0
  • Firefox 64.0
  • Configuration file:
{
  "tests": "./*_test.js",
  "timeout": 10000,
  "output": "./output",
  "helpers": {
    "WebDriverIO": {
      "url": "http://localhost",
      "browser": "firefox",
      "restart": false
    }
  },
  "include": {
    "I": "./steps_file.js"
  },
  "bootstrap": false,
  "mocha": {},
  "name": "mycodeceptjs"
}
  • Selenium log:
19:17:32.340 INFO - Detected dialect: W3C
19:17:32.374 INFO - Done: [new session: Capabilities {browserName: firefox, handlesAlerts: true, javascriptEnabled: true, locationContextEnabled: true, loggingPrefs: org.openqa.selenium.logging..., requestOrigins: {name: webdriverio, url: http://webdriver.io, version: 4.13.1}, rotatable: true}]
19:17:32.418 INFO - Executing: [script: 1000])
19:17:32.432 INFO - Done: [script: 1000]
19:17:32.458 INFO - Executing: [delete all cookies])
19:17:32.469 INFO - Done: [delete all cookies]
19:17:32.491 INFO - Executing: [execute script: localStorage.clear();, []])
19:17:33.523 WARN - Exception thrown
org.openqa.selenium.JavascriptException: SecurityError: The operation is insecure.
Build info: version: '3.8.1', revision: '6e95a6684b', time: '2017-12-01T19:05:32.194Z'
System info: host: 'mira-envy', ip: '127.0.1.1', os.name: 'Linux', os.arch: 'amd64', os.version: '4.18.0-13-generic', java.version: '11.0.1'
Driver info: org.openqa.selenium.firefox.FirefoxDriver
Capabilities {acceptInsecureCerts: false, browserName: firefox, browserVersion: 64.0, javascriptEnabled: true, moz:accessibilityChecks: false, moz:geckodriverVersion: 0.23.0, moz:headless: false, moz:processID: 4399, moz:profile: /tmp/rust_mozprofile.sx6QhU..., moz:shutdownTimeout: 60000, moz:useNonSpecCompliantPointerOrigin: false, moz:webdriverClick: true, pageLoadStrategy: normal, platform: LINUX, platformName: LINUX, platformVersion: 4.18.0-13-generic, rotatable: false, setWindowRect: true, timeouts: {implicit: 0, pageLoad: 300000, script: 30000}, unhandledPromptBehavior: dismiss and notify}
Session ID: 7c5333cd-cceb-4309-a0c0-5af69e21f59b
	at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
	at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
	at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:490)
	at org.openqa.selenium.remote.http.W3CHttpResponseCodec.createException(W3CHttpResponseCodec.java:187)
	at org.openqa.selenium.remote.http.W3CHttpResponseCodec.decode(W3CHttpResponseCodec.java:122)
	at org.openqa.selenium.remote.http.W3CHttpResponseCodec.decode(W3CHttpResponseCodec.java:49)
	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.executeScript(RemoteWebDriver.java:537)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
	at org.openqa.selenium.support.events.EventFiringWebDriver$2.invoke(EventFiringWebDriver.java:108)
	at com.sun.proxy.$Proxy7.executeScript(Unknown Source)
	at org.openqa.selenium.support.events.EventFiringWebDriver.executeScript(EventFiringWebDriver.java:221)
	at org.openqa.selenium.remote.server.handler.ExecuteScript.call(ExecuteScript.java:56)
	at org.openqa.selenium.remote.server.handler.WebDriverHandler.handle(WebDriverHandler.java:41)
	at org.openqa.selenium.remote.server.rest.ResultConfig.handle(ResultConfig.java:112)
	at org.openqa.selenium.remote.server.JsonHttpCommandHandler.handleRequest(JsonHttpCommandHandler.java:191)
	at org.openqa.selenium.remote.server.DriverServlet.lambda$handleRequest$0(DriverServlet.java:261)
	at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
	at java.base/java.lang.Thread.run(Thread.java:834)
19:17:33.527 WARN - Exception: SecurityError: The operation is insecure.
Build info: version: '3.8.1', revision: '6e95a6684b', time: '2017-12-01T19:05:32.194Z'
System info: host: 'mira-envy', ip: '127.0.1.1', os.name: 'Linux', os.arch: 'amd64', os.version: '4.18.0-13-generic', java.version: '11.0.1'
Driver info: org.openqa.selenium.firefox.FirefoxDriver
Capabilities {acceptInsecureCerts: false, browserName: firefox, browserVersion: 64.0, javascriptEnabled: true, moz:accessibilityChecks: false, moz:geckodriverVersion: 0.23.0, moz:headless: false, moz:processID: 4399, moz:profile: /tmp/rust_mozprofile.sx6QhU..., moz:shutdownTimeout: 60000, moz:useNonSpecCompliantPointerOrigin: false, moz:webdriverClick: true, pageLoadStrategy: normal, platform: LINUX, platformName: LINUX, platformVersion: 4.18.0-13-generic, rotatable: false, setWindowRect: true, timeouts: {implicit: 0, pageLoad: 300000, script: 30000}, unhandledPromptBehavior: dismiss and notify}
Session ID: 7c5333cd-cceb-4309-a0c0-5af69e21f59b
19:17:33.562 INFO - Executing: [delete session: 7c5333cd-cceb-4309-a0c0-5af69e21f59b])
1548181053567	Marionette	INFO	Stopped listening on port 32797
[Parent 4399, Gecko_IOThread] WARNING: pipe error (64): Connection reset by peer: file /build/firefox-OWzVI3/firefox-64.0+build3/ipc/chromium/src/chrome/common/ipc_channel_posix.cc, line 363
[Parent 4399, Gecko_IOThread] WARNING: pipe error (78): Connection reset by peer: file /build/firefox-OWzVI3/firefox-64.0+build3/ipc/chromium/src/chrome/common/ipc_channel_posix.cc, line 363
JavaScript error: resource://gre/modules/Sqlite.jsm, line 841: Error: Connection is not open.
19:17:34.397 INFO - Done: [delete session: 7c5333cd-cceb-4309-a0c0-5af69e21f59b]

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
elukoyanovcommented, Feb 1, 2019

@mirao you can synchronize in _before, if it is not a part of test, but preparing only

0reactions
miraocommented, Feb 3, 2019

OK. closing the issue as a solution was found. The original issue is probably a Firefox security “feature”. @LukoyanovE : Thanks for help.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Test fails with error "SecurityError: The operation is insecure" if ...
Firefox : Test fails with error "SecurityError: The operation is insecure" if webdriver's option restart is set to false and scenario doesn't ......
Read more >
WebDriverException: 'SecurityError: The operation is insecure ...
I need to know if there is any option in about:config or any way to make Firefox run insecure operations. c# · selenium...
Read more >
Error: The operation is insecure. How can I stop this? | Firefox ...
For the last few days, I have been receiving the following error notice on almost every page I open: Error: The operation is...
Read more >
WebDriver - Codeception - Documentation
restart - Set to false (default) to use the same browser window for all tests, or set to true to create a new...
Read more >
Testing with WebDriver - CodeceptJS
ChromeDriver without Selenium. If you want to run tests using raw ChromeDriver (which also supports WebDriver protocol) avoiding Selenium Server ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found