{"id":1465,"date":"2021-06-21T08:06:24","date_gmt":"2021-06-20T23:06:24","guid":{"rendered":"https:\/\/sirius10.net\/blog\/wordpress\/?p=1465"},"modified":"2021-06-21T08:06:26","modified_gmt":"2021-06-20T23:06:26","slug":"post-1465","status":"publish","type":"post","link":"https:\/\/sirius10.net\/blog\/wordpress\/index.php\/2021\/06\/21\/1465\/","title":{"rendered":"pupeteer \u3067\u30d5\u30aa\u30fc\u30e0 (\u691c\u7d22\u30dc\u30c3\u30af\u30b9) \u3092\u64cd\u4f5c\u3059\u308b"},"content":{"rendered":"\n<p>\u3000\u4eca\u5ea6\u306f\u3001\u30d5\u30a9\u30fc\u30e0\u3092\u64cd\u4f5c\u3057\u3066\u307f\u307e\u3059\u3002\u30b5\u30a4\u30c8\u306e\u30da\u30fc\u30b8\u306b\u306f\u3001\u691c\u7d22\u30dc\u30c3\u30af\u30b9\u3092\u8a2d\u7f6e\u3057\u3066\u3042\u308b\u306e\u3067\u3001pupeteer \u3067\u691c\u7d22\u3055\u305b\u305f\u3044\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n\n\n\n<p>\u3000\u691c\u7d22\u30dc\u30c3\u30af\u30b9\u306e\u30d5\u30a9\u30fc\u30e0\u8981\u7d20\u306b\u306f\u4ee5\u4e0b\u306e\u3088\u3046\u306b id \u304c\u8a2d\u5b9a\u3057\u3066\u3042\u308b\u306e\u3067\u305d\u308c\u3092\u4f7f\u3063\u3066\u3044\u304d\u307e\u3059\u3002<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li><span style=\"font-size: 17px\" class=\"font-size\">\u30c6\u30ad\u30b9\u30c8\u30dc\u30c3\u30af\u30b9<br>id: search_text<\/span><\/li><li><span style=\"font-size: 17px\" class=\"font-size\">\u691c\u7d22\u30dc\u30bf\u30f3<br>id: search_button<\/span><\/li><\/ul>\n\n\n\n<p>\u3000\u30c6\u30ad\u30b9\u30c8\u30dc\u30c3\u30af\u30b9\u306b\u691c\u7d22\u30ef\u30fc\u30c9\u3092\u5165\u529b\u3059\u308b\u306b\u306f\u3001\u6b21\u306e\u3088\u3046\u306b\u66f8\u304d\u307e\u3059\u3002<\/p>\n\n\n\n<pre class=\"wp-block-preformatted file\">await page.type(\"#search_text\", \"\u691c\u7d22\u30ef\u30fc\u30c9\");<\/pre>\n\n\n\n<p>\u3000\u691c\u7d22\u30dc\u30bf\u30f3\u3092\u30af\u30ea\u30c3\u30af\u3055\u305b\u308b\u306b\u306f\u3001\u6b21\u306e\u3088\u3046\u306b\u66f8\u304d\u307e\u3059\u3002<\/p>\n\n\n\n<pre class=\"wp-block-preformatted file\">await page.click(\"#search_button\");<\/pre>\n\n\n\n<p>\u3000\u8981\u7d20\u306b id \u3092\u4ed8\u3051\u3066\u3044\u308b\u3068\u3001\u64cd\u4f5c\u3057\u3084\u3059\u3044\u3067\u3059\u306d\u3002<\/p>\n\n\n\n<p>\u3000\u3067\u306f\u3001Xkanon \u3092\u691c\u7d22\u3055\u305b\u3066\u307f\u305f\u3044\u3068\u601d\u3044\u307e\u3059\u3002\u6b21\u306e\u3088\u3046\u306a\u5185\u5bb9\u306b\u306a\u308a\u307e\u3057\u305f\u3002<\/p>\n\n\n\n<pre class=\"wp-block-preformatted file\">#!\/usr\/bin\/node\n\nconst puppeteer = require(\"puppeteer-core\");\n\nconst URL = \"https:\/\/sirius10.net\/\";\n\n(async () =&gt; {\n  console.log(\"*** Start ***\");\n\n  console.log(\"Chromium \u8d77\u52d5\");\n  const browser = await puppeteer.launch({\n    headless: false,\n    slowMo: 50,\n    executablePath: \"\/usr\/bin\/chromium-browser\"\n  });\n\n  console.log(\"\u65b0\u3057\u3044\u30bf\u30d6\");\n  const page = await browser.newPage();\n\n  console.log(\"\u30d3\u30e5\u30fc\u30dd\u30fc\u30c8\/\u30c7\u30d0\u30a4\u30b9\u8a2d\u5b9a\");\n  await page.setViewport({\n    width: 1024,\n    height: 768\n  });\n\n  console.log(\"sirius10 \u3078\u79fb\u52d5\");\n  await page.goto(URL);\n\n  console.log('\u691c\u7d22\u30dc\u30c3\u30af\u30b9\u306b \"Xkanon\" \u3092\u5165\u529b\u3059\u308b');\n  await page.type(\"#search_text\", \"Xkanon\");\n  console.log(\"submit \u30dc\u30bf\u30f3\u3092\u30af\u30ea\u30c3\u30af\u3059\u308b\");\n  await page.click(\"#search_button\");\n\n  console.log(\"\u30b9\u30af\u30ea\u30fc\u30f3\u30b7\u30e7\u30c3\u30c8\u3092 test3.png \u306b\u4fdd\u5b58\");\n  await page.screenshot({\n    path: \"test3.png\",\n  });\n\n  console.log(\"Chromium \u7d42\u4e86\");\n  await browser.close();\n\n  console.log(\"*** End ***\");\n})();<\/pre>\n\n\n\n<p>\u3000\u4fdd\u5b58\u3055\u308c\u305f\u753b\u50cf\u306f\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u3001\u691c\u7d22\u7d50\u679c\u306e\u30da\u30fc\u30b8\u306b\u306a\u308a\u307e\u3057\u305f\u3002<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/sirius10.net\/blog\/wordpress\/wp-content\/uploads\/2021\/06\/test3.png\" alt=\"\" class=\"wp-image-1466\" width=\"571\" height=\"428\" srcset=\"https:\/\/sirius10.net\/blog\/wordpress\/wp-content\/uploads\/2021\/06\/test3.png 1024w, https:\/\/sirius10.net\/blog\/wordpress\/wp-content\/uploads\/2021\/06\/test3-300x225.png 300w, https:\/\/sirius10.net\/blog\/wordpress\/wp-content\/uploads\/2021\/06\/test3-768x576.png 768w\" sizes=\"auto, (max-width: 571px) 100vw, 571px\" \/><figcaption>\u691c\u7d22\u30dc\u30c3\u30af\u30b9\u306e\u64cd\u4f5c<\/figcaption><\/figure><\/div>\n\n\n\n<p>\u3000\u4ed6\u306e\u30d5\u30a9\u30fc\u30e0\u3082\u540c\u69d8\u306b\u64cd\u4f5c\u3067\u304d\u308b\u3067\u3057\u3087\u3046\u3002\u306a\u304a\u3001id \u304c\u3064\u3044\u3066\u3044\u306a\u3044\u5834\u5408\u306f\u3001type \u5c5e\u6027\u3084 value \u5c5e\u6027\u3092\u4f7f\u3046\u3053\u3068\u3082\u3067\u304d\u307e\u3059\u3002\u4f8b\u3048\u3070\u3001submit \u30dc\u30bf\u30f3 (type=&#8221;submit&#8221;) \u304c\u30da\u30fc\u30b8\u5185\u306b\u4e00\u3064\u3057\u304b\u7121\u3051\u308c\u3070\u3001\u6b21\u306e\u3088\u3046\u306b\u3057\u3066\u30dc\u30bf\u30f3\u3092\u30af\u30ea\u30c3\u30af\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<pre class=\"wp-block-preformatted file\">await page.click('input[tyupe=\"submit\"]');<\/pre>\n\n\n\n<p>\u3000\u3042\u308b\u3044\u306f\u3001\u5358\u7d14\u306b Enter \u30ad\u30fc\u3092\u62bc\u3057\u305f\u3053\u3068\u306b\u3059\u308c\u3070\u3044\u3044\u3067\u3059\u3002<\/p>\n\n\n\n<pre class=\"wp-block-preformatted file\">await page.keyboard.press('Enter');<\/pre>\n\n\n\n<p>\u3000\u4ed6\u306e\u65b9\u6cd5\u3082\u3042\u308b\u3088\u3046\u3067\u3059\u304c\u3001\u81ea\u5206\u306e\u74b0\u5883\u306b\u5408\u3063\u305f\u65b9\u6cd5\u3067\u30af\u30ea\u30c3\u30af\u3055\u305b\u308c\u3070\u3044\u3044\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u3000\u4eca\u5ea6\u306f\u3001\u30d5\u30a9\u30fc\u30e0\u3092\u64cd\u4f5c\u3057\u3066\u307f\u307e\u3059\u3002\u30b5\u30a4\u30c8\u306e\u30da\u30fc\u30b8\u306b\u306f\u3001\u691c\u7d22\u30dc\u30c3\u30af\u30b9\u3092\u8a2d\u7f6e\u3057\u3066\u3042\u308b\u306e\u3067\u3001pupeteer \u3067\u691c\u7d22\u3055\u305b\u305f\u3044\u3068\u601d\u3044\u307e\u3059\u3002 \u3000\u691c\u7d22\u30dc\u30c3\u30af\u30b9\u306e\u30d5\u30a9\u30fc\u30e0\u8981\u7d20\u306b\u306f\u4ee5\u4e0b\u306e\u3088\u3046\u306b id \u304c\u8a2d\u5b9a\u3057\u3066\u3042\u308b\u306e\u3067\u305d\u308c\u3092\u4f7f\u3063\u3066\u3044\u304d [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[22,4],"tags":[],"class_list":["post-1465","post","type-post","status-publish","format-standard","hentry","category-pupeeteer","category-raspberry-pi"],"_links":{"self":[{"href":"https:\/\/sirius10.net\/blog\/wordpress\/index.php\/wp-json\/wp\/v2\/posts\/1465","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/sirius10.net\/blog\/wordpress\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/sirius10.net\/blog\/wordpress\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/sirius10.net\/blog\/wordpress\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/sirius10.net\/blog\/wordpress\/index.php\/wp-json\/wp\/v2\/comments?post=1465"}],"version-history":[{"count":7,"href":"https:\/\/sirius10.net\/blog\/wordpress\/index.php\/wp-json\/wp\/v2\/posts\/1465\/revisions"}],"predecessor-version":[{"id":1516,"href":"https:\/\/sirius10.net\/blog\/wordpress\/index.php\/wp-json\/wp\/v2\/posts\/1465\/revisions\/1516"}],"wp:attachment":[{"href":"https:\/\/sirius10.net\/blog\/wordpress\/index.php\/wp-json\/wp\/v2\/media?parent=1465"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/sirius10.net\/blog\/wordpress\/index.php\/wp-json\/wp\/v2\/categories?post=1465"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/sirius10.net\/blog\/wordpress\/index.php\/wp-json\/wp\/v2\/tags?post=1465"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}