Silk Mobile

Table of Contents (Homepage)

HybridClearCache

HybridClearCache( ClearCookies, ClearCache )

images/images/os-icons/os_android_150x150.png

images/images/os-icons/os_windows_150x150.png

Description

Clears the browser cookies and/or the cache, according the values set for the parameters.

  • This command supports only chrome browser version 4.4 and above.

Parameters

  • ClearCookies - Boolean. Cookies will be cleared when set to "true".

  • ClearCache - Boolean. Cache will be cleared when set to "true".

Usage

Command usage: The 'HybridClearCache' command clears the browser cookies and/or the cache.

Scenario: In the following example, we will use the ' HybridClearCache' command to delete the cookies and cache on the Wikipedia web page.

images/download/attachments/3310098/6.jpg

Parameters:

  • ClearCookies: Boolean. Cookies will be cleared when set to "true".

  • ClearCache: Boolean. Cache will be cleared when set to "true"

In this example – both parameters will be set to 'true'

Step 1: Launch chrome:www.wikipedia.com on android device (Nexus 7).

images/download/attachments/3310098/7.jpg

Step 2: We will use the 'HybridClearCache' command to clear both cookies and cache. The command will open the 'Settings' menu of the browser, and navigate to the privacy settings in order to delete the cache and cookies, as can be seen in the attached screenshots.

images/download/attachments/3310098/8.jpg images/download/attachments/3310098/9.jpg

Code Examples

Java Example
client.setDevice("adb:Nexus7");
client.launch("chrome:http://www.wikipedia.com", true, false);
client.hybridClearCache(true, true);
C# Example
client.SetDevice("adb:Nexus7");
client.Launch("chrome:http://www.wikipedia.com", true, false);
client.HybridClearCache(true, true);
VBScript Example
client.SetDevice "adb:Nexus7"
Report
client.Launch "chrome:http://www.wikipedia.com", true, false
Report
client.HybridClearCache true, true
Report
Python Example
self.client.setDevice("adb:Nexus7")
self.client.launch("chrome:http://www.wikipedia.com", True, False)
self.client.hybridClearCache(True, True)
Perl Example
$client->setDevice("adb:Nexus7");
$client->launch("chrome:http://www.wikipedia.com", 1, 0);
$client->hybridClearCache(1, 1);