question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Safari - iOS cookie handling doesn't find any secure cookies

See original GitHub issue

The problem

To reset the browser to a clean state in my tests, I often use the deleteAllCookies() method to clear the test’s state. With Appium and iOS, cookie handling appears to be limited to non secure cookies for the same domain. Even checking the number of cookies after calling deleteAllCookies() seems to leave several cookies on sites secured with HTTPS.

Running the same test with Appium and Android deletes all the cookies for the domain as expected.

Environment

  • Appium version (or git revision) that exhibits the issue: 1.53
  • Desktop OS/version used to run Appium: Mac OS X 10.11.6
  • Mobile platform/version under test: iOS 9.3
  • Real device or emulator/simulator: Both
  • Appium CLI or Appium.app|exe: Appium.app

Code To Reproduce Issue

Step through in debug mode - subsititue your own account details!

        driver.get("https://accounts.google.com/AccountChooser");
        driver.findElement(By.cssSelector("#Email")).sendKeys("youraccount@gmail.com");
        driver.findElement(By.cssSelector("input#next")).click();
        driver.findElement(By.cssSelector("#Passwd")).sendKeys("password");
        driver.findElement(By.cssSelector("input#signIn")).click();

        int clear = 0;
        int secure = 0;
        Set<Cookie> cookies = driver.manage().getCookies();
        for (Cookie cookie : cookies) {
            if(cookie.isSecure()) {
                secure++;
            } else {
                clear++;
            }
        }
        System.out.println("Found " + secure + " secure cookies");
        System.out.println("Found " + clear + " clear cookies");
        driver.manage().deleteAllCookies();
        driver.navigate().refresh();
        Set<Cookie> cookies1 = driver.manage().getCookies();
        System.out.println(cookies1.size() + " still found.";

Clone here

Appium Logs

Gist

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:1
  • Comments:8 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
jlippscommented, Sep 1, 2016

Thanks for the repro @hazmeister we’ll look into it.

0reactions
lock[bot]commented, Jul 9, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

Read more comments on GitHub >

github_iconTop Results From Across the Web

iOS11: Cookies intermittently bloc… | Apple Developer Forums
In iOS 11, cookies are not shared between Safari and each web apps, but it seems a web app sometimes uses cookies that...
Read more >
Safari not sending cookie even after setting SameSite=None
Safari is no longer sending cross-site cookies. So even if the cookie is set to SameSite=None it will not be sent with the...
Read more >
Enable Cookies in Safari on iPhone - WhatIsMyBrowser.com
Most websites need cookies enabled to work properly, so check out our guide to configuring cookies and permissions on Safari on iPhone.
Read more >
Enable Cookies on iPhone: Safari, Chrome, and Firefox
In the Privacy & Security section, make sure Block All Cookies is toggled off. You will know it is off when the slider...
Read more >
How to enable cookies - Rocky Mountain Power
HOW TO ENABLE COOKIES. Google Chrome. Safari iOS (iPhone and iPad) ... Step 3: Under “Privacy and security”, click “Site Settings”. Step 4:...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found