2014-09-22 52 views

回答

1

the docs採取(幾乎直接),assertUrlMatch似乎是正確的選擇;

casper.test.begin('assertUrlMatch() tests', 1, function(test) { 
    casper.start('https://www.google.com/', function() { 
     test.assertUrlMatch(/^https:\/\//, 'google.com is served in https://'); 
    }).run(function() { 
     test.done(); 
    }); 
}); 
+1

當重定向到http頁時,這個斷言甚至會正確地失敗。請記住,只有在最後一頁至少已經開始加載時才能調用此斷言。它不應該用在'waitForResource'回調中。 – 2014-09-22 15:36:59