Hi everyone, I need to know if it is possible to clear the localStorage when using appium to test on the mobile browser ?
My test is:
'use strict'
var wd = require('wd'), assert = require('assert'), color = require('colors');
function error(err){
app.quit();
}
var phone = process.argv.slice(2).shift();
if(phone == undefined) {
console.log("Phone number not setted!".magenta);
return;
}
var app = wd.remote('localhost', 4723);
app.init({
browserName: 'Chrome',
deviceName: 'Android',
platformName: 'Android',
platformVersion: '4.3'
}, function(){
app.get("http://mcocaro.com.ar/labs", function(){
app.setImplicitWaitTimeout(5000);
// I need to clear the localStorage here! <---
app.elementsByCss('phone-input', function(err, els){
if(err) error(err);
else{
els[0].sendKeys(phone, function(err){
if(err) error(err);
else {
app.elementsByCss('js-send-code', function(err, els){
if(err) error(err);
else {
els[0].click(function(err){
if(err) error(err);
else {
app.setImplicitWaitTimeout(5000);
app.quit();
}
});
}
});
}
});
}
});
});
});
As I commented on the code, I need to clear the “localStorage” before setting the input phone number.
Is it possible @jonahss ?