0

Trying nodejs and webdriverio first time. This seems to be pretty simple stuff when tried in watir-webdriver or selenium-webdriver gems,but this is confusing me in webdriverio. Why I am getting this error when the driver is already finding the element and setting the value

var webdriverio = require('webdriverio');
var options = {
desiredCapabilities: {
browserName: 'firefox'
}
};
var client=webdriverio.remote(options);

client
.init()
.url('http://www.twitter.com').title(function(err, res) {
console.log('Title was: ' + res.value);
})
.isExisting('#signin-password')
.then(function(isExisting){
    console.log(isExisting);
})
.setValue('#signin-password','password')
.then(function(){
    console.log("password set");
})
.isExisting('#signin-email')
.then(function(isExisting){
    console.log("email"+isExisting);
})
.setValue('#signin-email','username')
.then(function(){
    console.log("username set");
});

The error I am getting is

Title was: Welcome to Twitter - Login or Sign up
true
RuntimeError: Element is not currently visible and so may not be interacted with
Build info: version: '2.47.1', revision: '411b314', time: '2015-07-30 03:03:16'
System info: host: 'DTNBNAUD10806XS', ip: '10.36.179.144', os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.8.0_05'
Driver info: driver.version: unknown
    at elementIdValue("1", "password") -     at C:\Development\node_modules\webdriverio\lib\commands\setValue.js:52:7

2 Answers 2

2

If you use isExisting you will only get a boolean value in return. To add a little more stability to the test I recommend you use waitForExist or waitForVisible in the case that the DOM is still loading

Sign up to request clarification or add additional context in comments.

Comments

0

Probably because the element exists on the web page, but is not visible.

Instead of isExisting, use isVisible.

Another reason could be that you have more than one element that the selector #signin-password finds, and the first element that is found is not visible. I'm not saying this is your issue, but this happened to me on some occasions.

You could try to use a more detailed selector like #myForm #signin-password to make sure you are attempting to set the value to the correct element.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.