Hi I am new to webdriverio, I getting bellow error, Cannot read property 'then' of null TypeError: Cannot read property 'then' of null
Here is my code
it('Test case - User Add', () => {
browser.setTimeout({ implicit: 3111 })
userManagement.UserManagementMenu.click()
userManagement.NewUserButton.click()
userManagement.FirstName.setValue('EntryGate')
userManagement.Username.setValue('EGTestuser1')
userManagement.LastName.setValue('EGTestuser1')
userManagement.EmailAddress.setValue('EGTestuser1@test.com')
userManagement.Password.setValue('password1')
userManagement.Role.click().then(function(){
browser.keys('ArrowUp')
browser.keys('Enter')
})
userManagement.SaveUser.click()
});
});
following few google searches I figured out I am not handling the promise in my code.
can anybody correct my code
The then() method returns a Promise. It takes up to two arguments: callback functions for the success and failure cases of the Promise.
If you want to just perform click and some keyboard operation you can use below piece of code
it('some description', () => {
userManagement.Role.click();
browser.keys('ArrowUp');
browser.keys('Enter');
userManagement.SaveUser.click();
}