Jump to content

Unable to identify "text" in a webpage


Recommended Posts

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 by sammy1983
Link to comment
Share on other sites

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)

 

image.jpeg.9f1a974c98e9f77d824b358729b089b0.jpeg Chimp

small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt....

Link to comment
Share on other sites

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")

 

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...