使用Casperjs清除本地存储 [英] Clear localstorage with Casperjs
问题描述
我正在使用casperjs进行一些使用localstorage的ribsjs应用程序的测试.
I'm using casperjs to do some testings of a backbonejs application using localstorage.
我的问题是,在使用casperjs进行测试时,我无法清除本地存储.
My problem is that I can not clear the localstorage when testing with casperjs.
我一直在尝试在casper文件的开头使用localStorage.clear();
,但是没有清除任何内容.
I have been trying to use localStorage.clear();
at the beginning of my casper file but nothing is cleared.
推荐答案
我通过删除以下目录之一中的文件* .localstorage找到了解决此问题的方法:
I found workaround for this problem by deleting file *.localstorage in one of the following directories:
Windows c:\ Users \ YOUR_USER \ AppData \ Local \ Ofi Labs \ PhantomJS \
Windows c:\Users\YOUR_USER\AppData\Local\Ofi Labs\PhantomJS\
Mac OS X: /Users/您的用户/库/应用程序支持/Ofi Labs/PhantomJS
Mac OS X: /Users/YOUR_USER/Library/Application Support/Ofi Labs/PhantomJS
Linux: /home/YOUR_USER/.local/share/data/Ofi Labs/PhantomJS
Linux: /home/YOUR_USER/.local/share/data/Ofi Labs/PhantomJS
这篇关于使用Casperjs清除本地存储的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!