{"id":501,"date":"2019-01-30T22:55:16","date_gmt":"2019-01-30T22:55:16","guid":{"rendered":"http:\/\/study-journey.com\/?p=501"},"modified":"2022-07-29T10:19:47","modified_gmt":"2022-07-29T10:19:47","slug":"python-selenium%e3%81%a7%e3%82%b9%e3%82%af%e3%83%ac%e3%82%a4%e3%83%94%e3%83%b3%e3%82%b0","status":"publish","type":"post","link":"https:\/\/study-journey.com\/?p=501","title":{"rendered":"Python +Selenium\u3067\u81ea\u52d5\u64cd\u4f5c"},"content":{"rendered":"<p><!--[CDATA[\n\n<p-->\u540c\u3058\u30d7\u30ed\u30b0\u30e9\u30e0\u3092\u52d5\u304b\u3057\u3066\u3082\u3001\u6b63\u3057\u304f\u52d5\u3044\u305f\u308a\u52d5\u304b\u306a\u304b\u3063\u305f\u308a\u3057\u3066\u3001\u30d1\u30bd\u30b3\u30f3\u306e\u753b\u9762\u306b\u60aa\u614b\u3092\u4f55\u5ea6\u3082\u3064\u3044\u305f\u306e\u3067\u3059\u304c\u3001\u539f\u56e0\u306e\u7279\u5b9a\u306b\u6210\u529f\u3057\u305f\u306e\u3067\u30e1\u30e2\u3002<\/p>\n\n\n\n\n<p>\u4ee5\u4e0b\u3001\u30b3\u30fc\u30c9\u3002<\/p>\n\n\n\n\n<p>\u3053\u306e\u30d7\u30ed\u30b0\u30e9\u30e0\u306f\u3001\u3042\u308b\u96fb\u5b50\u66f8\u7c4d\u30b5\u30a4\u30c8\u306b\u3001input\u95a2\u6570\u3067\u5165\u529b\u3057\u305f\u30bf\u30a4\u30c8\u30eb\u306e\u6f2b\u753b\u304c\u3042\u308b\u304b\u3092\u8abf\u3079\u308b\u305f\u3081\u306e\u30d7\u30ed\u30b0\u30e9\u30e0\u306e\u88fd\u4f5c\u904e\u7a0b\u3067\u3059\u3002<\/p>\n\n\n\n\n<p>chromedriver\u3092\u4fdd\u5b58\u3059\u308b\u5834\u6240\u306f\u3001.py\u30d5\u30a1\u30a4\u30eb\u306e\u4fdd\u5b58\u5834\u6240\u3068\u540c\u3058\u306b\u3059\u308b\u3068\u4f7f\u3044\u3084\u3059\u3044\u3067\u3059\u3002\u305d\u3046\u3067\u306a\u3044\u5834\u5408\u306f\u3001chromedriver\u306e\u30d5\u30a1\u30a4\u30eb\u304c\u4fdd\u5b58\u3055\u308c\u3066\u3044\u308b\u5834\u6240\u306bpath\u3092\u901a\u3059\u5fc5\u8981\u304c\u3042\u308b\u3088\u3046\u3067\u3059\u3002<\/p>\n\n\n\n\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-505\" src=\"http:\/\/study-journey.com\/wp-content\/uploads\/2019\/01\/Selenium-300x44.png\" alt=\"\" width=\"300\" height=\"44\" srcset=\"https:\/\/study-journey.com\/wp-content\/uploads\/2019\/01\/Selenium-300x44.png 300w, https:\/\/study-journey.com\/wp-content\/uploads\/2019\/01\/Selenium-1024x150.png 1024w, https:\/\/study-journey.com\/wp-content\/uploads\/2019\/01\/Selenium-768x112.png 768w, https:\/\/study-journey.com\/wp-content\/uploads\/2019\/01\/Selenium.png 1120w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/p>\n\n\n\n\n<p>\uff08\u4e0a\u306e\u753b\u50cf\u306e\u3088\u3046\u306b\u4fdd\u5b58\u5834\u6240\u3092\u540c\u3058\u306b\u3059\u308b\u306e\u304c\u5206\u304b\u308a\u3084\u3059\u3044\uff09<\/p>\n\n\n\n\n<p>&#8220;&#8221;&#8221;&#8221;&#8221;&#8221;&#8221;&#8221;&#8221;&#8221;&#8221;&#8221;&#8221;&#8221;&#8221;&#8221;&#8221;&#8221;&#8221;&#8221;&#8221;&#8221;&#8221;&#8221;&#8221;&#8221;&#8221;&#8221;&#8221;&#8221;&#8221;&#8221;&#8221;&#8221;&#8221;&#8221;&#8221;&#8221;&#8221;&#8221;&#8221;&#8221;&#8221;&#8221;&#8221;&#8221;&#8221;&#8221;&#8221;&#8221;&#8221;&#8221;&#8221;&#8221;&#8221;&#8221;&#8221;&#8221;&#8221;&#8221;&#8221;&#8221;&#8221;&#8221;&#8221;&#8221;&#8221;<\/p>\n\n\n\n\n<div><em>import time<\/em><\/div>\n\n\n\n\n<div><em>from selenium import webdriver<\/em><\/div>\n\n\n\n\n<div>&nbsp;<\/div>\n\n\n\n\n<div><em>from bs4 import BeautifulSoup<\/em><\/div>\n\n\n\n\n<div>&nbsp;<\/div>\n\n\n\n\n<div><em>title = input(&#8216;title\uff1f&#8217;)<\/em><\/div>\n\n\n\n\n<div><em>driver = webdriver.Chrome()<\/em><\/div>\n\n\n\n\n<div><em>driver.get(&#8216;https:\/\/video.unext.jp\/book\/genre\/comic&#8217;)<\/em><\/div>\n\n\n\n\n<div>&nbsp;<\/div>\n\n\n\n\n<div><em>driver.find_element_by_css_selector(&#8220;button.searchButton-hIvADS.dkIwmH&#8221;).click()<\/em><\/div>\n\n\n\n\n<div><em>time.sleep(3)<\/em><\/div>\n\n\n\n\n<div><em>driver.find_element_by_css_selector(&#8220;input.searchTextInput-ieLiJd&#8221;).send_keys(title)<\/em><\/div>\n\n\n\n\n<div>&nbsp;<\/div>\n\n\n\n\n<div>&#8220;&#8221;&#8221;&#8221;&#8221;&#8221;&#8221;&#8221;&#8221;&#8221;&#8221;&#8221;&#8221;&#8221;&#8221;&#8221;&#8221;&#8221;&#8221;&#8221;&#8221;&#8221;&#8221;&#8221;&#8221;&#8221;&#8221;&#8221;&#8221;&#8221;&#8221;&#8221;&#8221;&#8221;&#8221;&#8221;&#8221;&#8221;&#8221;&#8221;&#8221;&#8221;&#8221;&#8221;&#8221;&#8221;&#8221;&#8221;&#8221;&#8221;&#8221;&#8221;&#8221;&#8221;&#8221;&#8221;&#8221;&#8221;&#8221;&#8221;&#8221;&#8221;&#8221;&#8221;&#8221;&#8221;&#8221;<\/div>\n\n\n\n\n<div>&nbsp;<\/div>\n\n\n\n\n<div>&nbsp;<\/div>\n\n\n\n\n<div>&nbsp;<\/div>\n\n\n\n\n<div>&nbsp;<\/div>\n\n\n\n\n<div>\u4ee5\u4e0b\u306e\u30a8\u30e9\u30fc\u306e\u89e3\u6c7a\u306b\u6642\u9593\u304c\u304b\u304b\u308a\u307e\u3057\u305f\u3002<\/div>\n\n\n\n\n<div>selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate element: {&#8220;method&#8221;:&#8221;css selector&#8221;,&#8221;selector&#8221;:&#8221;input.searchTextInput-ieLiJd&#8221;}<\/div>\n\n\n\n\n<div>&nbsp;<\/div>\n\n\n\n\n<div>\u30c7\u30d0\u30c3\u30b0\u4e2d\u306b\u4e0d\u601d\u8b70\u3060\u3063\u305f\u306e\u306f\u3053\u306e\u30a8\u30e9\u30fc\u304c\u51fa\u305f\u308a\u51fa\u306a\u304b\u3063\u305f\u308a\u3057\u305f\u3053\u3068\u3067\u3059\u3002<\/div>\n\n\n\n\n<div>\u5168\u304f\u540c\u3058\u30d7\u30ed\u30b0\u30e9\u30e0\u3092\u52d5\u304b\u3057\u3066\u3044\u308b\u306e\u306b\u3001\u30a8\u30e9\u30fc\u304c\u51fa\u305f\u308a\u3067\u306a\u304b\u3063\u305f\u308a\u3057\u305f\u306e\u3067\u3059\u3002<\/div>\n\n\n\n\n<div>&nbsp;<\/div>\n\n\n\n\n<div>&nbsp;<\/div>\n\n\n\n\n<div>\u539f\u56e0\u306f\u3001\u8aad\u307f\u8fbc\u307f\u6642\u9593\u3067\u3059\u306d\u3002<\/div>\n\n\n\n\n<div>\u30b3\u30fc\u30c9\u306e\u4e0b\u304b\u30892\u884c\u76ee\u306btime.sleep(3)\u3068\u3044\u3046\u884c\u3092\u8db3\u3057\u3001\u753b\u9762\u304c\u5207\u308a\u66ff\u308f\u308b\u306e\u3092\u5f85\u3064\u6642\u9593\u3092\u3068\u3063\u305f\u3089\u3001\u30a8\u30e9\u30fc\u304c\u51fa\u306a\u304f\u306a\u308a\u307e\u3057\u305f\u3002<\/div>\n\n\n\n\n<div>&nbsp;<\/div>\n\n\n\n\n<div>&nbsp;<\/div>\n\n\n\n\n<div>&nbsp;<\/div>\n\n\n\n\n<div>\u30b3\u30fc\u30c9\u306e\u4e0b\u304b\u3089\uff13\u884c\u76ee\u306e<em>driver.find_element_by_css_selector(&#8220;button.searchButton-hIvADS.dkIwmH&#8221;).click()\u306e\u30b3\u30fc\u30c9\u3067\u30dc\u30bf\u30f3\u3092\u30af\u30ea\u30c3\u30af\u3057\u305f\u5f8c\u3001<\/em><\/div>\n\n\n\n\n<div>\u30b3\u30fc\u30c9\u306e\u4e00\u756a\u6700\u5f8c\u306e\u884c\u3067\u6307\u5b9a\u3057\u3066\u3044\u308b<em>&#8220;input.searchTextInput-ieLiJd&#8221;\uff08input\u30bf\u30b0\u306e\u3001searchTextInput-ieLiJd\u3068\u3044\u3046\u30af\u30e9\u30b9\u3001\u691c\u7d22\u3057\u305f\u3044\u5358\u8a9e\u3092\u5165\u529b\u3059\u308b\u6b04\uff09\u304c\u73fe\u308c\u308b\u69cb\u9020\u3067\u3059\u3002<\/em><\/div>\n\n\n\n\n<div>&nbsp;<\/div>\n\n\n\n\n<div>&nbsp;<\/div>\n\n\n\n\n<div>\u305d\u306e\u305f\u3081\u3001\u8aad\u307f\u8fbc\u307f\u306e\u6642\u9593\u306b\u3088\u3063\u3066\u306f\u3001\u30af\u30ea\u30c3\u30af\u3057\u3066\u691c\u7d22\u6b04\u304c\u73fe\u308c\u308b\u524d\u306b\u3001\u30d7\u30ed\u30b0\u30e9\u30e0\u304c\u691c\u7d22\u6b04\u306b\u5f53\u305f\u308binput\u30bf\u30b0\u3092\u63a2\u3057\u3066\u3057\u307e\u3044\u3001\u30a8\u30e9\u30fc\u304c\u51fa\u3066\u3057\u307e\u3044\u307e\u3057\u305f\u3002<\/div>\n\n\n\n\n<div>&nbsp;<\/div>\n\n\n\n\n<div>&nbsp;<\/div>\n\n\n\n\n<div>\u3061\u3083\u3093\u3068\u8aad\u307f\u8fbc\u307f\u306e\u6642\u9593\u3092\u78ba\u4fdd\u3057\u3066\u304b\u3089\u306f\u3001\u524d\u8ff0\u306e\u30a8\u30e9\u30fc\u306f\u51fa\u306a\u304f\u306a\u308a\u3001\u610f\u56f3\u3057\u305f\u3068\u304a\u308a\u306b\u30d7\u30ed\u30b0\u30e9\u30e0\u306f\u52d5\u304d\u307e\u3057\u305f\u3002<\/div>\n\n\n\n\n<div>&nbsp;<\/div>\n\n\n\n\n<div>&nbsp;<\/div>\n\n\n\n\n<div>\u540c\u3058\u30d7\u30ed\u30b0\u30e9\u30e0\u3092\u52d5\u304b\u3057\u3066\u3001\u52d5\u304f\u3068\u304d\u3068\u52d5\u304b\u306a\u3044\u6642\u304c\u3042\u308b\u306a\u3093\u3066\u3001\u7570\u5e38\u306a\u306e\u3067\u3001\u4e0d\u78ba\u5b9a\u8981\u7d20\u304c\u3042\u308b\u90e8\u5206\uff08\u4eca\u56de\u306f\u8aad\u307f\u8fbc\u307f\u306e\u6642\u9593\uff09\u3092\u901f\u3084\u304b\u306b\u7591\u3046\u3079\u304d\u3067\u3057\u305f\u3002\u53cd\u7701\u3002<\/div>\n\n\n\n\n<div>&nbsp;<\/div>\n\n\n\n\n<div>&nbsp;<\/div>\n\n\n\n\n<div>\u307e\u3060\u3001\u76ee\u6a19\u306e\u534a\u5206\u3082\u51fa\u6765\u3066\u3044\u306a\u3044\u304c\u3001\u3061\u3087\u3063\u3068\u524d\u9032\u3057\u307e\u3057\u305f\u3002<\/div>\n\n\n\n\n<div>&nbsp;<\/div>\n\n\n\n\n<div>&nbsp;<\/div>\n\n\n\n\n<div>\u3082\u3068\u3082\u3068\u3001sikuli\u4ee5\u5916\u306e\u81ea\u52d5\u5316\u65b9\u6cd5\u3092\u77e5\u3089\u306a\u304b\u3063\u305f\u306e\u3067\u3002<\/div>\n\n\n\n\n<div>&nbsp;<\/div>\n\n\n\n\n<div>&nbsp;<\/div>\n\n\n\n\n<div>chromedriver\u3068selenium\u3068python\u306b\u3088\u308b\u30b9\u30af\u30ec\u30a4\u30d4\u30f3\u30b0\u306f\u697d\u3057\u3044\u306e\u3067\u3001\u3053\u308c\u304b\u3089\u3082\u904a\u3093\u3067\u3044\u3053\u3046\u3068\u601d\u3044\u307e\u3059\u3002<\/div>\n\n\n\n\n<div>&nbsp;<\/div>\n\n\n\n\n<div>&nbsp;<\/div>\n\n\n\n\n<div>Qiita\u3068\u516c\u5f0f\u30ea\u30d5\u30a1\u30ec\u30f3\u30b9\u304c\u53c2\u8003\u306b\u306a\u308a\u307e\u3057\u305f\u3002<\/div>\n\n\n\n\n<div>Udemy\u306e\u52d5\u753b\u3082\u53c2\u8003\u306b\u3057\u307e\u3057\u305f\u3002<\/div>\n\n\n\n\n<div>&nbsp;<\/div>\n\n\n\n\n<div>&nbsp;<\/div>\n\n\n\n\n<div>Udemy\u306b\u3064\u3044\u3066\u306f\u3001<a href=\"https:\/\/study-journey.com\/2018\/10\/30\/336\/%E4%BA%BA%E6%B0%97%E3%81%AE%E8%A8%98%E4%BA%8B\/\">\u3053\u3061\u3089\u306e\u8a18\u4e8b<\/a>\u3082\u53c2\u7167\u3002<\/div>\n\n\n\n\n<div>&nbsp;<\/div>\n\n\n\n\n<div>&nbsp;<\/div>\n\n\n\n\n<div>&nbsp;<\/div>\n\n\n<p><\/p>\n\n\n<p><\/p>\n\n\n","protected":false},"excerpt":{"rendered":"<p>\u540c\u3058\u30d7\u30ed\u30b0\u30e9\u30e0\u3092\u52d5\u304b\u3057\u3066\u3082\u3001\u6b63\u3057\u304f\u52d5\u3044\u305f\u308a\u52d5\u304b\u306a\u304b\u3063\u305f\u308a\u3057\u3066\u3001\u30d1\u30bd\u30b3\u30f3\u306e\u753b\u9762\u306b\u60aa\u614b\u3092\u4f55\u5ea6\u3082\u3064\u3044\u305f\u306e\u3067\u3059\u304c\u3001\u539f\u56e0\u306e\u7279\u5b9a\u306b\u6210\u529f\u3057\u305f\u306e\u3067\u30e1\u30e2\u3002 \u4ee5\u4e0b\u3001\u30b3\u30fc\u30c9\u3002 \u3053\u306e\u30d7\u30ed\u30b0\u30e9\u30e0\u306f\u3001\u3042\u308b\u96fb\u5b50\u66f8\u7c4d\u30b5\u30a4\u30c8\u306b\u3001input\u95a2\u6570\u3067\u5165\u529b\u3057\u305f\u30bf [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[],"class_list":["post-501","post","type-post","status-publish","format-standard","hentry","category-memo"],"_links":{"self":[{"href":"https:\/\/study-journey.com\/index.php?rest_route=\/wp\/v2\/posts\/501","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/study-journey.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/study-journey.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/study-journey.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/study-journey.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=501"}],"version-history":[{"count":2,"href":"https:\/\/study-journey.com\/index.php?rest_route=\/wp\/v2\/posts\/501\/revisions"}],"predecessor-version":[{"id":1022,"href":"https:\/\/study-journey.com\/index.php?rest_route=\/wp\/v2\/posts\/501\/revisions\/1022"}],"wp:attachment":[{"href":"https:\/\/study-journey.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=501"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/study-journey.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=501"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/study-journey.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=501"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}