kreangkrai

Script set pupperteer

Jul 31st, 2018
297
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Set Chrome
  2. 1. Download chromium
  3. 2. new tab -> url = chrome://version/
  4. 3. copy Executable Path  -> /usr/lib/chromium/chromium
  5.  
  6. Set Puppeteer
  7. 1. Create Folder
  8. 2. พิมพ์ npm init -> all enter
  9. 3. npm i puppeteer
  10.  
  11. Test script
  12. 1. create script prakard.js -> "https://pastebin.com/0UGsk2u0"
  13. 2. พิมพ์ node prakard.js
  14. 3. รอดูผลลัพธ์ ถ้า error มันจะมี link ให้กดไป github ครับ
  15.  
  16. เพิ้มเติม
  17. api ของ puppet ค่อยข้างดีเลยครับ มีให้ใช้เยอะและอธิบายละเอียด
  18. https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#puppeteerlaunchoptions
  19.  
  20. พี่สามารถหาตัวอย่าง code ได้จากใน github นะครับ ลองไล่ๆเล่นโปรเขคเค้าดู มีตัวอย่างเยอะครับ
  21.  
  22. ขอให้สนุกครับ
Add Comment
Please, Sign In to add comment