rshf / chromedriver

Automatically exported from code.google.com/p/chromedriver
2 stars 1 forks source link

Selenium Freeze and skip actions when navigating after cleaning cache/cookies/history in chrome. #751

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Hi,

I'm cleaning chrome cookies using selenium navigation. (I'm doing it between 
tests to save the time of re-opening the browser).
If I try browsing to a URL after the cleaning, selenium will do nothing.

What steps will reproduce the problem?
        public static void Main(string[] args)
        {
            #region Create browser inastance.

            const string c_chromeAdvancedSettings = "chrome://settings/clearBrowserData";
            const string chromeDriverDir = @"D:\Auto\Config\Lib\";
            ChromeOptions o = new ChromeOptions();
            o.AddArgument("--lang=en");

            var m_driver = new ChromeDriver(chromeDriverDir, o);
            m_driver.Navigate().GoToUrl(c_chromeAdvancedSettings);

            #endregion

            #region Clear cookies / hostory / whatever.

            var frame = m_driver.FindElement(By.XPath("//iframe[@src='chrome://settings-frame/clearBrowserData']"));
            var framedriver = m_driver.SwitchTo().Frame(frame);
            var dropDown = new SelectElement(framedriver.FindElement(By.Id("clear-browser-data-time-period")));
            dropDown.SelectByIndex(4);
            var elm = m_driver.FindElement(By.Id("delete-passwords-checkbox"));
            if (!elm.Selected) elm.Click();
            elm = m_driver.FindElement(By.Id("delete-form-data-checkbox"));
            if (!elm.Selected) elm.Click();
            elm = m_driver.FindElement(By.Id("delete-hosted-apps-data-checkbox"));
            if (!elm.Selected) elm.Click();
            elm = m_driver.FindElement(By.Id("deauthorize-content-licenses-checkbox"));
            if (!elm.Selected) elm.Click();
            elm = m_driver.FindElement(By.XPath("//button[@id='clear-browser-data-commit']"));
            elm.Click();

            #endregion

            WebDriverWait waiter = new WebDriverWait(m_driver, TimeSpan.FromSeconds(5));
            waiter.Until(wd => wd.Url.StartsWith("chrome://settings"));

            #region Navigate

            m_driver.Navigate().GoToUrl("http://www.google.com");

            #endregion
        }

Expected output: chrome will navigate the the given URL.
What happens instead: Nothing happens and the program freezes.

Selenium version: 2.41
OS: windows 7 64 bit
Browser: Chrome
Browser version: 33.0.1750.154 m
chrome driver version: 2.6.233026

Additional information:
1. If I'll put 5 seconds delay before the navigation the problem won't happen.

Original issue reported on code.google.com by n...@gigya-inc.com on 1 Apr 2014 at 9:16

GoogleCodeExporter commented 9 years ago
Try chromeDriver 2.9
http://chromedriver.storage.googleapis.com/index.html?path=2.9/

Original comment by ilovegir...@gmail.com on 2 Apr 2014 at 9:11

GoogleCodeExporter commented 9 years ago
nirh@,
Have you tried with chromedriver 2.9?
Chromedriver 2.6.233026 is too old now.

Original comment by st...@chromium.org on 3 Apr 2014 at 4:50

GoogleCodeExporter commented 9 years ago

Original comment by samu...@chromium.org on 21 Feb 2015 at 12:18

GoogleCodeExporter commented 9 years ago
Issue is not reproducible with chromedriver2.41, chrome:v41, Windows 7

Updated expected condition to wait till 'Clear browsing data' button is not 
visible

Sample Java code:
System.setProperty("webdriver.chrome.driver","drivers/chromedriver.exe");

ChromeOptions ops = new ChromeOptions();
ops.addArguments("--lang=en");
WebDriver driver = new ChromeDriver(ops);
driver.manage().timeouts().implicitlyWait(1, TimeUnit.MINUTES);
driver.get("chrome://settings/clearBrowserData");

driver.switchTo().frame(driver.findElement(By.xpath("//iframe[@src='chrome://set
tings-frame/clearBrowserData']")));
Select sele = new 
Select(driver.findElement(By.id("clear-browser-data-time-period")));
sele.selectByIndex(1);

WebElement elm = driver.findElement(By.id("delete-passwords-checkbox"));
if (!elm.isSelected()) elm.click();

elm = driver.findElement(By.id("delete-form-data-checkbox"));
if (!elm.isSelected()) elm.click();

elm = driver.findElement(By.id("delete-hosted-apps-data-checkbox"));
if (!elm.isSelected()) elm.click();

elm = driver.findElement(By.id("deauthorize-content-licenses-checkbox"));
if (!elm.isSelected()) elm.click();

elm = driver.findElement(By.xpath("//button[@id='clear-browser-data-commit']"));
elm.click();

WebDriverWait wait= new WebDriverWait(driver,60);
wait.until(ExpectedConditions.not(ExpectedConditions.visibilityOf(elm)));

driver.navigate().to("http://www.google.com");

Original comment by ssudunag...@chromium.org on 27 Mar 2015 at 5:50

GoogleCodeExporter commented 9 years ago
Please try with latest versions and let us know if the issue is still 
reproducible.

Original comment by ssudunag...@chromium.org on 30 Mar 2015 at 5:54