April 7, 2020
Hi Team,
I am trying to extract the data from HTML for <li and div tag which are under <ul tag. There are list of ul tags
The data i'm trying to extract is mentioned in sheet2 which is my output. Also, i have attached sample vba work file and HTML code which i tried.
FYI: There are two nodes of ul> class ="simple-list" in the Html tree. so i want to pull the first ul class, the code that i used to pull the first node is
driver.FindElementsByXPath("//ul[@class='simple-list'][1]") 'Pulls first element with the specified attribute.
Here i'm not able to pull the list as i have in sheet2. These code i need to run for multiple urls.
Any help or correction to my macro please.
Thanks
October 5, 2010
Hi Rajsha,
The HTML excerpt you provided only had 1 UL in it, but that's ok to get this working.
However there are other bits of code that are malformed that will affect the code if that's the way the web page is.
The first 3 divs in the list (5,4, and 3) that look like this:
<div class="wo-notes" data-bind="html: note()">Enterprise Note: Status has been changed from status date</div>
are missing their closing </div> tags so when extracting the text, the code was pulling text from divs further down the list.
I fixed this in the sample code you provided (and I've reattached here) but if the website is malformed like this, you'll have to make adjustments in the code to compensate for this.
Regards
Phil
Answers Post
April 7, 2020
Hi Philip,
Thank you soo much (you are great) that code worked fine. Really i was struggling for that code... you solved it. I'm sorry, that closing div part is missed by me, sorry for the trouble i gave because i know how irritating when something goes wrong with the code. Thanks for the corrections and the help.
Regards
Raj
1 Guest(s)