{"id":381,"date":"2013-11-18T12:46:06","date_gmt":"2013-11-18T12:46:06","guid":{"rendered":"http:\/\/codethataint.com\/blog\/?p=381"},"modified":"2013-11-18T13:03:33","modified_gmt":"2013-11-18T13:03:33","slug":"xpath-expressions","status":"publish","type":"post","link":"https:\/\/codethataint.com\/blog\/xpath-expressions\/","title":{"rendered":"XPath expressions"},"content":{"rendered":"<p><strong>Element Locators using XPath<\/strong><\/p>\n<p><em>Expressions<\/em><\/p>\n<pre class=\"brush: java; title: ; notranslate\" title=\"\">\r\n xpath=xpathExpression\r\n<\/pre>\n<pre class=\"brush: java; title: ; notranslate\" title=\"\">\r\n   xpath=\/\/img&#x5B;@alt='The image alt text']\r\n   xpath=\/\/table&#x5B;@id='table1']\/\/tr&#x5B;4]\/td&#x5B;2]\r\n   xpath=\/\/a&#x5B;contains(@href,'#id1')]\r\n   xpath=\/\/a&#x5B;contains(@href,'#id1')]\/@class\r\n   xpath=(\/\/table&#x5B;@class='stylee'])\/\/th&#x5B;text()='theHeaderText']\/..\/td\r\n   xpath=\/\/input&#x5B;@name='name2' and @value='yes']\r\n   xpath=\/\/*&#x5B;text()=&quot;right&quot;]\r\n<\/pre>\n<p><em>DOM &#8211; Javascript<\/em><\/p>\n<pre class=\"brush: java; title: ; notranslate\" title=\"\">\r\n xpath=xpathExpression\r\n<\/pre>\n<pre class=\"brush: java; title: ; notranslate\" title=\"\">\r\n dom=document.forms&#x5B;'myForm'].myDropdown\r\n dom=document.images&#x5B;56]\r\n dom=function foo() { return document.links&#x5B;1]; }; foo();\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Element Locators using XPath Expressions xpath=xpathExpression xpath=\/\/img&#x5B;@alt=&#8217;The image alt text&#8217;] xpath=\/\/table&#x5B;@id=&#8217;table1&#8242;]\/\/tr&#x5B;4]\/td&#x5B;2] xpath=\/\/a&#x5B;contains(@href,&#8217;#id1&#8242;)] xpath=\/\/a&#x5B;contains(@href,&#8217;#id1&#8242;)]\/@class xpath=(\/\/table&#x5B;@class=&#8217;stylee&#8217;])\/\/th&#x5B;text()=&#8217;theHeaderText&#8217;]\/..\/td xpath=\/\/input&#x5B;@name=&#8217;name2&#8242; and @value=&#8217;yes&#8217;] xpath=\/\/*&#x5B;text()=&quot;right&quot;] DOM &#8211; Javascript xpath=xpathExpression dom=document.forms&#x5B;&#8217;myForm&#8217;].myDropdown dom=document.images&#x5B;56] dom=function foo() { return document.links&#x5B;1]; }; foo();<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[61],"tags":[],"class_list":["post-381","post","type-post","status-publish","format-standard","hentry","category-xpath"],"_links":{"self":[{"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/posts\/381","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/comments?post=381"}],"version-history":[{"count":4,"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/posts\/381\/revisions"}],"predecessor-version":[{"id":385,"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/posts\/381\/revisions\/385"}],"wp:attachment":[{"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/media?parent=381"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/categories?post=381"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/tags?post=381"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}