I want to test using CasperJS . I want it to click the login button.
I have the following menu:
<ul id="menu-top">
<li class="0 first"><a title="" href="/empresa">Empresa</a></li>
<li class="1"><a title="" href="/plano-de-negocio">Plano de Negócio</a></li>
<li class="2"><a title="" href="/produtos">Produtos</a></li>
<li class="3"><a title="" href="/contato">Contato</a></li>
<li class="4 last"><a title="" href="login.php">Área restrita</a></li>
</ul>
To click, I used the following code:
var casper = require('casper').create({
verbose: true,
logLevel: "debug"
});
casper.start('http://localhost/teste');
casper.then(function(){
this.click('.4.last>a');
});
casper.run();
But I get the following error:
[error] [remote] findAll (): invalid selector provided ".4.last>": Error: SYNTAX_ERR: DOM Exception 12
CasperError: Can not dispatch mousedown event on nonexistent selector: .4.last> a
I'm using the firepath to fetch the button's css path (.4.last> a)