sammy1983 Posted April 9, 2017 Posted April 9, 2017 (edited) Hi, I am trying to identify a text on a webpage. Whenever user enters the login credentials and if it fails, user gets an error "Invalid Credentials" but I am unable to locate it. Below is the webpage code. <p class="error"> <a class="error-link" href="javascript:void(0);"></a> Invalid username/password </p> and this is my code Local $sHTML = _IEDocReadHTML($oIE) $array = StringRegExp($sHTML, '(?i)a>(.*?)</(?i)p>', 3) For $i = 0 To UBound($array) - 1 $test = $array[$i] MsgBox(0, "", $test) Next Please help Edited April 9, 2017 by sammy1983
Gianni Posted April 9, 2017 Posted April 9, 2017 maybe, when you type wrong credentials, you are notified about the error in a "new" web page, so the $oIE variable is no more valid. In that case you should refresh the reference of $oIE to the "new" page before using _IEDocReadHTML($oIE) Chimp small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt....
sammy1983 Posted April 9, 2017 Author Posted April 9, 2017 2 hours ago, Chimp said: maybe, when you type wrong credentials, you are notified about the error in a "new" web page, so the $oIE variable is no more valid. In that case you should refresh the reference of $oIE to the "new" page before using _IEDocReadHTML($oIE) You got it, Chimp. You are absolutely correct. Sorry but I am not aware of how to refresh the $oIE reference. Can you help please? I tried below. _IEAction($oIE, "refresh")
Gianni Posted April 9, 2017 Posted April 9, 2017 try with _IEAttach() Chimp small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt....
sammy1983 Posted April 9, 2017 Author Posted April 9, 2017 1 minute ago, Chimp said: try with _IEAttach() Yes. Just now tried with _IEAttach() and it worked but I am still working on getting more simpler code but thanks for stepping in Chimp. Thanks a ton.
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