I am running Phantomjs, Casperjs with php-casperjs
I want that the login persist on a website, I don't want to have to login every time I start casper.
Now I tried with many sites, I enabled cookies and tested, they works and are the same with different session.
But still the login doesn't persist.
I tried do use disk-cache true. Nothing change.
The Casper UserAgents, viewPortWidth/height doesn't change. The IP is the same. So a fingerprint authentication should still work...
What it is missing?
Edit: some code:
// Casper constructor and setting:
private $_userAgent = 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/52.0.2743.116 Safari/537.36';
private $_viewPortWidth = 1345;
private $_viewPortHeight = 749;
private $_temp_dir = '/tmp';
private $_path2casper = '/usr/local/bin/'; //path to CasperJS
//
$this->casper->setOptions(array(
'ignore-ssl-errors' => 'yes',
'ssl-protocol' => 'any',
'cookies-file' => sys_get_temp_dir().'/JScookies.txt',
'load-images' => 'true',
'disk-cache' => 'true'
));
// Login
$this->casper->start($this->LINK_LOGIN);
$this->casper->waitForSelector('input#btnLogin', 3000);
$this->casper->fillForm(
'form[action="/accedi"]',
array(
'Username' => $this->Account,
'Password' => $this->Password
), true);
$this->casper->wait(1000);
$this->casper->run();
if($this->CheckLogin($this->casper->getCurrentPageContent()))
echo "<br> <b>Login Success</b>";
else
echo "<br> <b>Error Login</b>";
// test after login
$this->casper->start($this->LINK_MAIN_PAGE);
$this->casper->wait(2000);
$this->casper->run();
if($this->CheckLogin($this->casper->getCurrentPageContent()))
echo "<br> <b>Login Success</b>";
else
echo "<br> <b>Error Login</b>";