sammy1983

Unable to identify "text" in a webpage

5 posts in this topic

#1 ·  Posted (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 by sammy1983

Share this post


Link to post
Share on other sites



#2 ·  Posted

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)

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

Share this post


Link to post
Share on other sites

#3 ·  Posted

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

 

Share this post


Link to post
Share on other sites

#4 ·  Posted

try with _IEAttach()


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

Share this post


Link to post
Share on other sites

#5 ·  Posted

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. :) 

Share this post


Link to post
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