Jump to content

Recommended Posts

hello and good day

 


Is there a way to get the xpath in google chrome? I have a webpage I want to get  some data off:
 

 

 

https://wordpress.org/plugins/participants-database/
https://wordpress.org/plugins/amazon-link/
https://wordpress.org/plugins/simple-membership/
https://wordpress.org/plugins/scrapeazon/

 

 

 

i need the following data:

 

Version:

Last updated:

Active installations:

Tested up


see for example the following  -   view-source:https://wordpress.org/plugins/wp-job-manager/
      

     <li>Version: <strong>1.29.3</strong></li>
            <li>
                Last updated: <strong><span>5 days</span> ago</strong>            </li>
            <li>Active installations: <strong>100,000+</strong></li>

                            <li>
                Requires WordPress Version:<strong>4.3.1</strong>                </li>
            
                            <li>Tested up to: <strong>4.9.2</strong></li>
       

    
            
background: i need the data from all my favorite plugins -  want to have it in a db or a calc sheet. So there were approx 70 pages to scrape:_

so i need to have the xpath of those specific items.
I can see it in the debug tools area for google chrome but I don't see a way to copy that xpath.
Is there a way to copy a full xpath or an extension to do it?


some friends have told me that i can use $x in the Chrome javascript console. No extensions needed.
 

ex: $x("//img")


Also the search box in the web inspector will accept xpath

well the question is "how to get an xpath string for an element?", - i.e. a bit different from the question; "how do i select by xpath?"


well - we can right click on the node => "Copy XPath"

critical discussion: this method is somewhat a  brittle way to get an xpath, it's very likely to break as content changes. Well for some quick hacking: this method functions well. May the content change somedays - this is not so important to me..


There is another way with screenshot too.

From Chrome:

    Right click "inspect" on the item you are trying to find the xpath
    Right click on the highlighted area on the console.
    Go to Copy xpath
 

 

how woud you fetch the xpaths - in order to get the DOM-Data . that can help to parse &/ scrape the data!?

 

 

another question: how to scrape the data  of all the 70 pages

guess that " hardcoding is the way" -

 

i put all the urls into a file - then this can be used as a source for the scraper / parser to fetch all the pages...

 

look forward to hear from you

 

 



 

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.