Search code examples
typescriptunit-testingtypeerrorwebdriver-ioui-testing

"browser.setValue()" TypeError while using WebDriver.IO in Typescript


I am trying to test Google login authentication in Typescript like this:

it('should let you log in', () => {
        browser.url('https://www.some-website.com/');
        browser.setValue('input[name="email"]', 'some.email@domain.com');
        browser.keys('\uE007'); 
        browser.setValue('input[name="password"]', 'password!');
        browser.keys('\uE007'); 
    });

But I'm getting the following TypeError:

TypeError: browser.setValue is not a function

setValue() is indeed a function of browser. I double-checked the WebDriver.IO docs to confirm this. Perhaps I'm using it wrong in Typescript


Solution

  • What version of WDIO are you on? This is the syntax from v4 -- in v7 you'd want to do $('input[name="email"]').setValue('some.email@domain.com') or something.