Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
donuts236726y@bkwilliams not really sure it fits my usage and the sample code is hard to understand how it works generally...
What I'd like is I pass in a HTML string and it returns some sort of HtmlDocument then I can var nodes = doc.findByElementType(".//div[@class='row']/a");
for (var x in nodes) { ... } -
If you are already using JS, just use JS.
[stolen from SO]
https://stackoverflow.com/questions...
var parser = new DOMParser();
var htmlDoc = parser.parseFromString(txt, 'text/html');
// do whatever you want with htmlDoc.getElementsByTagName('a');
But I use Selenium/ChromeDriver with HAP in C# so I’m kinda guessing. -
donuts236726y@bkwilliams I need to create a Android app but to leave to relearn Android so gonna use ReactNative which supports some npm libraries
-
donuts236726y@dakkarant isn't that basically a browser? I meant more like a DOM library that can be used to read in HTML and then can return the elements I want via selectors
-
Froot75396yJSDom or Cheerio if you want jQuery. Both very good options and let you work with the document like you were in the browser
I prefer JSDom myself for the vanilla js experience. Can't stand jQuery 😀
Is there a HTML scraper library for JS/NPM like Selenium or HtmlAgilityPack where I can find elements by ID, XPath, element type and their attached attributes?
question