{"id":6710,"date":"2020-09-09T17:47:50","date_gmt":"2020-09-09T16:47:50","guid":{"rendered":"https:\/\/www.brainlabsdigital.com\/?p=6710"},"modified":"2025-06-20T20:36:00","modified_gmt":"2025-06-20T20:36:00","slug":"how-to-use-xpath-a-beginner-seo-guide","status":"publish","type":"post","link":"https:\/\/www.brainlabsdigital.com\/how-to-use-xpath-a-beginner-seo-guide\/","title":{"rendered":"How to use XPath: a beginner SEO\u2019s guide"},"content":{"rendered":"\n<p>XPath is one of those things I learned out of pure, unabashed hatred for data entry. There are few things more boring than clicking through a spreadsheet full of URLs in column A just to copy and paste their date published into column B.<\/p>\n\n\n\n<p>That\u2019s where XPath queries come in handy.<\/p>\n\n\n\n<p>XPath is the language we use to navigate to specific parts of an XML document, and with a single XPath query and the scraping tool of our choice (we like Screaming Frog and Google Sheets\u2019 IMPORTXML for scraping), we can grab information off of dozens of pages at once without ever having to do the copy\/paste dance that makes us wither away in our office chairs.<\/p>\n\n\n\n<p>In this article, I\u2019ll teach you a few XPath queries and how to use them for scraping webpage elements for SEO, and then I\u2019ll teach you some XPath syntax to write your own.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">XPath Cheat Sheet<\/h2>\n\n\n\n<p>Before we begin creating some of our own XPath queries for different pages, here\u2019s a list of queries that can be used on any site.<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td>XPath Query<\/td><td>Outcome<\/td><\/tr><tr><td><code>\/\/h1<\/code><\/td><td>Scrapes all h1s<\/td><\/tr><tr><td><code>\/\/title<\/code><\/td><td>Scrapes all titles<\/td><\/tr><tr><td><code>\/\/meta[@name='description']\/@content<\/code><\/td><td>Scrapes the meta description<\/td><\/tr><tr><td><code>\/\/@href<\/code><\/td><td>Scrapes all links<\/td><\/tr><tr><td><code>\/\/link[@rel=\u2019canonical\u2019]\/@href<\/code><\/td><td>Scrapes any canonicals<\/td><\/tr><tr><td><code>\/\/*[@itemtype]\/@itemtype<\/code><\/td><td>Scrapes types of schema<\/td><\/tr><tr><td><code>\/\/*[@hreflang]<\/code><\/td><td>Scrapes hreflang<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p>For pulling these elements off of a bunch of pages, I\u2019ve outlined two tools below:<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Scraping with XPath Method 1: Using Google Sheets\u2019 =IMPORTXML<\/h2>\n\n\n\n<p>1. Here\u2019s my Google Sheets document for scraping data off of different pages. I\u2019ve put the list of the URLs I want to scrape from in Column A:<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/lh6.googleusercontent.com\/XW_FcjaFLfrMBI7DmIPwPF8HC0n3r3JYWKExmTYeYUJXnDM59TC74ilWmCB5Zmbl6vi2ADYlR8z-br7uIL59AjObwd8kzSL6px047C94OpjqxdW8zaFtDDQEg_KyY9GlOFDkYGrO\" alt=\"Google Sheets table with column for urls and titles\n\" width=\"692\" height=\"496\"\/><\/figure><\/div>\n\n\n\n<p>2. In column B, I\u2019m going to use the function on each URL listed in Column A:<br><em>=IMPORTXML(URL, XPath query)<\/em><\/p>\n\n\n\n<p>IMPORTXML takes two parameters:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>URL: the URL you want to pull the data from OR the cell name that contains the URL<\/li><li>XPath query: the XPath query you\u2019d like to use.<\/li><\/ul>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/lh5.googleusercontent.com\/lkfhPc0yKJtoVb1GSGtnVXvUYuQHDqP-Sf58zbT4agGwex8Ik9L-Y10m90gbLlBnH-EKsl7VhHsoFudPCCuGdiLKtKoA01jSHzDKFIELxRGjbY2oSQGB42OpigpYUNjHJ8aapcpg\" alt=\"Google Sheets cell using formula =importxml(A3, \u201c\/\/title\u201d)\n\" width=\"766\" height=\"69\"\/><\/figure><\/div>\n\n\n\n<p>For this example, our function looks like this:<\/p>\n\n\n\n<p>=IMPORTXML(A3, \u201c\/\/title\u201d)<\/p>\n\n\n\n<p>Note the quotations marks! You\u2019ll know it\u2019s formatted properly when the XPath query turns green.<\/p>\n\n\n\n<p>Press enter, and you\u2019ve got yourself a page title!<\/p>\n\n\n\n<p>3. Copy &amp; paste the formula along Column B by highlighting the cell with the formula, and double clicking on the little square in the bottom right corner.<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/brainlabdev.wpenginepowered.com\/wp-content\/uploads\/2020\/08\/Screen-Shot-2020-07-28-at-4.21.12-PM-1-1024x122.png\" alt=\"Google Sheets cell with loaded page content using =importxml\n\" class=\"wp-image-6719\" width=\"797\" height=\"95\" srcset=\"https:\/\/www.brainlabsdigital.com\/wp-content\/uploads\/2020\/08\/Screen-Shot-2020-07-28-at-4.21.12-PM-1-1024x122.png 1024w, https:\/\/www.brainlabsdigital.com\/wp-content\/uploads\/2020\/08\/Screen-Shot-2020-07-28-at-4.21.12-PM-1-300x36.png 300w, https:\/\/www.brainlabsdigital.com\/wp-content\/uploads\/2020\/08\/Screen-Shot-2020-07-28-at-4.21.12-PM-1-768x92.png 768w, https:\/\/www.brainlabsdigital.com\/wp-content\/uploads\/2020\/08\/Screen-Shot-2020-07-28-at-4.21.12-PM-1.png 1476w\" sizes=\"auto, (max-width: 797px) 100vw, 797px\" \/><\/figure><\/div>\n\n\n\n<p>That\u2019s it, you\u2019re done!<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/lh3.googleusercontent.com\/9IKjEOv3RvHxYIY80bBncDV8EHH4sn6ZBjQYjrGzczBdoI8XgbgTtUM0IB5irUKVMfVO1S4HQCSwHg70j2Vfhc7Q9svBhLLeDP0UxoRyZt1SU_WQDLy_hc5o6ZeYJ2r0tU1ypgFo\" alt=\"Completed Google Sheets table with URLs and corresponding titles\n\" width=\"626\" height=\"414\"\/><\/figure><\/div>\n\n\n\n<p>* A few notes on using =ImportXML. ImportXML is best used when:<\/p>\n\n\n\n<ol class=\"wp-block-list\"><li>You\u2019re working with a smaller sized set of pages. After using ImportXML about 50 times on one sheet, you start to get \u201cloading\u201d errors that never resolve themselves.<\/li><li>The data you\u2019re planning to pull hasn\u2019t been modified by Javascript.<\/li><\/ol>\n\n\n\n<p>Often times if I can\u2019t get ImportXML to work, and my XPath query checks out in the DevTools bar on Chrome (Mac: Command + Option + I \u2192 Command + F to open up the search bar), I\u2019ll use Screaming Frog\u2019s custom extraction instead.<\/p>\n\n\n\n<p><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Scraping with XPath Method 2: Screaming Frog Custom Extraction<\/h2>\n\n\n\n<p><a href=\"https:\/\/www.screamingfrog.co.uk\/\">Screaming Frog<\/a> is an extremely robust site crawling tool that we use at Brainlabs. At its default, Screaming Frog will already give you the title, h1, meta description, canonicals, internal links, status codes, etc. For scraping other parts of a page, it has a handy tool called Custom Extraction. Here\u2019s how to use it.<\/p>\n\n\n\n<p>1. In the Screaming Frog toolbar, click on Configuration &gt; Custom &gt; Extraction.<br><\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/lh3.googleusercontent.com\/K1CMVVgWVFfkGuJCq0Ru69OTjc_zUqahlHNeVyF3v0tdMyF8jANcozBQinRbj73u_MRHAjOkfV641Lwm4UWkEQ8c-ppc7qHRO2YBH_j9kJfa7AzPwI-gmnoZZA9qa6g7zlFP72tO\" alt=\"Screaming frog configuration menu with custom &amp; extraction highlighted\" width=\"512\" height=\"276\"\/><\/figure><\/div>\n\n\n\n<p>This custom extraction window should pop up:<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/brainlabdev.wpenginepowered.com\/wp-content\/uploads\/2020\/08\/Screen-Shot-2020-08-05-at-2.55.08-PM-1-2-1-1024x445.png\" alt=\"Screaming frog custom extraction window\n\" class=\"wp-image-6722\" width=\"715\" height=\"310\" srcset=\"https:\/\/www.brainlabsdigital.com\/wp-content\/uploads\/2020\/08\/Screen-Shot-2020-08-05-at-2.55.08-PM-1-2-1-1024x445.png 1024w, https:\/\/www.brainlabsdigital.com\/wp-content\/uploads\/2020\/08\/Screen-Shot-2020-08-05-at-2.55.08-PM-1-2-1-300x131.png 300w, https:\/\/www.brainlabsdigital.com\/wp-content\/uploads\/2020\/08\/Screen-Shot-2020-08-05-at-2.55.08-PM-1-2-1-768x334.png 768w, https:\/\/www.brainlabsdigital.com\/wp-content\/uploads\/2020\/08\/Screen-Shot-2020-08-05-at-2.55.08-PM-1-2-1-1536x668.png 1536w, https:\/\/www.brainlabsdigital.com\/wp-content\/uploads\/2020\/08\/Screen-Shot-2020-08-05-at-2.55.08-PM-1-2-1.png 1600w\" sizes=\"auto, (max-width: 715px) 100vw, 715px\" \/><\/figure><\/div>\n\n\n\n<p>2. Click Add, and fill in the boxes with the name of your extractor and your XPath query. Make sure to set the dropdown box to XPath!<\/p>\n\n\n\n<p>For the purposes of this example, I\u2019ll be pulling the dates off of five Brainlabs blog posts, so for the second dropdown box, I\u2019ll want to use either \u201cExtract Text\u201d (which pulls only the text content of the selected element) or \u201cExtract Inner HTML\u201d (which pulls everything inside the element that we\u2019re selecting, including other HTML elements).<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/lh6.googleusercontent.com\/EHG2eChOKVWbQrfsMkHYApK8ju0loENiOmypdUnDlMt10CkkdlqhvuDHhfCDXMTobey7C74DexsfZoRHCjXGRfQJV20EK4-fHtrNWWLKOUyX-DJTfpHgzIWdIsncBORZ3IFi_PwO\" alt=\"Brainlabs blog post \u201cOrganic traffic down YoY? It\u2019s not what you think\u2026\u201d with source code\n\" width=\"925\" height=\"327\"\/><figcaption><br><\/figcaption><\/figure><\/div>\n\n\n\n<p>You can use Custom Extraction for other things that we won\u2019t cover in this article, so I\u2019ve linked to <a href=\"https:\/\/www.screamingfrog.co.uk\/seo-spider\/user-guide\/configuration\/#custom-extraction\">Screaming Frog\u2019s Custom Extraction guide here<\/a>.<br><br>Click <strong>OK<\/strong>.<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large\"><img decoding=\"async\" src=\"https:\/\/brainlabdev.wpenginepowered.com\/wp-content\/uploads\/2020\/08\/Screen-Shot-2020-08-05-at-2.55.08-PM-1-3024x101.png\" alt=\"Screaming Frog custom extraction window\u2019s \u201cOK\u201d button\" class=\"wp-image-6714\"\/><\/figure><\/div>\n\n\n\n<p>3. Now we want to tell Screaming Frog which URLs to crawl. Go back to the toolbar and click Mode &gt; List. This allows us to crawl specific pages rather than entire sites.<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/lh4.googleusercontent.com\/gXQpXbRLUkwJgIzRAu7uBCWowRAK7mSYMvgSuKTRVBwnOa72diZ0FpJCjLA9ry2G_8yUTyxmWwRawIsvjRjYPspdk-n14jVqKWdAwq2q4CIWBJ7ENcwF1jpSoGcIAtlk77Ln3Pcz\" alt=\"Screaming Frog \u201cMode\u201d menu with \u201clist\u201d option checked\n\" width=\"714\" height=\"133\"\/><figcaption><br><\/figcaption><\/figure><\/div>\n\n\n\n<p>4. Click Upload &gt; Enter Manually. (If you have a file of all your URLs, you can use From a File instead)<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/lh3.googleusercontent.com\/FsK7OYMfjZ4EKIKHwnJlX1pY7gBCsHhl2GU0NoenKYDy4B91e1fdhCHNhUdN1T4nVwHXCvsQg11RznIXTfbEr4plEg_4FAE6iJgOEiArWxLXL-af8leABeXKRAQjb81ZBdVbbL6R\" alt=\"Screaming Frog \u201cUpload\u201d button menu with \u201cEnter Manually\u201d button highlighted\" width=\"723\" height=\"118\"\/><figcaption><br><\/figcaption><\/figure><\/div>\n\n\n\n<p>5. Copy and paste your URLs into the box, and follow the prompts on the URL List window. Screaming Frog should start crawling automatically!<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/lh4.googleusercontent.com\/fol7v8YAS3TaAYAH5U3jmmPD5cmPWm9E2mK0jkVe5GcR78DDCc7Q1LRFBPGj9_m_D8FlRk7Qq6ojmlgV2pV_t2Yu8CIPVG4x4GwzmQ4aRceiQ15Z7kc8G7ks2KOsAV0cRy4PZmD9\" alt=\"Screaming Frog URL list window with brainlabsdigital.com URLs in the text box\n\" width=\"470\" height=\"368\"\/><\/figure><\/div>\n\n\n\n<p>6. When Screaming Frog is finished crawling, in the main window, scroll all the way over to the right to see your Custom Extraction, or click on the Custom Extraction Tab within the Screaming Frog window.<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/lh6.googleusercontent.com\/LkXHg4q75ZQTl22rHVDN7ctkwSkhxpIwkeBZy29z0MG7ut1Ulf1YY81vmz7k2Wj6GaeRdVp484hNazngNQ4H82lPEQd1qGbkYQtP2EBt8JAPnIV-G_STHsIqGGqO8q0WivVUlA0d\" alt=\"Screaming Frog completed crawl with Custom Extraction tab open\n\" width=\"741\" height=\"198\"\/><\/figure><\/div>\n\n\n\n<p>7. Click Export, and that\u2019s it! You\u2019ve got your very own list of custom extracted dates!<\/p>\n\n\n\n<p>So you have your cheat sheet of XPath queries and a few ways to use them at scale. What if you want to create your own Xpath query? In order to do this, you\u2019ll need to know a few symbols that help string together the parts on an HTML document.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Path Expressions: <code>\/<\/code> and <code>\/\/<\/code><\/h2>\n\n\n\n<p>Here\u2019s an HTML page with Google\u2019s DevTools opened up (on Mac: COMMAND+OPTION+I)<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/lh3.googleusercontent.com\/jPPd8ow5neHSxd6rHlgalXbCdc-VysAf_cbWcmQEYY500eP0V0D36tqjAtB9pLeoTdz3R1MlSxBvBt2Qw7PMRwznfNLILkUuc7ySRvLy4quYbvaqg2oubXCUFLuak9apu31JfAz8\" alt=\"HTML file in Chrome with DevTools opened\n\" width=\"913\" height=\"192\"\/><\/figure><\/div>\n\n\n\n<p>HTML pages are made up of <strong>element nodes<\/strong>. Notice how nodes are nestled inside the nodes above them:<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/lh5.googleusercontent.com\/fRBqtiK2hdJ0_kJuoW0dhX7IvL9fKBS3_Xy4ubPmAU1PB0UwXl5b81leNayQKaAM5M0hFCMQKe5hiFNV5W6AfVNjwMx56qHHyqeUWRGPrJibezn7r0WYN4heM6snV0ByPwmqW033\" alt=\"HTML file\u2019s source code with html, head, body, h1, and p element nodes\n\" width=\"917\" height=\"246\"\/><\/figure><\/div>\n\n\n\n<p>&nbsp;The <code>&lt;p&gt;<\/code> node and the <code>&lt;h1&gt;<\/code> node is nestled inside the <code>&lt;body&gt;<\/code> node, which is inside the <code>&lt;html&gt;<\/code> node. This is important to note since writing out XPath is usually a matter of writing out the nodes in order of \u201cbiggest to smallest\u201d.<\/p>\n\n\n\n<p>Let\u2019s say we wanted to collect the stuff inside the <code>&lt;p&gt;<\/code> node. There are a few ways we could write our XPath query out.<\/p>\n\n\n\n<p>I like to start by opening up Google\u2019s DevTools (mac: COMMAND+OPTION+I) on the page with the search panel open (mac: COMMAND+F) to test out potential XPath queries.<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/lh3.googleusercontent.com\/lSI3f9yzcrFTuabwOYxdIFej2xi6Osu-ke1al5-SaArdP47BhnIOf1VgrLo1YViGZGknXKPeeoDlOafl9LmsUdJYhwFXBlUAnrsOzFi_gjKwv9tImAX_AEFPt_xfNAZsBeCrs1-H\" alt=\"Google DevTools with search panel open\n\" width=\"572\" height=\"460\"\/><\/figure><\/div>\n\n\n\n<p>Typing out your XPath in the search bar lets you check your work because when your XPath query is correct, it\u2019ll highlight the element (or elements) that the XPath points to in the source code.<\/p>\n\n\n\n<p>In this example, there are many different ways to get to the same <code>&lt;p&gt;<\/code> node. For now, we can use <code>\/<\/code> and <code>\/\/<\/code> to accomplish our goal.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">1. <code>\/<\/code><\/h3>\n\n\n\n<p>If used at the beginning of the expression, \/ establishes the <strong>root node <\/strong>or the biggest node in the document. Since we\u2019re using XPath for HTML, the root node will always be <code>\/html<\/code><\/p>\n\n\n\n<p>When \/ is used <em>after <\/em>the root node, it signals the start of the node that is nestled directly inside of the node before it. So for our example, using just \/ to create our XPath query would look like this:<\/p>\n\n\n\n<p><code>\/html\/body\/p<\/code><\/p>\n\n\n\n<p>What the above query is asking is to find the <code>&lt;p&gt;<\/code> node, which is inside the <code>&lt;body&gt;<\/code> node, which is inside the <code>&lt;html&gt;<\/code> node. And don\u2019t go skipping nodes!<\/p>\n\n\n\n<p>\u274c    Don\u2019t: <code>\/html\/p<\/code><\/p>\n\n\n\n<p>We won\u2019t be able to find our <code>&lt;p><\/code> node if we don\u2019t look through the <code>&lt;body><\/code> node first.<\/p>\n\n\n\n<p>\u274c    Don\u2019t: <code>\/html\/body\/h1\/p<\/code><\/p>\n\n\n\n<p>Although the <code>&lt;p&gt;<\/code> node comes after the <code>&lt;h1&gt;<\/code> node, the <code>&lt;p&gt;<\/code> node isn\u2019t nestled <em>inside <\/em>of the <code>&lt;h1&gt;<\/code> node.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">2. <code>\/\/<\/code><\/h3>\n\n\n\n<p><code>\/\/<\/code> allows you to \u201ccheat\u201d and start the expression at any node. <code>\/\/<\/code> pulls ALL of the elements of that node name, no matter where they are in the document&nbsp;<\/p>\n\n\n\n<p>To find the <code>&lt;p&gt;<\/code> node in our example, it could look like this:<\/p>\n\n\n\n<p><code>\/\/p<\/code><\/p>\n\n\n\n<p>Or this:<\/p>\n\n\n\n<p><code>\/\/body\/p<\/code><\/p>\n\n\n\n<h3 class=\"wp-block-heading\">3. Google Chrome Copy XPath<\/h3>\n\n\n\n<p>Google Chrome has a handy feature that copies an element\u2019s XPath.<\/p>\n\n\n\n<p>In Chrome, highlight the element whose XPath you\u2019d like to copy:<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/lh5.googleusercontent.com\/cZufVepd2iqxXY2VaXbirQaIdM4nljaf8X2Pg64fQujdSRSP9vRohQM4ZCVA_nORozvDGlZB2LDlvvxkL7jtUAIBHGT3vovqYP8BDRd5SJBYqMV9lTzfTDAXDPAoDfQFLjO-1rPO\" alt=\"HTML text context menu with \u201cInspect\u201d button highlighted\n\" width=\"328\" height=\"276\"\/><\/figure><\/div>\n\n\n\n<p>Right click the highlighted element &gt; Inspect. This brings up Chrome\u2019s DevTools.<\/p>\n\n\n\n<p>Right click on the element within DevTools &gt; Copy &gt; Copy XPath.<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/lh4.googleusercontent.com\/1JynCrlvRcr669YsV_NskdmIVjU7E_n6JiEGIz4hZ-A9DpxpooZy1MVt6uBX_t2HXMhcl5waIuSc-a6oq71KAE45ULB7HPMBJwUSo9Zfk42g0KyqVTL5lPC2uLgBFLFd9_kwLT5K\" alt=\"DevTools context menu with \u201ccopy\u201d and \u201ccopy xpath\u201d button highlighted\n\" width=\"356\" height=\"307\"\/><\/figure><\/div>\n\n\n\n<p>And Paste! Here\u2019s what it should look like:<\/p>\n\n\n\n<p><code>\/html\/body\/p<\/code><\/p>\n\n\n\n<p>This is the XPath query for your highlighted element, written out node by node. This is a quick and easy method to find an element\u2019s XPath as long as you only want one element from the page.<\/p>\n\n\n\n<p>What if the HTML document looked like this, and we wanted to navigate to the second <code>&lt;p&gt;<\/code> element?<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/lh3.googleusercontent.com\/ok76VCk1gyCyZYyyTW1uzV1bjMZFdY-IsIShTQ5xYquwFGys4yu01_ajYuDcWrWnzvqXOxIUKBtbJDEn4RMDiUCyMbwqnrX9uKojQvMvaEZCc6-VsEH3GRjyodKgVWjVVVa_kFvs\" alt=\"HTML file in Chrome with DevTools opened\"\/><\/figure>\n\n\n\n<p>Here are some XPath queries that you could use:<\/p>\n\n\n\n<p>\u2705  <code>\/html\/body\/div\/p<\/code><\/p>\n\n\n\n<p>\u2705  <code>\/\/body\/div\/p<\/code><\/p>\n\n\n\n<p>\u2705  <code>\/\/div\/p<\/code><\/p>\n\n\n\n<p>And here are some ways that won\u2019t work:<\/p>\n\n\n\n<p>\u274c  <code>\/\/p<\/code><\/p>\n\n\n\n<p>This will pull both <code>&lt;p&gt; <\/code>nodes.<\/p>\n\n\n\n<p>\u274c  <code>\/\/body\/p<\/code><\/p>\n\n\n\n<p>This will pull only the p tag that is DIRECTLY within the body. It will not pull the p that is also within the <code>&lt;div&gt;<\/code> node.<\/p>\n\n\n\n<p>\u274c  <code>\/\/body\/\/p<\/code><\/p>\n\n\n\n<p>This will pull both <code>&lt;p&gt;<\/code> tags.<\/p>\n\n\n\n<p>Now that we\u2019ve practiced <code>\/\/<\/code> and <code>\/<\/code> expressions, let\u2019s move on to some additional expressions that help refine your XPath queries.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">More XPath Syntax: <code>@<\/code><\/h2>\n\n\n\n<p>In the big ol\u2019 internet, HTML code often looks more complex than the above-mentioned examples. For instance, here\u2019s the first bit of HTML that makes up Brainlabs\u2019 homepage:<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/lh4.googleusercontent.com\/75jra5abvrOquP9iwvYA0hbLDdehTNnaBOih6XvxYNwX0PhetAXlSoqn_YthN_GT5ODEGVN-yYTPMD8SBDTn4PFhgBuUtw1NegOiY97QNQXvemWU4M3f8QYhOLUoJkwPzEs4nU8P\" alt=\"DevTools source code of Brainlabs\u2019 homepage\n\" width=\"607\" height=\"421\"\/><\/figure><\/div>\n\n\n\n<p>With a page like this, you wouldn\u2019t get any valuable information out of pulling things out by the element node name alone. There are just too many divs on the page. That\u2019s where attributes come in.<\/p>\n\n\n\n<p>You\u2019ll notice that there are some elements that have \u201caccessories\u201d attached to the node name:<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/brainlabdev.wpenginepowered.com\/wp-content\/uploads\/2020\/08\/Screenshot-2020-08-24-at-15.58.53-1.png\" alt=\"Div element on Brainlabs\u2019 homepage\n\" class=\"wp-image-6716\" width=\"606\" height=\"20\" srcset=\"https:\/\/www.brainlabsdigital.com\/wp-content\/uploads\/2020\/08\/Screenshot-2020-08-24-at-15.58.53-1.png 599w, https:\/\/www.brainlabsdigital.com\/wp-content\/uploads\/2020\/08\/Screenshot-2020-08-24-at-15.58.53-1-300x10.png 300w\" sizes=\"auto, (max-width: 606px) 100vw, 606px\" \/><\/figure><\/div>\n\n\n\n<p>This div has a class <code>\u201dimp-tooltips-container\u201d<\/code> and a data-imp-tooltips-container <code>\u201c6989\u201d<\/code>.<\/p>\n\n\n\n<p>And this <code>&lt;a&gt;<\/code> has an href <code>\u201chttps:\/\/www.brainlabsdigital.com\/services\/\"<\/code>.<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/lh5.googleusercontent.com\/7SewAX87_C4RoOvYMCcEdk2CHDtYR61kYSHtDsXsdrjLg6YdrbrO7fKfNAdgFZNOwgmyb8r-xzDNBj3RkSKhLsBBq5VrXPCnPb5u_TV_NDWwOaSlwRS16UTJsWe9FdMTIt9i4sNx\" alt=\"link element on Brainlabs\u2019 homepage\n\" width=\"611\" height=\"22\"\/><\/figure><\/div>\n\n\n\n<p>These are called <strong>attributes<\/strong>, and they\u2019re the secret ingredient to making a good XPath query. With them, we can specify which elements we want to select by pulling them with \u201c@\u201d.<\/p>\n\n\n\n<p>Here\u2019s how we can use @, along with some examples of XPath queries in context (for this example, I\u2019m scraping a Brainlabs blog post).<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/lh4.googleusercontent.com\/90gfMxO3JWBk6MXecZuAOg6kwkhRxkiLS9g_scyYHeqwm1ooz7qV3vyef_-5sp80sxQQ6P3NYakQcxqsvrUwjC9ifquMSZUk2MEXkMFVzFdKMOhSsFkM4lc2gEaHNAm-rVcYfVjx\" alt=\"Brainlabs blog post with DevTools open\n\" width=\"862\" height=\"352\"\/><figcaption><br><\/figcaption><\/figure><\/div>\n\n\n\n<h3 class=\"wp-block-heading\"><code>@attribute<\/code><\/h3>\n\n\n\n<p>selects the value of the attribute<\/p>\n\n\n\n<p>Example: <code>\/\/a\/@href<\/code><\/p>\n\n\n\n<p>This xpath query is asking to pull every href attribute within all <code>&lt;a&gt;<\/code> nodes.<\/p>\n\n\n\n<p>It won\u2019t, however, pull the anchor text within the <code>&lt;a&gt;<\/code> nodes. For that, you would use <code>\/\/a<\/code>. <\/p>\n\n\n\n<p>\ud83d\udca1 Tip! To easily find your element of interest\u2019s source code, right click the content directly on the webpage, and click inspect. Chrome DevTools should pop up, with the element highlighted in the source code.<\/p>\n\n\n\n<figure class=\"wp-block-image is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/lh5.googleusercontent.com\/YPuLu_3JtxjvQ1kWvddlVfLkxetpcNsppT8HJKnVlPAxSKPqr3PH-Od-ib7nl-gCC2159JrXoKWO5696W37jBiKn_d_ThtjxUIF7fGaTeijvhzf06Z2stzdpaXUGbwqf1U0bwHUq\" alt=\"Page copy context menu with \u201cInspect\u201d button highlighted\" width=\"297\" height=\"275\"\/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">XPath Syntax Lightning Round<\/h2>\n\n\n\n<p>Here are a few more expressions you can add on to your XPath query. For this example, I\u2019m using this Brainlabs blog post to show you how these expressions can be used.<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/lh5.googleusercontent.com\/HtRIMa4cTyj6xwXGMAx_ndgdpV_sTl-MFALWDTX6TE1xUhNLR-C7f3gIGrNRlOq4f4jUARUizfUZm58qtUhJAYngck92o5zkqUl-IoRuWomN2jmjXtJTruB6Bj8kIGL_hXPcT1TC\" alt=\"Brainlabs blog post\n\" width=\"545\" height=\"456\"\/><\/figure><\/div>\n\n\n\n<h3 class=\"wp-block-heading\">1. <code>[1]<\/code><\/h3>\n\n\n\n<p>This selects the first of multiple elements:<\/p>\n\n\n\n<p>Example. <code>\/\/figure[1]\/img\/@alt<\/code><\/p>\n\n\n\n<p>Pulls the first image\u2019s alt text.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">2. <code>contains(@attribute, \u2018text\u2019)<\/code><\/h3>\n\n\n\n<p>This selects every node with an attribute that partially matches the text provided:<\/p>\n\n\n\n<p>Example. <code>\/\/ul[@id='menu-main-menu']\/li[contains(@id, 'nav-menu-item')]\/\/a\/@href<\/code><\/p>\n\n\n\n<p>In Brainlabs\u2019 navigation menu, all the menu options have an id \u2018<code>nav-menu-item-####<\/code>\u2019 with a different 4 digit number at the end. We can pull all the menu options by using <code>contains(@id, \u2018nav-menu-item\u2019)<\/code> which will ignore the 4 digit number at the end of the menu option id.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">3. <code>|<\/code><\/h3>\n\n\n\n<p>This selects multiple elements:<\/p>\n\n\n\n<p>Example. <code>\/\/figure[1]\/img\/@src | \/\/figure[1]\/img\/@alt<\/code><\/p>\n\n\n\n<p>Pulls the image source file AND the alt text<\/p>\n\n\n\n<p>And here\u2019s what a Screaming Frog export looks like when you plug in these XPath queries into the Custom Extraction tool (I reformatted on Google Sheets first):<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/lh3.googleusercontent.com\/6fFT3rEVRd41DBeIeGh2mvVrhZcJX4AKmZRKnUgil6DuuUTZXOpvEZvs2xx-unU8VvIuOUFb18ybrFtspthuFAjJ2T1C9ZYI8vGh5gCmI7U5JCughNOt42sD-L0ZMuvnrg4mzn1m\" alt=\"Google Sheets table of Screaming Frog custom extraction output\n\" width=\"787\" height=\"393\"\/><figcaption><br><\/figcaption><\/figure><\/div>\n\n\n\n<h2 class=\"wp-block-heading\">Conclusion &amp; Further Readings<\/h2>\n\n\n\n<p>There are many more ways to customize your XPath query, like adding functions, using true\/false operators, and wildcards. For further reading, I recommend <a href=\"https:\/\/www.w3schools.com\/xml\/xpath_syntax.asp\">W3School\u2019s guide<\/a> and <a href=\"https:\/\/librarycarpentry.org\/lc-webscraping\/02-xpath\/index.html\">librarycarpentry\u2019s Introduction to Webscraping<\/a> to become a true XPath master.<\/p>\n\n\n\n<p>That\u2019s all I\u2019ve got for you today! I hope this guide helped you learn the basics for using XPath to scrape data, and I hope you never have to manually record data ever again.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>XPath is one of those things I learned out of pure, unabashed hatred for data entry. There are few things more boring than clicking through a spreadsheet full of URLs in column A just to copy and paste their date published into column B. That\u2019s where XPath queries come in handy. XPath is the language [&hellip;]<\/p>\n","protected":false},"author":4,"featured_media":6717,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":true,"footnotes":""},"categories":[42],"tags":[220],"class_list":["post-6710","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-seo","tag-xpath"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v25.7 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>XPath 101: SEO Tutorial &amp; Cheat Sheet - Brainlabs<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.brainlabsdigital.com\/how-to-use-xpath-a-beginner-seo-guide\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"XPath 101: SEO Tutorial &amp; Cheat Sheet - Brainlabs\" \/>\n<meta property=\"og:description\" content=\"XPath is one of those things I learned out of pure, unabashed hatred for data entry. There are few things more boring than clicking through a spreadsheet full of URLs in column A just to copy and paste their date published into column B. That\u2019s where XPath queries come in handy. XPath is the language [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.brainlabsdigital.com\/how-to-use-xpath-a-beginner-seo-guide\/\" \/>\n<meta property=\"og:site_name\" content=\"Brainlabs\" \/>\n<meta property=\"article:published_time\" content=\"2020-09-09T16:47:50+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-06-20T20:36:00+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.brainlabsdigital.com\/wp-content\/uploads\/2020\/08\/BL-Blog-XPath-Beginners-Guide-1200x628-1-1.png\" \/>\n\t<meta property=\"og:image:width\" content=\"1200\" \/>\n\t<meta property=\"og:image:height\" content=\"628\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"claudiu\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:image\" content=\"https:\/\/www.brainlabsdigital.com\/wp-content\/uploads\/2020\/08\/BL-Blog-XPath-Beginners-Guide-1200x628-1-1.png\" \/>\n<meta name=\"twitter:creator\" content=\"@Brainlabs\" \/>\n<meta name=\"twitter:site\" content=\"@Brainlabs\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"claudiu\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"10 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.brainlabsdigital.com\/how-to-use-xpath-a-beginner-seo-guide\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.brainlabsdigital.com\/how-to-use-xpath-a-beginner-seo-guide\/\"},\"author\":{\"name\":\"claudiu\",\"@id\":\"https:\/\/www.brainlabsdigital.com\/#\/schema\/person\/d2633d055821dd28cb40492b806e23ff\"},\"headline\":\"How to use XPath: a beginner SEO\u2019s guide\",\"datePublished\":\"2020-09-09T16:47:50+00:00\",\"dateModified\":\"2025-06-20T20:36:00+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.brainlabsdigital.com\/how-to-use-xpath-a-beginner-seo-guide\/\"},\"wordCount\":1885,\"publisher\":{\"@id\":\"https:\/\/www.brainlabsdigital.com\/#organization\"},\"image\":{\"@id\":\"https:\/\/www.brainlabsdigital.com\/how-to-use-xpath-a-beginner-seo-guide\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.brainlabsdigital.com\/wp-content\/uploads\/2020\/08\/BL-Blog-XPath-Beginners-Guide-1136x445-1-1.png\",\"keywords\":[\"xpath\"],\"articleSection\":[\"SEO\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.brainlabsdigital.com\/how-to-use-xpath-a-beginner-seo-guide\/\",\"url\":\"https:\/\/www.brainlabsdigital.com\/how-to-use-xpath-a-beginner-seo-guide\/\",\"name\":\"XPath 101: SEO Tutorial & Cheat Sheet - Brainlabs\",\"isPartOf\":{\"@id\":\"https:\/\/www.brainlabsdigital.com\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.brainlabsdigital.com\/how-to-use-xpath-a-beginner-seo-guide\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.brainlabsdigital.com\/how-to-use-xpath-a-beginner-seo-guide\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.brainlabsdigital.com\/wp-content\/uploads\/2020\/08\/BL-Blog-XPath-Beginners-Guide-1136x445-1-1.png\",\"datePublished\":\"2020-09-09T16:47:50+00:00\",\"dateModified\":\"2025-06-20T20:36:00+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/www.brainlabsdigital.com\/how-to-use-xpath-a-beginner-seo-guide\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.brainlabsdigital.com\/how-to-use-xpath-a-beginner-seo-guide\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.brainlabsdigital.com\/how-to-use-xpath-a-beginner-seo-guide\/#primaryimage\",\"url\":\"https:\/\/www.brainlabsdigital.com\/wp-content\/uploads\/2020\/08\/BL-Blog-XPath-Beginners-Guide-1136x445-1-1.png\",\"contentUrl\":\"https:\/\/www.brainlabsdigital.com\/wp-content\/uploads\/2020\/08\/BL-Blog-XPath-Beginners-Guide-1136x445-1-1.png\",\"width\":1136,\"height\":445},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.brainlabsdigital.com\/how-to-use-xpath-a-beginner-seo-guide\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.brainlabsdigital.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to use XPath: a beginner SEO\u2019s guide\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.brainlabsdigital.com\/#website\",\"url\":\"https:\/\/www.brainlabsdigital.com\/\",\"name\":\"Brainlabs\",\"description\":\"High-Performance Media Agency\",\"publisher\":{\"@id\":\"https:\/\/www.brainlabsdigital.com\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.brainlabsdigital.com\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.brainlabsdigital.com\/#organization\",\"name\":\"Brainlabs\",\"url\":\"https:\/\/www.brainlabsdigital.com\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.brainlabsdigital.com\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/www.brainlabsdigital.com\/wp-content\/uploads\/2025\/04\/cropped-25-Brainlabs-Color-Logo-Icon-1-300x300.png\",\"contentUrl\":\"https:\/\/www.brainlabsdigital.com\/wp-content\/uploads\/2025\/04\/cropped-25-Brainlabs-Color-Logo-Icon-1-300x300.png\",\"width\":300,\"height\":300,\"caption\":\"Brainlabs\"},\"image\":{\"@id\":\"https:\/\/www.brainlabsdigital.com\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/x.com\/Brainlabs\",\"https:\/\/www.linkedin.com\/company\/brainlabs-digital\/\",\"https:\/\/www.instagram.com\/brainlabs\/\",\"https:\/\/www.youtube.com\/@brainlabsmedia\/featured\",\"https:\/\/www.tiktok.com\/@brainlabsglobal?lang=en\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.brainlabsdigital.com\/#\/schema\/person\/d2633d055821dd28cb40492b806e23ff\",\"name\":\"claudiu\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.brainlabsdigital.com\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/4814cc0c790a1d2fe26b7690b22344dfde27b79d9ac47148e73322e9553a795b?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/4814cc0c790a1d2fe26b7690b22344dfde27b79d9ac47148e73322e9553a795b?s=96&d=mm&r=g\",\"caption\":\"claudiu\"},\"url\":\"https:\/\/www.brainlabsdigital.com\/author\/claudiu\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"XPath 101: SEO Tutorial & Cheat Sheet - Brainlabs","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.brainlabsdigital.com\/how-to-use-xpath-a-beginner-seo-guide\/","og_locale":"en_US","og_type":"article","og_title":"XPath 101: SEO Tutorial & Cheat Sheet - Brainlabs","og_description":"XPath is one of those things I learned out of pure, unabashed hatred for data entry. There are few things more boring than clicking through a spreadsheet full of URLs in column A just to copy and paste their date published into column B. That\u2019s where XPath queries come in handy. XPath is the language [&hellip;]","og_url":"https:\/\/www.brainlabsdigital.com\/how-to-use-xpath-a-beginner-seo-guide\/","og_site_name":"Brainlabs","article_published_time":"2020-09-09T16:47:50+00:00","article_modified_time":"2025-06-20T20:36:00+00:00","og_image":[{"width":1200,"height":628,"url":"https:\/\/www.brainlabsdigital.com\/wp-content\/uploads\/2020\/08\/BL-Blog-XPath-Beginners-Guide-1200x628-1-1.png","type":"image\/png"}],"author":"claudiu","twitter_card":"summary_large_image","twitter_image":"https:\/\/www.brainlabsdigital.com\/wp-content\/uploads\/2020\/08\/BL-Blog-XPath-Beginners-Guide-1200x628-1-1.png","twitter_creator":"@Brainlabs","twitter_site":"@Brainlabs","twitter_misc":{"Written by":"claudiu","Est. reading time":"10 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.brainlabsdigital.com\/how-to-use-xpath-a-beginner-seo-guide\/#article","isPartOf":{"@id":"https:\/\/www.brainlabsdigital.com\/how-to-use-xpath-a-beginner-seo-guide\/"},"author":{"name":"claudiu","@id":"https:\/\/www.brainlabsdigital.com\/#\/schema\/person\/d2633d055821dd28cb40492b806e23ff"},"headline":"How to use XPath: a beginner SEO\u2019s guide","datePublished":"2020-09-09T16:47:50+00:00","dateModified":"2025-06-20T20:36:00+00:00","mainEntityOfPage":{"@id":"https:\/\/www.brainlabsdigital.com\/how-to-use-xpath-a-beginner-seo-guide\/"},"wordCount":1885,"publisher":{"@id":"https:\/\/www.brainlabsdigital.com\/#organization"},"image":{"@id":"https:\/\/www.brainlabsdigital.com\/how-to-use-xpath-a-beginner-seo-guide\/#primaryimage"},"thumbnailUrl":"https:\/\/www.brainlabsdigital.com\/wp-content\/uploads\/2020\/08\/BL-Blog-XPath-Beginners-Guide-1136x445-1-1.png","keywords":["xpath"],"articleSection":["SEO"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/www.brainlabsdigital.com\/how-to-use-xpath-a-beginner-seo-guide\/","url":"https:\/\/www.brainlabsdigital.com\/how-to-use-xpath-a-beginner-seo-guide\/","name":"XPath 101: SEO Tutorial & Cheat Sheet - Brainlabs","isPartOf":{"@id":"https:\/\/www.brainlabsdigital.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.brainlabsdigital.com\/how-to-use-xpath-a-beginner-seo-guide\/#primaryimage"},"image":{"@id":"https:\/\/www.brainlabsdigital.com\/how-to-use-xpath-a-beginner-seo-guide\/#primaryimage"},"thumbnailUrl":"https:\/\/www.brainlabsdigital.com\/wp-content\/uploads\/2020\/08\/BL-Blog-XPath-Beginners-Guide-1136x445-1-1.png","datePublished":"2020-09-09T16:47:50+00:00","dateModified":"2025-06-20T20:36:00+00:00","breadcrumb":{"@id":"https:\/\/www.brainlabsdigital.com\/how-to-use-xpath-a-beginner-seo-guide\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.brainlabsdigital.com\/how-to-use-xpath-a-beginner-seo-guide\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.brainlabsdigital.com\/how-to-use-xpath-a-beginner-seo-guide\/#primaryimage","url":"https:\/\/www.brainlabsdigital.com\/wp-content\/uploads\/2020\/08\/BL-Blog-XPath-Beginners-Guide-1136x445-1-1.png","contentUrl":"https:\/\/www.brainlabsdigital.com\/wp-content\/uploads\/2020\/08\/BL-Blog-XPath-Beginners-Guide-1136x445-1-1.png","width":1136,"height":445},{"@type":"BreadcrumbList","@id":"https:\/\/www.brainlabsdigital.com\/how-to-use-xpath-a-beginner-seo-guide\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.brainlabsdigital.com\/"},{"@type":"ListItem","position":2,"name":"How to use XPath: a beginner SEO\u2019s guide"}]},{"@type":"WebSite","@id":"https:\/\/www.brainlabsdigital.com\/#website","url":"https:\/\/www.brainlabsdigital.com\/","name":"Brainlabs","description":"High-Performance Media Agency","publisher":{"@id":"https:\/\/www.brainlabsdigital.com\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.brainlabsdigital.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.brainlabsdigital.com\/#organization","name":"Brainlabs","url":"https:\/\/www.brainlabsdigital.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.brainlabsdigital.com\/#\/schema\/logo\/image\/","url":"https:\/\/www.brainlabsdigital.com\/wp-content\/uploads\/2025\/04\/cropped-25-Brainlabs-Color-Logo-Icon-1-300x300.png","contentUrl":"https:\/\/www.brainlabsdigital.com\/wp-content\/uploads\/2025\/04\/cropped-25-Brainlabs-Color-Logo-Icon-1-300x300.png","width":300,"height":300,"caption":"Brainlabs"},"image":{"@id":"https:\/\/www.brainlabsdigital.com\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/x.com\/Brainlabs","https:\/\/www.linkedin.com\/company\/brainlabs-digital\/","https:\/\/www.instagram.com\/brainlabs\/","https:\/\/www.youtube.com\/@brainlabsmedia\/featured","https:\/\/www.tiktok.com\/@brainlabsglobal?lang=en"]},{"@type":"Person","@id":"https:\/\/www.brainlabsdigital.com\/#\/schema\/person\/d2633d055821dd28cb40492b806e23ff","name":"claudiu","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.brainlabsdigital.com\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/4814cc0c790a1d2fe26b7690b22344dfde27b79d9ac47148e73322e9553a795b?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/4814cc0c790a1d2fe26b7690b22344dfde27b79d9ac47148e73322e9553a795b?s=96&d=mm&r=g","caption":"claudiu"},"url":"https:\/\/www.brainlabsdigital.com\/author\/claudiu\/"}]}},"lang":"en","translations":{"en":6710},"pll_sync_post":[],"_links":{"self":[{"href":"https:\/\/www.brainlabsdigital.com\/wp-json\/wp\/v2\/posts\/6710","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.brainlabsdigital.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.brainlabsdigital.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.brainlabsdigital.com\/wp-json\/wp\/v2\/users\/4"}],"replies":[{"embeddable":true,"href":"https:\/\/www.brainlabsdigital.com\/wp-json\/wp\/v2\/comments?post=6710"}],"version-history":[{"count":0,"href":"https:\/\/www.brainlabsdigital.com\/wp-json\/wp\/v2\/posts\/6710\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.brainlabsdigital.com\/wp-json\/wp\/v2\/media\/6717"}],"wp:attachment":[{"href":"https:\/\/www.brainlabsdigital.com\/wp-json\/wp\/v2\/media?parent=6710"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.brainlabsdigital.com\/wp-json\/wp\/v2\/categories?post=6710"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.brainlabsdigital.com\/wp-json\/wp\/v2\/tags?post=6710"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}