Socket
Socket
Sign inDemoInstall

selenium-chrome-clear-cache

Package Overview
Dependencies
19
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    selenium-chrome-clear-cache

🗑 Clear cache of Chrome in Selenium


Version published
Weekly downloads
10
decreased by-28.57%
Maintainers
1
Created
Weekly downloads
 

Readme

Source

selenium-chrome-clear-cache

🗑 Clear cache of a chrome browser in a Selenium flow

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

Keywords

FAQs

Last updated on 24 Nov 2020

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc