jeudi 4 mars 2021

no such window: target window already closed from unknown error: web view not found(electron-spectron)

I am getting error while i tried to run below test cases. This is for an electron app. Test cases are written using mocha and spectron.

    describe('Application launch', function() {
        let app;
        this.timeout(60000);
    
        before(() => {
           app = new Application({
                path: electronPath,
                args: [path.join(__dirname, '..')],
            });
            return app.start()
        });
    
        after(() => {
            if (app && app.isRunning()) {
                return app.stop();
            }
        });
    
        it('Shows an initial window', async () => {
            const count = await app.client.getWindowCount();
            return assert.equal(count, 2);
            // Please note that getWindowCount() will return 2 if `dev tools` are opened.
        });
    
        it('Check if login box is present', async () => {
            const licenseInputBox = await app.client.$('#txtLicenseKey');
            return assert.ok(licenseInputBox);
        });
    });

Error message:

  1. Application launch Login into the application:
     **no such window: no such window: target window already closed
    from unknown error: web view not found**
     (Session info: chrome=87.0.4280.141)
      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.$ (node_modules/webdriverio/build/commands/browser/$.js:10:17)
      at async Browser.wrapCommandFn (node_modules/@wdio/utils/build/shim.js:63:29)
      at async Context.<anonymous> (test/index.js:44:33)

versions:
electron - 11.3.0
spectron - 13.0.0
mocha - 8.3.0

Aucun commentaire:

Enregistrer un commentaire