2013-07-24 27 views
1

我想放棄的頁面: http://fd1-www.leclercdrive.fr/057701/courses/pgeWMEL009_Courses.aspx#RS284323CasperJS:如何調用__doPostBack

但是你可以看到這個鏈接重定向到 fd1-www.leclercdrive.fr/057701/courses/pgeWMEL009_Courses.aspx 當你第一次訪問它。點擊「fruits etlégumes」後,你可以直接使用url訪問頁面

所以我需要模擬點擊「Fruits etlégumes」按鈕來訪問我想要的頁面。在代碼中,它確實dopostback

這裏是我的代碼,我用casperj的使用:

var casper = require('casper').create({ 
verbose: true, 
logLevel: "debug" 
}); 


casper.start('http://fd1-www.leclercdrive.fr/057701/courses/pgeWMEL009_Courses.aspx#RS284323'); 

// here i simulate the click on "Fruits et légumes" 
casper.evaluate(function() { 
    __doPostBack('objLienReceptdionEvenement','[email protected]@284323'); 
}); 


casper.then(function() { 
console.log(' new location is ' + this.getCurrentUrl()); 
}); 

casper.run(); 

我還是被重定向到錯誤頁面

回答

1

到__doPostBack調用不正確(額外的'objLienReceptdionEvenement' 'd')

應該

// here i simulate the click on "Fruits et légumes" 
casper.evaluate(function() { 
    __doPostBack('objLienReceptionEvenement','[email protected]@284323'); 
}) 
+0

日是不是爲我工作。 OP,你能用這個例子嗎?我有同樣的問題,無法理解發生了什麼事情https://stackoverflow.com/questions/25107976/cannot-navigate-with-casperjs-evaluate-and-dopostback-function – rowasc