The type "By" has no common properties with the type "Locator"

I have a problem, when I try to rebuild my project, I get the following error:

Type 'By' has no properties in common with type 'Locator'


enter image description here


Can someone please point me in the right direction?

+7
source share
3 answers

This is a bug in Protractor 4.x / Webdriver. The method elementexpects, Locatorbut by.cssreturns an object webdriver.by. To fix this compilation error, you need to attribute it to Locatorhow:

import { Locator } from 'protractor/built/locators';
...
element(<Locator>by.css('h1'))
+8
source

Verify that TypeScript "TypeScript 2.2" is installed. You should not get an error if you are using "TypeScript 2.2".

0
source

@bjorkblom, thanks. Your lines helped a lot.

0
source

Source: https://habr.com/ru/post/1683670/


All Articles