Hello everybody,
I am trying to fill combobox, but it doesn't work.
I tried with filling like all other fields in form, but it throws error - no such css selector (but it is there).
After that I tried the other way, it pass, but value combobox is not selected.
My script is below.
My second question is about data driven testing - how can I read data from csv(or xml) file, and use this data for filling form?
Can anybody, please, help me?
casper.start('
http://localhost:8080/StudentskiRadoviEE-war/faces/UnosStudenta.xhtml', function() {
this.fillSelectors('form#frmUnosSTudenta', {
'input[name="frmUnosSTudenta:txtImeStudenta"]': 'Milana',
'input[name="frmUnosSTudenta:txtPrezimeStudenta"]': 'Mihajlovic',
'input[name="frmUnosSTudenta:txtBrojIndeksa"]': '21/11',
'input[name="frmUnosSTudenta:txtGodinaStudija"]': '3',
//COMBOBOX 1st TRY
// 'input[name="frmUnosSTudenta:cbNivoiStudija"]': '2',
}, true);
this.evaluate(function() {
//COMBOBOX 2nd TRY
document.querySelector('name="frmUnosSTudenta:cbNivoiStudija"').selectedIndex = 2;
// COMBOBOX 3rd TRY
//document.querySelector({
// type:'xpath',
//path:'.//*[@id="frmUnosSTudenta:cbNivoiStudija_panel"]',
// }).selectedIndex = 2;
return true;
});
this.wait(5000);
this.capture('screenshot.png');
this.click({
type:'xpath',
path:'.//*[@id="frmUnosSTudenta:btnSacuvaj"]',
});
this.echo('success', 'INFO');
});
casper.run(function() {
});