dil_bert Posted February 11, 2018 Share Posted February 11, 2018 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 xpathwell 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 Quote Link to comment https://forums.phpfreaks.com/topic/306500-is-there-a-way-to-get-the-xpath-in-google-chrome/ Share on other sites More sharing options...
requinix Posted February 11, 2018 Share Posted February 11, 2018 Load it into a DOM document, then you can use querySelector/All and even stuff like jQuery with it. Quote Link to comment https://forums.phpfreaks.com/topic/306500-is-there-a-way-to-get-the-xpath-in-google-chrome/#findComment-1556268 Share on other sites More sharing options...
dil_bert Posted February 11, 2018 Author Share Posted February 11, 2018 good day dear Requinix. many thank for the quick aswer and the hint. i will do as adviced. btw: the tools of chrome seems more apropiate than the FireBug-tools. greetings dil_bert Quote Link to comment https://forums.phpfreaks.com/topic/306500-is-there-a-way-to-get-the-xpath-in-google-chrome/#findComment-1556300 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.