How use --config with CasperJS

江枫思渺然 提交于 2019-12-06 06:29:40

This issue shows the inconsistencies:

--disk-cache => diskCacheEnabled
--load-images => autoLoadImages
--local-storage-path => offlineStoragePath
--local-storage-quota => offlineStorageDefaultQuota
--local-to-remote-url-access => localToRemoteUrlAccessEnabled
--web-security => webSecurityEnabled
--debug => printDebugMessages

But autoLoadImages is broken. I just verified that webSecurityEnabled works as expected.

PhantomJS version 1.9.7.


A workaround would be to include the following code in every test file:

if (casper.cli.has("config2")) {
    var config = require(casper.cli.get("config2"));
    casper.options.pageSettings.loadImages = config.autoLoadImages;
}

and call it with the other command line flag

casperjs --config=config.json --config2=config.json test.js
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!