Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot convert undefined or null to object #839

Closed
snake-py opened this issue Jan 25, 2021 · 1 comment
Closed

Cannot convert undefined or null to object #839

snake-py opened this issue Jan 25, 2021 · 1 comment

Comments

@snake-py
Copy link

I am trying to set up spectron. I am unsure how to resolve this. I took the code from the docs and went throw it for a couple of days. It seems that spectron is not opening my app, instead, multiple windows appear and it is stuck in a loop. I am unsure if this is a bug or due to version incompatibility (I checked I am using electron 10.1.5 and spectron 12.0.0).

My code:

const Application = require('spectron').Application;
const electronPath = require('electron'); // Require Electron from the binaries included in node_modules.
const path = require('path');
const assert = require('assert');

const app = new Application({
  path: electronPath,
  args: [path.join(__dirname, '..')],
});

describe('Testing', function () {
  this.timeout(10000);
  beforeEach(() => {
    console.log(app); // this is executed
    return app.start(); // troubling line
  });
  afterEach(() => {
    if (app && app.isRunning()) {
      return app.stop();
    }
  });
  it('shows an initial window', function () {
    console.log('count'); // this is not executed
    // const count = app.client.getWindowCount();
    // return assert.equal(count, 1);
    assert(1,1)
  });
});

The error I got:

1) Testing
       "before each" hook for "shows an initial window":
     javascript error: javascript error: Cannot convert undefined or null to object
  (Session info: chrome=85.0.4183.121)
      at Object.getErrorFromResponseBody (node_modules\webdriver\build\utils.js:94:12)
      at WebDriverRequest._request (node_modules\webdriver\build\request.js:134:31)
      at processTicksAndRejections (internal/process/task_queues.js:97:5)
      at async Browser.wrapCommandFn (node_modules\@wdio\utils\build\shim.js:63:29)
      at async Browser.wrapCommandFn (node_modules\@wdio\utils\build\shim.js:63:29)
@snake-py
Copy link
Author

See #738

I did this and the code started working

const myWindow = new BrowserWindow({ webPreferences: { enableRemoteModule: true } });

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant