Wheezer Posted December 7, 2016 Share Posted December 7, 2016 Hello guys! I'm trying to let a value of a stock exchange appear in a message box. After struggling for quite some time, i figured out how to find the id and class in a webpage. But i got stuck.. how can i grab the value and make it appear in the msgbox? #include <IE.au3> $oIE = _IEAttach("", "instance", 1) $tags = $oIE.document.GetElementsByTagName("td") For $tag in $tags $id_value = $tag.id If $id_value = "premium_exchange_stock_wood" Then MsgBox(0, "found ", $id_value) EndIf Next my code right now I have added a picture to show what i'm trying to put out in the messagebox Wheezer Link to comment Share on other sites More sharing options...
Jfish Posted December 7, 2016 Share Posted December 7, 2016 I don't think it would be $id_value = $tag.id (though I can't test without your site). Try $id_value = $tag.innertext. Build your own poker game with AutoIt: pokerlogic.au3 | Learn To Program Using FREE Tools with AutoIt Link to comment Share on other sites More sharing options...
Wheezer Posted December 7, 2016 Author Share Posted December 7, 2016 22 minutes ago, Jfish said: I don't think it would be $id_value = $tag.id (though I can't test without your site). Try $id_value = $tag.innertext. Thank you for the quick reply, it runs but gives me no msgbox #include <IE.au3> $oIE = _IEAttach("", "instance", 1) $tags = $oIE.document.GetElementsByTagName("td") For $tag in $tags $id_value = $tag.innertext If $id_value = "premium_exchange_stock_wood" Then MsgBox(0, "found ", $tag.innertext) EndIf Next Link to comment Share on other sites More sharing options...
Wheezer Posted December 7, 2016 Author Share Posted December 7, 2016 Ahh i see, it needs to print out the innerText of the premium_exchange_stock_wood id. But how Link to comment Share on other sites More sharing options...
Jfish Posted December 7, 2016 Share Posted December 7, 2016 What happened when you used the innertext property? Can you post the URL so I can try? Build your own poker game with AutoIt: pokerlogic.au3 | Learn To Program Using FREE Tools with AutoIt Link to comment Share on other sites More sharing options...
Danp2 Posted December 7, 2016 Share Posted December 7, 2016 Try this: #include <IE.au3> $oIE = _IEAttach("", "instance", 1) $oTD = _IEGetObjById($oIE, "premium_exchange_stock_wood") MsgBox(0, "found", $oTD.innertext) Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
Wheezer Posted December 7, 2016 Author Share Posted December 7, 2016 2 hours ago, Jfish said: What happened when you used the innertext property? Can you post the URL so I can try? It did not give me a messagebox or any output at all (strange) but you made me realise the values are in the innertext. The stock is not free accessible but i made a screenshot to show how it looks Link to comment Share on other sites More sharing options...
Wheezer Posted December 7, 2016 Author Share Posted December 7, 2016 1 hour ago, Danp2 said: Try this: #include <IE.au3> $oIE = _IEAttach("", "instance", 1) $oTD = _IEGetObjById($oIE, "premium_exchange_stock_wood") MsgBox(0, "found", $oTD.innertext) Hooray this works!! Link to comment Share on other sites More sharing options...
Jfish Posted December 7, 2016 Share Posted December 7, 2016 Build your own poker game with AutoIt: pokerlogic.au3 | Learn To Program Using FREE Tools with AutoIt Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now