lundi 18 avril 2016

Test selecting checkboxes using webdriverio and javascript

I am trying to test selecting checkboxes using webdriverio along with mocha, and chai.

Below is what I tried in a javascript module pattern

select_checkbox: function(browser, key, value){
  return browser.isSelected(key, value, 'tab')
},

I am calling this method inside a promise.each loop and submitting the form

...
     return reagents_utils.select_checkbox(browser, "#id_category_0", "Instrument");
}).then(function(){
    browser.saveScreenshot('./snapshot.png');
}).then(function(){
  return reagents_utils.submit_form(browser);
});

Here is a snapshot of tests showing that the checkbox is not selected and hence the submission fails!

enter image description here

How can test selecting the checkbox next to Instrument using webdriverio and javascript? I made sure that I am referencing the correct selector (id).




Aucun commentaire:

Enregistrer un commentaire