# selenium-chrome-clear-cache

> 🗑 Clear cache of Chrome in Selenium

Latest version **1.2.4** (published 2020-11-24) · MIT license · 0 weekly downloads

## Install

```sh
npm install selenium-chrome-clear-cache
pnpm add selenium-chrome-clear-cache
yarn add selenium-chrome-clear-cache
bun add selenium-chrome-clear-cache
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.2.4 |
| Published | 2020-11-24 |
| First published | 2018-06-12 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 6.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | omrilotan |
| Maintainers | omrilotan |
| Keywords | selenium, chrome, cache, clear, automation, browser, webdriver, cookies, history |

## Links

- npm: https://www.npmjs.com/package/selenium-chrome-clear-cache
- Repository: https://github.com/omrilotan/selenium-chrome-clear-cache
- Homepage: https://omrilotan.com/selenium-chrome-clear-cache/
- Issues: https://github.com/omrilotan/selenium-chrome-clear-cache/issues
- npm.io page: https://npm.io/package/selenium-chrome-clear-cache

## Alternatives

- [memory-cache](https://npm.io/package/memory-cache.md) — 795.0K weekly downloads
- [@httptoolkit/proxy-agent](https://npm.io/package/@httptoolkit/proxy-agent.md) — 11.2K weekly downloads
- [express-cache-controller](https://npm.io/package/express-cache-controller.md) — 5.3K weekly downloads
- [http-cache-middleware](https://npm.io/package/http-cache-middleware.md) — 4.5K weekly downloads
- [cache2](https://npm.io/package/cache2.md) — 1.5K weekly downloads

## Recent versions

- 1.2.4 (latest) — 2020-11-24
- 1.2.3 — 2020-11-22
- 1.2.2 — 2019-07-30
- 1.2.1 — 2019-01-30
- 1.2.0 — 2019-01-30
- 1.1.3 — 2018-11-05
- 1.1.2 — 2018-10-29
- 1.1.1 — 2018-07-27
- 1.1.0 — 2018-06-20
- 1.0.1 — 2018-06-12
- 1.0.0 — 2018-06-12

## README

# selenium-chrome-clear-cache [![](https://img.shields.io/npm/v/selenium-chrome-clear-cache.svg)](https://www.npmjs.com/package/selenium-chrome-clear-cache) [![](https://img.shields.io/badge/source--000000.svg?logo=github&style=social)](https://github.com/omrilotan/selenium-chrome-clear-cache)

## 🗑 Clear cache of a chrome browser in a Selenium flow

![](https://user-images.githubusercontent.com/516342/41310034-027fbc12-6e89-11e8-95b2-8506b7cd05bc.gif)

```js
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](http://chromedriver.storage.googleapis.com/index.html)


## 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

| name | default
| - | -
| cookies | false
| cache | true
| history | true

```js
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](https://user-images.githubusercontent.com/516342/41311395-d200f8e0-6e8c-11e8-89ac-1e76c4ff283d.png)

---
_Source: https://npm.io/package/selenium-chrome-clear-cache · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
