The first thing you need is to download the page. That’s not hard, so I’ll focus my answer on the second part.
You need to take this element that you want through the DOM parser of the language library that you’re using. To do that, you’re gonna have to identify him.
Using the Firefox "Inspect Element" (right click on the page -> Inspect Element -> click on the little square with an arrow that appears in the top left corner of the panel that appears and hover the mouse over the element you want)I was able to identify that the element you want is from the "amount price-amount" class. Through the document.getElementsByClassName("amount price-amount")
, I got 32 elements as an answer. Soon, I saw that I would have to refine the search.
I used the same tool to find the yellow rectangle class(s) and saw that it is "cluster-ONEWAY default". Since we want the first, we’re after the element document.getElementsByClassName("cluster cluster-ONEWAY default")[0]
. Just then join the two expressions: document.getElementsByClassName("cluster cluster-ONEWAY default")[0].getElementsByClassName("amount price-amount")
. It returns us only two span
s. The first is the real price and the second is the dollar price, which is what you are looking for.
Note that even after the page is loaded, this data has not yet appeared. Therefore, you will have to execute these commands only after loading the part of the page you want. Find out which events the page launches after loading those parts and execute the commands in those events.
Hello Pablo, man how did you manage to use the Document.getElementsByClassName command? My code gives error saying that it is not part of the library...
– Wesley Silva
This function does not exist with this name in VB.net. This is the Javascript function I used in the browser console. But standard language libraries often include something like this. From what I’ve seen, VB.net does not, but you can use this solution here: http://www.vbforums.com/showthread.php?536594-getElementsByClassName-Method (let us know if you have problems in English)
– Pablo Almeida
It didn’t work out so well... I tried to do as you said, but it does not find any class with the name "amount price-amount"... I had previously thought to receive the information by the source code of the page, but the value is not there... should be calculated on time by some function ... I don’t know what else to do
– Wesley Silva