{"id":7009,"date":"2021-11-18T13:30:10","date_gmt":"2021-11-18T04:30:10","guid":{"rendered":"https:\/\/learningbox.co.jp\/?p=7009"},"modified":"2021-11-18T13:30:10","modified_gmt":"2021-11-18T04:30:10","slug":"blog_selenium","status":"publish","type":"post","link":"https:\/\/learningbox.co.jp\/en\/2021\/11\/18\/blog_selenium\/","title":{"rendered":"How to search XPath in Selenium"},"content":{"rendered":"<p>\u521d\u3081\u307e\u3057\u3066\u3001\u958b\u767a\u90e8\u306e\u7684\u5834\u3068\u7533\u3057\u307e\u3059\u3002<br \/>\n\u4eca\u5e74\u306e5\u6708\u306b\u5165\u793e\u3057\u3001E2E\u30c6\u30b9\u30c8\u306e\u81ea\u52d5\u5316\u3092\u62c5\u5f53\u3057\u3066\u3044\u307e\u3059\u3002<br \/>\n\u4eca\u56de\u306e\u8a18\u4e8b\u3067\u306f\u3001Seleniumn\u306eXPath\u3092\u4f7f\u3063\u3066\u3001\u30da\u30fc\u30b8\u5185\u306e\u8981\u7d20\u3092\u6307\u5b9a\u3059\u308b\u65b9\u6cd5\u3092\u3054\u7d39\u4ecb\u3057\u307e\u3059\u3002<\/p>\n<p class=\"mokujimidasi\">\u76ee\u6b21\u306f\u3053\u3061\u3089<\/p>\n<ul class=\"mokuji\">\n<li><a href=\"#1\"><font color=\"#555555\">\uff11. XPath\u3068\u306f<\/font><\/a><\/li>\n<li><a href=\"#2\"><font color=\"#555555\">\uff12. XPath\u306e\u57fa\u672c\u306e\u66f8\u304d\u65b9<\/font><\/a><\/li>\n<li><a href=\"#3\"><font color=\"#555555\">\uff13. \u5c5e\u6027\u3092\u5229\u7528\u3057\u3066\u306eXPath\u306e\u53d6\u5f97\u65b9\u6cd5<\/font><\/a><\/li>\n<li><a href=\"#4\"><font color=\"#555555\">\uff14. Google Chrome\u3067XPath\u3092\u53d6\u5f97\u3059\u308b<\/font><\/a><\/li>\n<li><a href=\"#5\"><font color=\"#555555\">\uff15. \u307e\u3068\u3081<\/font><\/a><\/li>\n<\/ul>\n<h2 class=\"heading__l\" id=\"1\">XPath\u3068\u306f<\/h2>\n<p>XPath\u3068\u306f\u3001XML\u5f62\u5f0f\u306e\u6587\u66f8\u304b\u3089<strong>\u7279\u5b9a\u306e\u90e8\u5206\u3092\u6307\u5b9a\u3057\u3066\u53d6\u5f97\u3059\u308b\u305f\u3081\u306e\u7c21\u6613\u8a00\u8a9e\u3067\u3059\u3002<\/strong><br \/>\n\u307e\u305f\u3001XML\u7528\u306a\u306e\u306bHTML\u306b\u3082\u4f7f\u3046\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<h2 class=\"heading__l\" id=\"2\">XPath\u306e\u57fa\u672c\u7684\u306a\u66f8\u304d\u65b9<\/h2>\n<p>\u3067\u306f\u65e9\u901fXPath\u306e\u66f8\u304d\u65b9\u306b\u3064\u3044\u3066\u7d39\u4ecb\u3057\u3066\u3044\u304d\u307e\u3059\u3002<\/p>\n<p>(\u4f8b)<\/p>\n<div class=\"wp-block\">\n<pre>\r\n<code>\r\n &lt;!DOCTYPE html&gt;\r\n  &lt;html&gt;\r\n\u3000 &lt;head&gt;\r\n\u3000  &lt;title\u9f8d\u91ce\u60c5\u5831\u30b7\u30b9\u30c6\u30e0\/title&gt;\r\n\u3000 &lt;\/head&gt;\r\n  &lt;\/html&gt;\r\n<\/code>\r\n<\/pre>\n<\/div>\n<p>\u4e0a\u8a18\u3088\u3046\u306a\u3001HTML\u306e\u5834\u5408<\/p>\n<div class=\"kaisou\">\n<p>html &#8211; head &#8211; title<\/p>\n<\/div>\n<p>\u3053\u306e\u3088\u3046\u306a\u968e\u5c64\u69cb\u9020\u3067\u8868\u3059\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<br \/>\nXPath\u3067\u66f8\u304f\u5834\u5408\u3001\u4e0b\u8a18\u306e\u3088\u3046\u306bhtml\u30bf\u30b0\u3092\/(\u30b9\u30e9\u30c3\u30b7\u30e5)\u3067\u533a\u5207\u308a\u3001\u30bf\u30b0\u306e\u968e\u5c64\u69cb\u9020\u3067\u8868\u3059\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<div class=\"kaisou\">\n<p>\/html\/head\/title<\/p>\n<\/div>\n<p>\u30d1\u30b9\u3092\u7701\u7565\u3059\u308b\u5834\u5408\u3001\u4e0b\u8a18\u3088\u3046\u306b\/\/\u3092\u4f7f\u7528\u3059\u308b\u3053\u3068\u3067\u3001\u524d\u306e\u8981\u7d20\u3092\u7701\u7565\u3059\u308b\u3053\u3068\u304c\u53ef\u80fd\u3067\u3059\u3002<\/p>\n<div class=\"kaisou\">\n<p>\/\/title<\/p>\n<\/div>\n<h2 class=\"heading__l\" id=\"3\">\u5c5e\u6027\u3092\u5229\u7528\u3057\u3066XPath\u306e\u53d6\u5f97\u65b9\u6cd5<\/h2>\n<p>class\u3084id\u306e\u3088\u3046\u306a\u8981\u7d20\u306b\u95a2\u9023\u4ed8\u3051\u305f\u308a\u3001\u9023\u7d50\u3057\u305f\u308a\u3059\u308b\u5c5e\u6027\u306f\u300c@\u300d\u3067\u8868\u3057\u307e\u3059\u3002<\/p>\n<p>(\u4f8b)<\/p>\n<div class=\"wp-block\">\n<pre>\r\n<code>\r\n &lt;div class=\"wrapper\"&gt;\r\n\r\n &lt;div id=\"logo\"&gt;\r\n<\/code>\r\n<\/pre>\n<\/div>\n<div class=\"wp-block\">\n<pre>\r\n<code>\r\n\/\/*[@class=\"wrapper\"]\r\n\r\n\/\/*[@id=\"logo\"]\r\n<\/code>\r\n<\/pre>\n<\/div>\n<p>\u3053\u306e\u3088\u3046\u306b\u3001\u7279\u5b9a\u306e\u5c5e\u6027\u5024\u3092\u8868\u793a\u3057\u305f\u3044\u5834\u5408\u306f\uff20(\u30a2\u30c3\u30c8\u30de\u30fc\u30af)\u3092\u4f7f\u3044\u307e\u3059\u3002<br \/>\n\u307e\u305f\u3001\uff0a(\u30a2\u30b9\u30bf\u30ea\u30b9\u30af)\u306f\u5168\u8981\u7d20\u3092\u610f\u5473\u3057\u307e\u3059\u3002<br \/>\n\u540c\u3058class\u3084id\u306e\u4e2d\u304b\u3089\u7279\u5b9a\u306e\u8981\u7d20\u3092\u6307\u5b9a\u3057\u305f\u5834\u5408<\/p>\n<p>(\u4f8b)<\/p>\n<div class=\"wp-block\">\n<pre>\r\n<code>\r\n&lt;li id=\"menu-item\"&gt;\u7406\u5ff5\u30fb\u30d3\u30b8\u30e7\u30f3&lt;\/li&gt;\r\n&lt;li id=\"menu-item\"&gt;\u6cbf\u9769&lt;\/li&gt;\r\n&lt;li id=\"menu-item\"&gt;\u63a1\u7528\u60c5\u5831&lt;\/li&gt;\r\n&lt;li id=\"menu-item\"&gt;\u304a\u554f\u3044\u5408\u308f\u305b&lt;\/li&gt;\r\n<\/code>\r\n<\/pre>\n<\/div>\n<p>\u4e0a\u8a18\u3088\u3046\u306b\u3001\u63a1\u7528\u60c5\u5831\u3060\u3051\u3092\u53d6\u5f97\u3057\u305f\u3044\u5834\u5408\u3001\u30c6\u30ad\u30b9\u30c8\u306b\u542b\u307e\u308c\u308b\u6587\u5b57\u5217\u306e\u691c\u7d22\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<br \/>\n\u307e\u305f\u3001<span>contains(text(),\u691c\u7d22\u6587\u5b57\u5217)<\/span>\u3092\u4f7f\u3046\u3068\u3001\u7c21\u5358\u306b\u6587\u5b57\u5217\u3092\u6307\u5b9a\u3067\u304d\u308b\u65b9\u6cd5\u3092\u7d39\u4ecb\u3057\u307e\u3059\u3002<\/p>\n<p>\u4f8b\u3048\u3070\u3001\u4e0b\u8a18\u306e\u3088\u3046\u306b\u66f8\u304f\u3068\u300c\u7406\u5ff5\u30fb\u30d3\u30b8\u30e7\u30f3\u3001\u6cbf\u9769\u3001\u63a1\u7528\u60c5\u5831\u3001\u304a\u554f\u3044\u5408\u308f\u305b\u300d\u306e\uff14\u3064\u304c\u6307\u5b9a\u3055\u308c\u307e\u3059\u3002<br \/>\n<span>\/\/*[@id=&#8221;menu-item&#8221;]<\/span><\/p>\n<p>\u305d\u3093\u306a\u3068\u304d\u306f\u3053\u306e\u3088\u3046\u306b\u66f8\u304f\u3068\u3001\u304a\u554f\u3044\u5408\u308f\u305b\u306e\u90e8\u5206\u306e\u307f\u6307\u5b9a\u3059\u308b\u3053\u3068\u304c\u53ef\u80fd\u3067\u3059\u3002<br \/>\n<span>\/\/*[@id=&#8221;menu-item&#8221;]\/\/*[contains(text(),&#8221;\u304a\u554f\u3044\u5408\u308f\u305b&#8221;]<\/span><\/p>\n<h2 class=\"heading__l\" id=\"4\">Google Chrome\u3067XPath\u3092\u53d6\u5f97\u3059\u308b<\/h2>\n<p>\u4e0a\u624b\u304fXPath\u3092\u6307\u5b9a\u3067\u304d\u306a\u3044\u5834\u5408\u306f\u3001Chrome\u306e\u691c\u8a3c\u6a5f\u80fd\u3092\u4f7f\u3063\u3066\u3001XPath\u3092\u53d6\u5f97\u3059\u308b\u3053\u3068\u304c\u53ef\u80fd\u3067\u3059\u3002<br \/>\nChrome\u306b\u63b2\u8f09\u3055\u308c\u3066\u3044\u308b\u300c\u691c\u8a3c\u6a5f\u80fd\u300d\u3092\u4f7f\u7528\u3057\u3001\u9752\u304f\u30cf\u30a4\u30e9\u30a4\u30c8\u3055\u308c\u305f\u7b87\u6240\u3067\u53f3\u30af\u30ea\u30c3\u30af\u3092\u3057\u307e\u3059\u3002<\/p>\n<p>[\u30e1\u30cb\u30e5\u30fc\u306e\u30b3\u30d4\u30fc]\u3000\u2192\u3000[XPath\u306e\u30b3\u30d4\u30fc]<br \/>\n\u3092\u3059\u308b\u3053\u3068\u3067\u30af\u30ea\u30c3\u30d7\u30dc\u30fc\u30c9\u306b\u30b3\u30d4\u30fc\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<h2 class=\"heading__l\" id=\"5\">\u307e\u3068\u3081<\/h2>\n<p>\u4eca\u56de\u306e\u8a18\u4e8b\u3067\u306f\u3001Selenium\u3067\u306eXPath\u691c\u7d22\u65b9\u6cd5\u306b\u3064\u3044\u3066\u3054\u7d39\u4ecb\u3057\u307e\u3057\u305f\u3002<br \/>\n\u3054\u7d39\u4ecb\u3057\u305f\u306e\u306f\u4e00\u4f8b\u3067\u3059\u304c\u3001\u3054\u53c2\u8003\u306b\u306a\u308c\u3070\u5e78\u3044\u3067\u3059\u3002<br \/>\n\u3082\u3046\u5c11\u3057\u7d30\u304b\u3044\u6307\u5b9a\u65b9\u6cd5\u306b\u3064\u304d\u307e\u3057\u3066\u306f\u3001\u6b21\u56de\u306b\u307e\u3068\u3081\u305f\u3044\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"\u521d\u3081\u307e\u3057\u3066\u3001\u958b\u767a\u90e8\u306e\u7684\u5834\u3068\u7533\u3057\u307e\u3059\u3002 \u4eca\u5e74\u306e5\u6708\u306b\u5165\u793e\u3057\u3001E2E\u30c6\u30b9\u30c8\u306e\u81ea\u52d5\u5316\u3092\u62c5\u5f53\u3057\u3066\u3044\u307e\u3059\u3002 \u4eca\u56de\u306e\u8a18\u4e8b\u3067 [&hellip;]","protected":false},"author":38,"featured_media":7011,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"inline_featured_image":false,"advanced_seo_description":"","jetpack_seo_html_title":"","jetpack_seo_noindex":false,"vkexunit_cta_each_option":"","footnotes":""},"categories":[6,7,40],"tags":[84,54],"class_list":["post-7009","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-blog","category-7","category-40","tag-selenium","tag-54"],"acf":[],"jetpack_featured_media_url":"https:\/\/learningbox.co.jp\/wp-content\/uploads\/2021\/11\/selenium-learningBOX.png","jetpack_shortlink":"https:\/\/wp.me\/pgMrZ4-1P3","_links":{"self":[{"href":"https:\/\/learningbox.co.jp\/en\/wp-json\/wp\/v2\/posts\/7009","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/learningbox.co.jp\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/learningbox.co.jp\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/learningbox.co.jp\/en\/wp-json\/wp\/v2\/users\/38"}],"replies":[{"embeddable":true,"href":"https:\/\/learningbox.co.jp\/en\/wp-json\/wp\/v2\/comments?post=7009"}],"version-history":[{"count":87,"href":"https:\/\/learningbox.co.jp\/en\/wp-json\/wp\/v2\/posts\/7009\/revisions"}],"predecessor-version":[{"id":7123,"href":"https:\/\/learningbox.co.jp\/en\/wp-json\/wp\/v2\/posts\/7009\/revisions\/7123"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/learningbox.co.jp\/en\/wp-json\/wp\/v2\/media\/7011"}],"wp:attachment":[{"href":"https:\/\/learningbox.co.jp\/en\/wp-json\/wp\/v2\/media?parent=7009"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/learningbox.co.jp\/en\/wp-json\/wp\/v2\/categories?post=7009"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/learningbox.co.jp\/en\/wp-json\/wp\/v2\/tags?post=7009"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}