Fast authorization. Level— local storage.

Aliaksandr Rasolka
May 11, 2018 · 1 min read
Photo by Alex Holyoake on Unsplash

private void executeJavaScript(final String jsCode) {
((JavascriptExecutor) webDriver).executeScript(jsCode);
private void open(final String url) {
private void setItemInLocalStorage(final String item, final String value) {
final String jsCode = String.format(
public void authorizeWithLocalStorage(final AccessToken accessToken) {
setItemInLocalStorage("$accessTokenId", accessToken.getId());
setItemInLocalStorage("$currentUserId", accessToken.getUserId());

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade