What I’m trying to do is parse certain text from a webpage that is loaded into the webbrowser. To be more specific, this line of code.
<span class="price" id="selecttrainform1_addToCartPrice">$20.00</span>
It sits on line 1342. If it helps, this is all the code before it, that sits on the same line.
<nobr><input type="image" onclick="return onAddToCartClick('selecttrainform', '1', '');" src="/images/en/avs_addtocart_gray.gif" alt="Add To cart >" border="0" name="_handler=presentation.handler.request.rail.RailSimpleSelectDepartAvailabilityRequestHandler/_xpath=/sessionWorkflow/productWorkflow[@product='Rail']/tripJourneyTariffAvailability/journeyTariffAvailability[1]/binding[1]/journey/segment[1]/_/sessionWorkflow/productWorkflow[@product='Rail']/selectedJourney/@id_=_hy0s6wf8a3gi" /><span class="price" id="selecttrainform1_addToCartPrice">$20.00</span>
What I’m trying to do with that price is have a message box display it. I can either have three different msgbox come up, drawing from three different webbrowsers, or just one msgbox that shows from all three. It’s not a big deal to me. As well, this code will just be placed in a button. Of course, if need be, I can have the information display in a textbox rather than a msgbox. I just much prefer a msgbox.
I was thinking I could use something like
If webpageelement3.GetAttribute("id") = "selecttrainform1_addToCartPrice" Then
MsgBox("the price data here")
but I’m not sure how that’d work to get it to display into the messagebox. The above code is part of what I used to find and click a button, just left out the webpagelement.invokemember(“click”) command.
Does anyone know of any resources or links that would be helpful? I’ve tried searching through google but it’s been fruitless for the moment.
This is being down through vb.net.
If the webbrowsers are required for visual feedback in someway:
If however they are just a means of downloading the webpage, then i would suggest removing them and using something like HtmlAgilityPack or CSQuery instead