css selectors - How to navigate through html tab with casperjs -



css selectors - How to navigate through html tab with casperjs -

i need experience in casperjs! trying access web page (which not issue) , navigate through html tab. when access page default showing first tab "general" need switch "options" tab can access 1 field interested modify value!

sorry, can't post images yet!

html code:

<b>&nbsp;<b> <table class="commonfont" cellpadding="0" cellspacing="0" background="/tab_between.png" border="0"> <tbody> <tr> <td><input name="" src="/tab_sel_left.png" border="0" type="image"></td> <td align="center" background="/tab_sel_bg.png"> &nbsp; <a href="javascript:document.forms[0].tabindex.value='1'-1;document.forms[0].methodcalled.value='gototabchange';dosubmit();" tabindex="4" class="menu1itemsel">general</a> &nbsp; </td> <td><input name="" src="/tab_sel_right.png" border="0" type="image"></td> <td width="1"></td> <td><input name="" src="/tab_unsel_left.png" border="0" type="image"></td> <td align="center" background="/tab_unsel_bg.png"> &nbsp; <a href="javascript:document.forms[0].tabindex.value='2'-1;document.forms[0].methodcalled.value='gototabchange';dosubmit();" tabindex="4" class="menu1itemunsel">options</a> &nbsp;</td> <td><input name="" src="/tab_unsel_right.png" border="0" type="image"></td> <td width="1"></td> </tr> </tbody> </table> ... </b></b>

my casper.js file looks this:

... casper.then(function() { test.asserttextexists("db", "login db 2"); this.click('a#changethis1_link'); }); casper.then(function() { test.asserttextexists("options", "db options"); this.click('a#menu1itemunsel[tabindex="4"]'); }); casper.then(function() { test.asserttextexists("change", "db -change -step 1/2"); this.fill('form[name="dbactionform"]', { 'generalparams.poolsize': '1', }, false); this.click('input[name="apply"]'); }); ...

i can't figure out should line like:

this.click('a#menu1itemunsel[tabindex="4"]');

since isn't working!!!

execution printout:

modifying db pool size: test file: /target.js # db modify pass db has right title pass login form found pass login db pass login db 1 pass login db 2 pass db options fail cannot dispatch mousedown event on nonexistent selector: a#menu1itemunsel[tabindex="4"] # type: uncaughterror # error: cannot dispatch mousedown event on nonexistent selector: a#menu1itemunsel[tabindex="4"] # caspererror: cannot dispatch mousedown event on nonexistent selector: a#menu1itemunsel[tabindex="4"] # @ mouseevent (/casper.js:1323) # @ click (/casper.js:428) # @ /target.js:34 # @ runstep (/casper.js:1523) # @ checkstep (/casper.js:368) # stack: not provided

any clue doing wrong , how can overcome issue?

thanks time

some updates , more information:

after fanch information, changed casperjs to:

... casper.then(function() { test.asserttextexists("db", "login db 2"); this.click('a#changethis1_link'); });

casper.then(function() { test.asserttextexists("options", "db options"); this.click('a.menu1itemunsel[tabindex="4"]'); }); casper.then(function() { test.asserttextexists("change", "db -change -step 1/2"); this.fill('form[name="dbactionform"]', { 'generalparams.poolsize': '1', }, false); this.click('input[name="apply"]'); });

...

this a.menu1itemunsel[tabindex="4"] solved error changing tab still have issue reading/changing field generalparams.poolsize.

i added waitforselector/waitfortext still error: errors encountered while filling form: form not found

see casperjs:

... casper.then(function() { test.asserttextexists("options", "db options"); this.click('a.menu1itemunsel[tabindex="4"]'); }); casper.waitforselector("a#dve_menu_datarepositories", function() { this.echo("1.loading form"); }); casper.waitfortext("50", function() { //the field want alter has text '50' this.echo("2.loading form"); }); casper.then(function() { test.asserttextexists("change", "db -change -step 1/2"); this.fill('form[name="dbactionform"]', { 'generalparams.poolsize': '1', }, false); this.click('input[name="apply"]'); }); ...

thanks again

sorry away while, here html part of page:

<a name="topofpage"> <form autocomplete="off" enctype="application/x-www-form-urlencoded" action="/db.do" method="post" name="dbactionform"> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tbody> <tr> <td> <table width="100%" height="100%" border="0" cellspacing="0" cellpadding="0"> <tbody> <tr height="100%"> <td valign="top" height="100%"></td> <td valign="top" height="100%" background="/menu3_sel_right1.png"></td> <td class="commonfont" width="100%" valign="top" background="/menu3_sel_right1.png" align="left"> <b> <b> <table class="commonfont" border="0" cellspacing="0" cellpadding="0" onkeypress="return onwizardpagekeypress(event);"> <tbody> <tr id="generalparams.poolsize_tr" class="formpagefieldname" style="display:table-row;"> <td> <a id="generalparams.poolsize_changea" style="visibility:hidden;" title="undo change" onclick="revertsinglechange('generalparams.poolsize', false); dependantsrunonload(document.body); homecoming false;" href="javascript:;"></a> </td> <td> <input type="text" onblur="if (!this.disabled) {onchangeproperty(this, false);} " onpropertychanged="if (!this.disabled) {onchangeproperty(this, false);} " onkeyup="if (!this.disabled) { onchangeproperty(this, false); }" tabindex="2" title="10" size="30" value="50" name="generalparams.poolsize"></input> </td> </tr> </tbody> </table> </b> </b>

i still have problem filling in form!

fail errors encountered while filling form: form not found # type: uncaughterror # error: errors encountered while filling form: form not found

any clue more?

thanks time!!!

use :

this.click('a.menu1itemunsel[tabindex="4"]');

-> # = div, . = class

html css-selectors casperjs

Comments

Popular posts from this blog

php - Android app custom user registration and login with cookie using facebook sdk -

django - Access session in user model .save() -

php - .htaccess Multiple Rewrite Rules / Prioritizing -