I have a strange problem during screen scraping with spookyjs / capserjs.
I want to catch information from the following website: 'https://www.rwe-smarthome.de/is-bin/INTERSHOP.enfinity/WFS/RWEEffizienz-SmartHome-Site/de_DE/-/EUR/ViewApplication-DisplayWelcomePage'.
Because the site contains more than one page of products I want to open the other sites too.
Normally one could use
this.click(selector, function() {});
to achieve this.
For some strange reasons, this is not working here.
Please have a look at the following code:
var selector1 = "div#workingTemplate div:first-of-type ul.linkList li:nth-child(2) a";
spooky.waitUntilVisible(selector1);
spooky.thenClick(selector1);
spooky.wait(500);
spooky.then(function() {
this.capture("RWETest-02.jpg");
});
I receive an error
CasperError: Cannot dispatch mousedown event on nonexistent selector: div#workingTemplate div:first-of-type ul.linkList li:nth-child(2) a
Which is strange because if the selector / DOM object does not exists, it should fail at waitUntilVisible()
.
Also when I try to check if the selector exists, the answer seems to be yes because I also get the error with nonexistent selector:
Code:
spooky.then([{sel: selector1},function() {
if(this.exists(sel)) {
this.click(sel);
this.wait(500);
this.then(function() {
this.capture("RWETest-02.jpg");
});
}
else {
this.emit("logMessage", "Selector does not exists...");
}
}]);
Error:
CasperError: Cannot dispatch mousedown event on nonexistent selector: div#workingTemplate div:first-of-type ul.linkList li:nth-child(2) a
Because of SpookyJS I use PhantomJS 1.9.7 and CasperJS 1.1.0-beta3.
Does anyone have an idea about this?