cyrus-and / chrome-remote-interface

Chrome Debugging Protocol interface for Node.js
MIT License
4.29k stars 310 forks source link

Support I execute and exit without echo ? #163

Closed wenerme closed 7 years ago

wenerme commented 7 years ago
$ echo "Runtime.evaluate({expression: 'window.location.toString()'})" | chrome-remote-interface inspect
>>> Runtime.evaluate({expression: 'window.location.toString()'})
>>>
{ result:
   { result:
      { type: 'string',
        value: 'http://wsjs.saic.gov.cn/txnRead01.do?y7bRbp=qmFuhMIOZ8knNLN3lIvqHXtheGH8x0lz1pV5T.U_.xN0HBZjw.5QGTKB1G89JWL.38goSDi7e_wkq27GfE17SaqAyJ2piWUpz1B5KqJoUkg1KCS9wAcmhReqzH_2t79oHUJvrKll56TvLokW' } } }
>>>

For this command I only expect

{ result:
   { result:
      { type: 'string',
        value: 'http://wsjs.saic.gov.cn/txnRead01.do?y7bRbp=qmFuhMIOZ8knNLN3lIvqHXtheGH8x0lz1pV5T.U_.xN0HBZjw.5QGTKB1G89JWL.38goSDi7e_wkq27GfE17SaqAyJ2piWUpz1B5KqJoUkg1KCS9wAcmhReqzH_2t79oHUJvrKll56TvLokW' } } }
cyrus-and commented 7 years ago

The CLI that comes with this module is mainly for demonstration, documentation lookup and debugging purposes you shouldn't use it for scripting.

It's really easy to write an ad hoc Node.js script for what you're trying to achieve, which is basically the primary goal of this library.