简体   繁体   中英

How to store local storage data using Protractor?

我已经看到很多用于获取已存储数据的示例,但没有获取任何获取存储值的示例。

You can access localStorage through browser.executeScript() this way:

Get value

var value = browser.executeScript("return window.localStorage.getItem('myKey');");

Set value

browser.executeScript("window.localStorage.setItem('myKey', 'myValue');");

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM