Jump to content

How do I check for the existance of a button on a web page?


taylormade
 Share

Recommended Posts

part of my script is:

------------------------------------------------------

If StringInStr(_IEBodyReadText($oIE), $Text, 2) = 0 and $a = 1 Then

_IELinkClickByText($oIE, "Accept project")

; more code here

Endif

------------------------------------------------------

What I'm doing is waiting for the page NOT to contain the text in $Text.

Then it should procede to the next line: _IELinkClickByText($oIE, "Accept project") (click the button)

However, there are occations when $Text is not present on the page, AND that button is NOT there either (ie: the page doesn't load fully, or a different page appears briefely)

In that case, I want my script to exit the IF / Endif and just procede past it and continue the code.

I want to run this in the Scite Editor for now, so I don't need any UI and such.

Here is the error I'm getting when the scenario I illustrated above occurs.

" Warning from function _IELinkClickByText "

Can I trap that error and then get out of the IF / ENDIF section gracefully somehow?

bob

Edited by taylormade
Link to comment
Share on other sites

Psudeocode noodling...

While 1
Sleep(10)
If _PageLoaded() Then
If Not _SearchForText() Then
         _IELinkClickByText($oIE, "Accept project")
         If @error <> 0 then ConsoleWrite("Unable to locate click link by text.  Error code: " & @error & @CRLF)
     EndIf
EndIf
WEnd

This is what I got based on what you want to do.

Also, what error code is it throwing? According to the help file, @error can be one of 8 values with different meanings. The conslewrite call will scribble it into the console on SciTE so you can see what's happening.

Edited by Blue_Drache

Lofting the cyberwinds on teknoleather wings, I am...The Blue Drache

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