Click here to Skip to main content
16,022,309 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello guys i want to clear all my google webdriver
and i need help

i don't want to use
driver.Manage().Cookies.DeleteAllCookies();


i want this or others method which is work

driver.Navigate().GoToUrl("chrome://settings/clearBrowserData");
    driver.FindElement(By.XPath("//*[@id='clearBrowsingDataConfirm']"")).SendKeys(OpenQA.Selenium.Keys.Enter);


but its not working

What I have tried:

thanks for your helps <3........................
Posted

1 solution

Found the solution


IWebElement clear = driver.FindElement(By.TagName("body"));
                    if (clear.Text.Contains("Clear browsing data"))
                    {

                        clear.SendKeys(OpenQA.Selenium.Keys.Tab);
                        Thread.Sleep(500);
                        clear.SendKeys(OpenQA.Selenium.Keys.Tab);
                        Thread.Sleep(500);
                        clear.SendKeys(OpenQA.Selenium.Keys.Tab);
                        Thread.Sleep(500);
                        clear.SendKeys(OpenQA.Selenium.Keys.Tab);
                        Thread.Sleep(500);
                        clear.SendKeys(OpenQA.Selenium.Keys.Tab);
                        Thread.Sleep(500);
                        clear.SendKeys(OpenQA.Selenium.Keys.Tab);
                        Thread.Sleep(500);
                clear.SendKeys(OpenQA.Selenium.Keys.Tab + OpenQA.Selenium.Keys.Enter);
                        Thread.Sleep(500);
                    }
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900