NoizeBit Posted July 9, 2015 Posted July 9, 2015 Hi,I can't figure out how to assign a div class innertext to variable correctly, could you please have a look at it? MsgBox doesn't show the variable's value.What I'd like to achieve is to display the current balance from a broker's site. Authentication works okay.expandcollapse popup#include <IE.au3> #include <MsgBoxConstants.au3> Local $oIE = _IECreate("https://www.24option.com/24option/#Trade", 0, 1, 1, 0) CheckifLoginBroker() Sleep(5000) Local $sCurrentBalance $tags = $oIE.document.GetElementsByTagName("div") For $tag In $tags $class_value = $tag.GetAttribute("class") If $class_value = "gwt-HTML" Then $tag.innerText = $sCurrentBalance ExitLoop EndIf Next MsgBox(0, "Balance", $sCurrentBalance) Func CheckifLoginBroker() ;Look for login form on broker's site (active status) $tags = $oIE.document.GetElementsByTagName("input") $found = False For $tag In $tags $class_value = $tag.GetAttribute("class") If $class_value = "gwt-TextBox navigation_menu_username_field" Then $tag.click() $found = True ExitLoop EndIf Next If $found Then ;Login if login form is visible (inactive status) $tags = $oIE.document.GetElementsByTagName("input") $found = False For $tag In $tags $class_value = $tag.GetAttribute("class") If $class_value = "gwt-TextBox navigation_menu_username_field" Then _IEFormElementSetValue($tag, "user") EndIf If $class_value = "gwt-TextBox navigation_menu_password_field" Then _IEFormElementSetValue($tag, "password") EndIf Next $tags = $oIE.document.GetElementsByTagName("div") $found = False For $tag In $tags $class_value = $tag.GetAttribute("class") If $class_value = "navigation_menu_login_button" Then $tag.click() ExitLoop EndIf Next Sleep(2000) _IELoadWait($oIE) EndIf EndFunc ;==>CheckifLoginBroker
JohnOne Posted July 9, 2015 Posted July 9, 2015 Should ..$tag.innerText = $sCurrentBalanceBe..$sCurrentBalance = $tag.innerText NoizeBit 1 AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans.
NoizeBit Posted July 9, 2015 Author Posted July 9, 2015 Thank you John! I guess I just need a coffee to wake up completely
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