phantomjs - Casperjs switch MainFrame to a new tab -
i'm using casperjs navigate site, i'm having problem login process:
in site, when login, browser switched new tab , login form reset blank, i'm seeing new tab info need beingness requested in navigation debug, this:
[debug] [phantom] navigation requested: url=www.thesite.com, type=formsubmitted, willnavigate=true, ismainframe=false
i've noticed ismainframe = false , i've tried switch frame methods switchtochildframe, casper.withframe() or casper.withpopup(), i've failed.
is there way can retrieve , interact content of request?
my code far:
casper.start('www.thesite.com', function() { casper.useragent('mozilla/5.0 (macintosh; intel mac os x)'); this.wait(2000); casper.withframe('centro', function() { this.fillselectors('form[name="teclado"]', { 'input[name="idgroup"]': 'aaa', 'input[name="iduser"]': 'bbb', 'input[name="password"]': 'ccc' }, false); //this capture retrieves form filled info this.capture('../../../1.png'); this.click("a[onclick='enviar();return true;']"); }); }); casper.withframe( 0, function(){ //2.png getting form blank fields this.capture('../../../2.png'); });
thanks in advance.
ok solved issue
the problem wrote withpopup code badly
i wrote regex match popup url strict putting of url expected:
casper.withpopup(/estatico\/becomponentesgeneralesaccesosei\/html\/login.htm/, function() {
this works ok me:
casper.withpopup(/true$/, function() { this.capture('../../../2.png'); });
phantomjs casperjs
No comments:
Post a Comment