Skip to content
This repository was archived by the owner on Nov 29, 2018. It is now read-only.

deleteAllVisibleCookies fails if a cookie name contains % character #441

Closed
lukeis opened this issue Mar 2, 2016 · 12 comments
Closed

deleteAllVisibleCookies fails if a cookie name contains % character #441

lukeis opened this issue Mar 2, 2016 · 12 comments

Comments

@lukeis
Copy link
Member

lukeis commented Mar 2, 2016

Originally reported on Google Code with ID 441

What steps will reproduce the problem?
1.Create a cookie like "MAX%5SIZE" (possible via classic ASP : 
http://forums.asp.net/t/1356328.aspx)
2.Create a selenium Test that contains just a "deleteAllVisibleCookies" 
command.
3.The test will fail with the following error : [error] Couldn't delete 
cookie MAX_SIZE

What is the expected output? What do you see instead?
I wish Selenium could at least continue and delete the other Cookies 
instead of deleting none of the cookies (even those with a regular name).

What version of the product are you using? On what operating system?
Selenium IDE 1.0.6, Firefox 3.6.2, Windows XP

Please provide any additional information below.

Reported by gjactat on 2010-03-31 08:17:37

@lukeis
Copy link
Member Author

lukeis commented Mar 2, 2016

I'have the same exception:

com.thoughtworks.selenium.SeleniumException: ERROR: Couldn't delete cookie __noteCook
    at 
com.thoughtworks.selenium.HttpCommandProcessor.throwAssertionFailureExceptionOrError(
HttpCommandProcessor.java:97)
    at 
com.thoughtworks.selenium.HttpCommandProcessor.doCommand(HttpCommandProcessor.java:91
)
    at 
com.thoughtworks.selenium.DefaultSelenium.deleteAllVisibleCookies(DefaultSelenium.jav
a:663)
    at 
ru.selftrip.crawler.SeleniumCrawler.deleteAllVisibleCookies(SeleniumCrawler.java:552)
    at 
ru.selftrip.crawler.impl.AirBalticDailyCrawler.getFlights(AirBalticDailyCrawler.java:
27)
    at ru.selftrip.crawler.ScheduledCrawler.crawl(ScheduledCrawler.java:68)
    at ru.selftrip.crawler.CrawlerApp.main(CrawlerApp.java:53)

Reported by Dmitry.Bedrin on 2010-04-20 16:53:46

@lukeis
Copy link
Member Author

lukeis commented Mar 2, 2016

Same problem here too, running via the IDE: [error] Couldn't delete cookie __utma 

Reported by mrpjones on 2010-07-29 11:07:46

@lukeis
Copy link
Member Author

lukeis commented Mar 2, 2016

I got this issue both IDE(1.0.8) and RC(2.0a7)
as the selenium RC server's log:
----------
13:42:11.701 INFO - Command request: deleteAllVisibleCookies[, ] on session b85cc414d7fa47f88e61ecd4be4ff438
13:42:11.739 INFO - Got result: OK on session b85cc414d7fa47f88e61ecd4be4ff438
----------
But actually ,it doesn't work.

Reported by jollychang on 2010-12-13 06:24:45

@lukeis
Copy link
Member Author

lukeis commented Mar 2, 2016

Is this an issue in the latest release?

Reported by antlong on 2011-01-24 18:23:30

  • Labels added: Usability

@lukeis
Copy link
Member Author

lukeis commented Mar 2, 2016

Reported by antlong on 2011-01-24 18:24:00

  • Labels added: Component-IDE

@lukeis
Copy link
Member Author

lukeis commented Mar 2, 2016

I need a publicly availably site that triggers this -- otherwise I'm going to close
it. I don't doubt the possibility of a bug in the cookie code, but without a test case
it is non-reproducable.

Oh, and try with at least 1.0.10.

Reported by adamgoucher on 2011-02-01 02:42:44

  • Status changed: NeedsClarification

@lukeis
Copy link
Member Author

lukeis commented Mar 2, 2016

site http://www.searsopticalcontacts.com
same issue on 1.0.10
a cookie there has % in name

Reported by Kazarko on 2011-03-23 19:17:36

@lukeis
Copy link
Member Author

lukeis commented Mar 2, 2016

Selenium.prototype.doDeleteAllVisibleCookies() uses BrowserBot.prototype.getAllCookieNames()
performs a decodeURIComponent() operation on the name of the cookie.

This turns drugstore%2Efish into drugstore.fish, a non-existent cookie name.

The broken name will be returned in the list, and later used by BrowserBot.prototype.recursivelyDeleteCookie(),
which throws the aforementioned error: throw new SeleniumError("Couldn't delete cookie
" + cookieName);

Reported by olle.jonsson on 2011-03-29 19:06:42

@lukeis
Copy link
Member Author

lukeis commented Mar 2, 2016

So as I investigate this some more...

- in the scripts/selenese, referring to the cookie as drugstore.fish is indeed the
desired behaviour
- drugstore%2Efish says that this is an asp site which [overly] aggressively escapes
things. se-ide sits inside firefox which does not escape the period

and am now thinking about an asp specific hack to deal with this.

Reported by adamgoucher on 2011-08-17 19:09:20

@lukeis
Copy link
Member Author

lukeis commented Mar 2, 2016

right. think i have fixed this. here is the new logic for deletion of a cookie by name
(the name should be the human friendly version (drugstore.fish)

- check that the cookie exists as passed in
- if not, check that the cookie exists using 'standard' encoding rules
- if not, check that the cookie exists using 'standard' encoding rules plus encoding
of _ and . (there could be others that are needed, but those are the two in this bug)

once found the mechanism for 'deleting' is the same.

Reported by adamgoucher on 2011-08-17 20:17:13

  • Status changed: Fixed

@lukeis
Copy link
Member Author

lukeis commented Mar 2, 2016

com.thoughtworks.selenium.SeleniumException: ERROR: Couldn't delete cookie feedType

Reported by carrot1192001 on 2012-08-31 03:03:33

@lukeis
Copy link
Member Author

lukeis commented Mar 2, 2016

Reported by luke.semerau on 2015-09-17 17:48:58

  • Labels added: Restrict-AddIssueComment-Commit

@lukeis lukeis closed this as completed Mar 2, 2016
@SeleniumHQ SeleniumHQ locked and limited conversation to collaborators Mar 3, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant