2017-09-28 1 views
0

私は現在電子アプリを作っています。私はNightmareをプロジェクトに含めました。私はyahoo.comを訪問し、ブラウザウィンドウを開いてもらいたいコードザッツNightmareJSはブラウザを開きません

var nightmare = Nightmare({ show: true }) 

    nightmare 
    .goto('http://yahoo.com') 
    .type('input[title="Search"]', 'github nightmare') 
    .click('.searchsubmit').then(nightmare.show()) 

私はショーを置くとどのようにまだヘッドレスですか:本当ですか?

ターミナル:予想通り、私は明示のNode.jsを使用していないので、

ipc.on('launchBrowser', function(event, data){ 
    var nightmare = Nightmare({ show: true }) 

    nightmare 
    .goto('http://yahoo.com') 
    .type('input[title="Search"]', 'github nightmare') 
    .click('.searchsubmit').then(() => { }); 
}); 

は、それが動作していないが、むしろ:

$ DEBUG=nightmare* electron . 
    nightmare queuing process start +0ms 
    nightmare queueing action "goto" for http://yahoo.com +3ms 
    nightmare queueing action "type" +2ms 
    nightmare queueing action "click" +0ms 
    nightmare running +0ms 

私はまた、全体のスニペットが含まれて私のコードを変更電子?

答えて

1

私はあなたが必要としないにもかかわらず、多分それは、エラーのいくつかの種類を投げている

その値を受信して​​いない場合は、「その後」の内側に()で関数を呼び出すことができるとは思いませんnightmare.show()このような何かのために

にいずれかの変更をインスタンスを作成するときには、プロパティを設定するので:

var nightmare = Nightmare({ show: true }) 

    nightmare 
    .goto('http://yahoo.com') 
    .type('input[title="Search"]', 'github nightmare') 
    .click('.searchsubmit').then(nightmare.show) 

またはこの:

var nightmare = Nightmare({ show: true }) 

    nightmare 
    .goto('http://yahoo.com') 
    .type('input[title="Search"]', 'github nightmare') 
    .click('.searchsubmit').then(() => { nightmare.show(); }); 

または削除nightmare.show()完全

var nightmare = Nightmare({ show: true }) 

    nightmare 
    .goto('http://yahoo.com') 
    .type('input[title="Search"]', 'github nightmare') 
    .click('.searchsubmit').then(() => { //Something cool }); 
+0

うーん、私はそれを削除しても、それはまだブラウザが表示されません。編集されたメインポスト。 – ZZPLKF

関連する問題