nightmareJSを利用して、スクレイピングまでは成功。その情報をブラウザ内に書き込みたいのですが、引数をtypeの中に入れてもうまく動きません。。。どうしたらよいでしょうか?
JS
1var Nightmare = require('nightmare'); 2var nightmare = Nightmare({ show: true }); 3 4Promise.resolve( 5 nightmare. 6 goto('https://www.yodobashi.com/product/100000001002780005/'). 7 wait('.productPrice.fs16.alignM'). 8 evaluate(() => {return document.querySelector('.productPrice.fs16.alignM').innerText;})). 9 then((result) => {console(result);}). 10 catch(console.error); 11 12nightmare.end();
これでうまくスクレイピングできる。
しかし
JS
1var Nightmare = require('nightmare'); 2var nightmare = Nightmare({ show: true }); 3 4Promise.resolve( 5 nightmare. 6 goto('https://www.yodobashi.com/product/100000001002780005/'). 7 wait('.productPrice.fs16.alignM'). 8 evaluate(() => {return document.querySelector('.productPrice.fs16.alignM').innerText;})). 9 then((result) => {console(result);}). 10 type('●',result) 11 catch(console.error); 12 13nightmare.end();
とするとなぜか動きません。どうしたらよいでしょうか?
あなたの回答
tips
プレビュー