0
我要檢查,如果「登錄頁面」的每一步之前出現:如何在JavaScript中重寫函數? casperjs然後功能
這裏是我的代碼:
casper.then(function() {
checkIfRedirectedToLoginPage();
this.evaluate(function() {
document.getElementById("").click();
});
});
casper.then(function() {
checkIfRedirectedToLoginPage();
this.evaluate(function() {
});
});
function checkIfRedirectedToLoginPage(){
if loginPage{
this.then(function(){
this.sendKeys(x('//*[@id="user_name"]'), USER_NAME);
this.sendKeys(x('//*[@id="password"]'),PASSWORD);
this.click(x(//*[@id="login"]));
});
}
}
它是如何可以覆蓋casper.then
沒有我的代碼充斥的checkIfRedirectedToLoginPage功能。謝謝