SHARE
TWEET

Untitled

a guest Apr 26th, 2016 52 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var casper = require('casper').create({
  2.     verbose: true,
  3.     logLevel: 'debug',
  4.     pageSettings: {
  5.         loadImages: false,
  6.         loadPlugins: false,
  7.         userAgent: 'Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/29.0.1547.2 Safari/537.36'
  8.     },
  9.     viewportSize : { width: 1200, height: 600 }
  10. });
  11.  
  12. var url = "https://catracalivre.com.br/geral/cidadania/indicacao/voce-e-contra-ou-favor-da-cassacao-de-bolsonaro-por-ter-homenageado-um-torturador/";
  13.  
  14. function idElementoAClicar() {
  15.     var botoes = document.querySelectorAll('input.pds-radiobutton');
  16.     var elemento = botoes[1];
  17.     return elemento.id;
  18. }
  19.  
  20. casper.start(url, function() {
  21.  
  22. });
  23.  
  24. casper.waitForSelector('#container-continuar-lendo', function() {
  25.     this.click('button.js-btn-continuar-lendo');
  26.     var idRadioClicar = this.evaluate(idElementoAClicar);
  27.      
  28.    
  29.     console.log('aqui:');
  30.     this.click('#' + idRadioClicar);
  31.     this.click('div.pds-votebutton-outer a');
  32.    
  33.     this.wait(3000, function() {
  34.         this.capture('imagem.png');  
  35.     });
  36.    
  37. });
  38.  
  39. casper.run();
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top