Page tree
Skip to end of metadata
Go to start of metadata

Last updated: Oct 08, 2019 16:41

If you would like to clear the cache of mobile Safari with Visual Analysis automation:Visual analysis


JAVA: 

Capability
capabilities.setCapability("bundleId", "com.apple.Preferences");
VA commands to navigate in settings & clear cache
Map<String, Object> params = new HashMap<>();
params.put("label", "Safari");
params.put("threshold", 80);
params.put("scrolling", "scroll");
params.put("next", "SWIPE=(50%,70%),(50%,50%);WAIT=2000");
params.put("operation", "single");
driver.executeScript("mobile:button-text:click", params);

driver.manage().timeouts().implicitlyWait(15, TimeUnit.SECONDS);

Map<String, Object> params1 = new HashMap<>();
params1.put("label", "Clear History and Website Data");
params1.put("threshold", 80);
params1.put("scrolling", "scroll");
params1.put("next", "SWIPE=(50%,70%),(50%,50%);WAIT=2000");
params1.put("operation", "single");
driver.executeScript("mobile:button-text:click", params1);

Map<String, Object> params2 = new HashMap<>();
params2.put("label", "Clear History and Data");
params2.put("threshold", 80);
params2.put("operation", "single");
driver.executeScript("mobile:button-text:click", params2);

// Close Settings app
Map<String, Object> params3 = new HashMap<>();
params3.put("identifier", "com.apple.Preferences");
driver.executeScript("mobile:application:close", params3);

C#

var clickOnSafariSettings = new Dictionary<string, object>();
clickOnSafariSettings.Add("label", "Safari");
clickOnSafariSettings.Add("threshold", 80);
clickOnSafariSettings.Add("scrolling", "scroll");
clickOnSafariSettings.Add("next", "SWIPE=(50%,70%),(50%,50%);WAIT=2000");
clickOnSafariSettings.Add("operation", "single");
Driver.ExecuteScript("mobile:button-text:click", clickOnSafariSettings);

Driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(15);

var clickOnClearHistory = new Dictionary<string, object>();
clickOnClearHistory.Add("label", "Clear History and Website Data");
clickOnClearHistory.Add("threshold", 80);
clickOnClearHistory.Add("scrolling", "scroll");
clickOnClearHistory.Add("next", "SWIPE=(50%,70%),(50%,50%);WAIT=2000");
clickOnClearHistory.Add("operation", "single");
Driver.ExecuteScript("mobile:button-text:click", clickOnClearHistory);

var approveClearHistory = new Dictionary<string, object>();
approveClearHistory.Add("label", "Clear History and Data");
approveClearHistory.Add("threshold", 80);
approveClearHistory.Add("operation", "single");
Driver.ExecuteScript("mobile:button-text:click", approveClearHistory);