1.2.4 • Published 3 years ago

selenium-chrome-clear-cache v1.2.4

Weekly downloads
30
License
MIT
Repository
github
Last release
3 years ago

selenium-chrome-clear-cache npm.io npm.io

🗑 Clear cache of a chrome browser in a Selenium flow

npm.io

const webdriver = require('selenium-webdriver');
const driver = await new Builder().forBrowser('chrome').build();
const clearCache = require('selenium-chrome-clear-cache');

await driver.get('http://www.website.com/login');
await driver.findElement(By.name('username')).sendKeys('admin');
await driver.findElement(By.name('password')).sendKeys('4dM!n', Key.RETURN);
// Web page redirects us
await driver.wait(until.urlIs('http://www.website.com/'), 1000);

await clearCache({webdriver, driver});

await driver.get('http://www.website.com/');
// Gather logged in performance metrics

Uses chrome driver. Get one

Behaviour and Options

The default behaviour clears the cache and history from the last hour. Options can be applied (in form of named arguments) to configure what the browser should clear

namedefault
cookiesfalse
cachetrue
historytrue
await clearCache({webdriver, driver}, {cookies: true}); // Also clears the cookies

await clearCache({webdriver, driver}, {history: false}); // Do not clear the history

Measuring page performance example

image

1.2.4

3 years ago

1.2.3

3 years ago

1.2.2

5 years ago

1.2.1

5 years ago

1.2.0

5 years ago

1.1.3

6 years ago

1.1.2

6 years ago

1.1.1

6 years ago

1.1.0

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago

0.1.0

6 years ago