Excel VBA web scaping element challenge -
i trying collect pricing data travel website.
below html , want retrieve number 2145.66 , put in excel cell.
<ul class="hotelresults"> <li class="image"><img src="http://images.libertytravel.com/shared/cpl/fcl/images/upload/suppliers/h/aua/rem/img_148208_medium.jpg" width="120" onerror="this.src='/images/book.libertytravel.com/no-pic.gif';"></li> <li class="detail"> <h4>renaissance marina hotel <img src="http://static0.traveltek.net/images/book.libertytravel.com/1star.png" alt="star"><img src="http://static0.traveltek.net/images/book.libertytravel.com/1star.png" alt="star"><img src="http://static0.traveltek.net/images/book.libertytravel.com/1star.png" alt="star"><img src="http://static0.traveltek.net/images/book.libertytravel.com/1star.png" alt="star"></h4> <span class="mytime"></span><span class="hotelpref"></span> <h5>aruba</h5> <span id="desc_555_0.1">experience fresh twist on stay , play in stylish, sophisticated atmosphere @ renaissance aruba resort , casino. </span><a href="/fusion/searchsinglehotel.pl?sessionkey=f5afd4b1-782cl4a8b-9b26-ac8eae88c1e5&chosenhotel=555_0.1&chosenflight=617_0.0">see details</a> </li> <li class="price"> <script language="javascript"> event.observe(window, "load", function() { $$('span.roomprice').each(function(element) { element.innerhtml = properrounding(element.innerhtml, 2); }); }); </script> <table width="100%" cellspacing="0" cellpadding="0" border="0" class="roomsrow"> <tr class="hide"> <td colspan="3" class="sectionheader"> <a href="#" onclick="showmore('hoteldetails'); return false"> <div id="hotelexpand"> <div class="plusminus"></div> </div> show/hide room selections </a> </td> </tr> <tr> <td colspan="3" style="border:none"> <div id="hoteldetails" style="display:none"> <table width="100%" cellpadding="0" cellspacing="0"> <tr class="hide"> <th align="left">room description</th> <th align="right">total basket cost</th> <th> </th> </tr> <tr> <td colspan="3"> <script language="javascript"> event.observe(window, "load", function() { $('rightprice_div_555_0.1_555:0').innerhtml = properrounding('2145.66', 2);
my code follows:
r = 0 c = 0 set tdelements2 = .document.getelementsbyclassname("price") l = tdelements2.length = 0 l msgbox (tdelements2.item(i).innertext) msgbox (i) = + 0 sheet2.range("a1").offset(r, c).value = tdelements2.item(i).innertext r = r + 1 c = c + 0 next
however, in not returning rate/number looking for.
any help/suggestions appreciated.
Comments
Post a Comment