Manually setting cookies still isn't working
Try scraping this URL:
http://www.katespade.com/on/demandware.store/Sites-Kate-Site/default/Stores-Find
You'll notice the response says something about having to enable cookies, and it won't perform a search after that. I looked into the JavaScript, and found this code that was determining whether cookies are enabled:
cookiesEnabled : function() {
var currentCookie = document.cookie;
document.cookie = "Enabled=true";
var cookieValid = document.cookie;
var result = false;
if(cookieValid.indexOf("Enabled=true") != -1) {
result = true;
}
document.cookie = currentCookie;
return result;
}
var currentCookie = document.cookie;
document.cookie = "Enabled=true";
var cookieValid = document.cookie;
var result = false;
if(cookieValid.indexOf("Enabled=true") != -1) {
result = true;
}
document.cookie = currentCookie;
return result;
}
I set "Enabled=true" and many other cookies manually through a script, but I still get the message. Any ideas?
Re: Manually setting cookies still isn't working
I took a look at this site and it doesn't appear that cookies are the problem. After unsuccessfully trying different cookie settings and setting various cookies manually, I noticed the search results URL changes each search. The last part of the URL is /Cxxxx where xxxx is some number that changes each search.
From the main page if I extract the search URL using this extractor:SEARCH_URL = [^"]*
params = [^>]*
I can get the search results to show up. I also found I didn't have to manually set any cookies.