0

forexample I can go to msn.com and open developer tools and write this code document.querySelector('.news a').click() and it will open news. Now I want a program to do this automatically for me. write a javascript code that do this for me actully this was just a simple example I don't want a program to open news in msn actully I want to submit something automaticaly. 1)how can I do this (I know if want to make this app for desktop I should use something like appjs)? 2)Is there any way that it doesn't open browser and submit that?

update:

I tested casperjs(as mentioned in comments) and I tried to login to my outlook then capture it.

here is my code:

var casper = require('casper').create();
casper.start("https://outlook.com", function(response) {
   this.page.evaluate(function(a,b) {
    // login

      document.querySelector('#i0116').value = a;
      document.querySelector('#i0118').value = b;
      document.querySelector('#idSIButton9').click();
   },'**********@outlook.com','**********');
}).then( function(){
       this.capture('outlook.png');
       this.echo(this.getTitle());
   }).run();

from this and this stackoverflow questions I tried casperjs --ssl-protocol=tlsv1 test.js and casperjs --ssl-protocol=any test.js and .wait(4000, function(){this.capture('outlook.png')} but all of them loged sign in and the below pictureenter image description here

as you see the sign in form is filled but it couldn't enter it.

In the developer tools I entered

      document.querySelector('#i0116').value = a;
      document.querySelector('#i0118').value = b;
      document.querySelector('#idSIButton9').click();

and it worked but here it doesn't work.

Community
  • 1
  • 1
Habib Kazemi
  • 2,172
  • 1
  • 24
  • 30

0 Answers0