Stanislav Pyshevskyi
Stanislav Pyshevskyi

Reputation: 1071

Angular 2 - protractor(e2e) runtime error

When I run protractor I get this error

[15:47:46] E/launcher - Error: TSError: ? Unable to compile TypeScript
Conflicting library definitions for 'selenium-webdriver' found at 'G:/WebServers/home/smsc/SMSC2/modules/admin/node_modules/@types/selenium-webdriver/index.d.ts' and 'G:/WebServers/home/smsc/SMSC2/modules/admin
/node_modules/protractor/node_modules/@types/selenium-webdriver/index.d.ts'. Copy the correct file to the 'typings' folder to resolve this conflict. (4090)

I rebuild and reinstall protractor, but nothing. I use this command to run protractor

npm run protractor

I read tutorial for protractor and write test like here enter link description here.

describe('angularjs homepage todo list', function() {
    it('should add a todo', function() {
        browser.get('http://some-link/');

        console.log('Hi!');
    });
})

Protractor work fine with this example, but not with typescript. What do?

Upvotes: 1

Views: 423

Answers (1)

Andrew Eisenberg
Andrew Eisenberg

Reputation: 28737

The error message describes the problem:

Conflicting library definitions for 'selenium-webdriver' found at 'G:/WebServers/home/smsc/SMSC2/modules/admin/node_modules/@types/selenium-webdriver/index.d.ts' and 'G:/WebServers/home/smsc/SMSC2/modules/admin /node_modules/protractor/node_modules/@types/selenium-webdriver/index.d.ts'. Copy the correct file to the 'typings' folder to resolve this conflict. (4090)

You have two instances of the selenium-webdriver typings file. Typings files are used by Typescript to help with static type checking of applications that use vanilla JS libraries.

In this case, the @types/selenium-webdriver/index.d.ts file describes the type shape of the exported members of selenium (used internally by protractor).

What you need to do is determine which version of the typings you want to use.

G:/WebServers/home/smsc/SMSC2/modules/admin/node_modules/@types/selenium-webdriver/index.d.ts
G:/WebServers/home/smsc/SMSC2/modules/admin/node_modules/protractor/node_modules/@types/selenium-webdriver/index.d.ts

It's likely that these are the same file, just in two locations. Just move one of them to your project's typings location here:

 G:/WebServers/home/smsc/SMSC2/modules/typings/selenium-webdriver/index.d.ts

And looking a bit deeper at this, I would almost think this is a bug with protractor.

Upvotes: 1

Related Questions