0
我第一次使用CasperJS,我想在加載頁面之前添加一個cookie。我正在使用此代碼:如何從CasperJS訪問幻像對象?
casper.test.setUp(function() {
casper.echo('Cookies enabled?: ' + phantom.cookiesEnabled);
phantom.addCookie({
domain: '.localhost',
name: 'sessionId',
value: '12345abcd6789efg'
});
這個問題似乎與我的代碼中的phantom
。我得到以下錯誤:
TypeError: undefined is not a constructor
如何我可以定義phantom
?