Jump to content

Check If Object exist in IE


Recommended Posts

How can i check the id is exists in IE?

i want to check if id = mydocument exists in already opened webpage in IE then msg box("id found"), if the id = mydocument not exists then msgbox(id not found)

Link to comment
Share on other sites

  • 4 weeks later...

I understand.

I have:

      Sleep(30000)
      $oLink = _IEGetObjById($oIE, 'ctl00_FooterContent_confirmacaoUsuario_BtnSim_LinkButton1')
      _IEAction($oLink, 'click')

Sometimes Sleep(30000) is not suficient time to wait.

How I WAINTING a _IEGetObjById EXISTS in the display to click?

Example:

$oLink = _IEGetObjById($oIE, 'ctl00_FooterContent_confirmacaoUsuario_BtnSim_LinkButton1')
if($oLink) exists Then
      _IEAction($oLink, 'click')
Else
  Sleep(5000)
End if

OR

$oLink = _IEGetObjById($oIE, 'ctl00_FooterContent_confirmacaoUsuario_BtnSim_LinkButton1')
While not isObj($olink)
     Sleep(5000)
WEnd

HOW I WAIT THE OBJ EXISTS TO CLICK?

THANKS!!!!!

Link to comment
Share on other sites

I have:

      Sleep(30000)
      $oLink = _IEGetObjById($oIE, 'ctl00_FooterContent_confirmacaoUsuario_BtnSim_LinkButton1')
      _IEAction($oLink, 'click')

Sometimes Sleep(30000) is not suficient time to wait.

How I WAINTING a _IEGetObjById EXISTS in the display to click?

Example:

$oLink = _IEGetObjById($oIE, 'ctl00_FooterContent_confirmacaoUsuario_BtnSim_LinkButton1')
if($oLink) exists Then
      _IEAction($oLink, 'click')
Else
  Sleep(5000)
End if

OR

$oLink = _IEGetObjById($oIE, 'ctl00_FooterContent_confirmacaoUsuario_BtnSim_LinkButton1')
While not isObj($olink)
     Sleep(5000)
WEnd

HOW I WAIT THE OBJ EXISTS TO CLICK?

THANKS!!!!!

Link to comment
Share on other sites

Danp2. Thanks, but not working.

--- begin ---

      _IEErrorHandlerRegister()
      Do
         Sleep(500)
         $oLink = _IEGetObjById($oIE, 'ctl00_FooterContent_confirmacaoUsuario_BtnSim_LinkButton1')
      Until IsObj($oLink)
      _IEAction($oLink, 'click')

--- end ---

 

Whats wrong?

 

Link to comment
Share on other sites

2 minutes ago, FabioPinheiro said:

Danp2. Thanks, but not working.

--- begin ---

      _IEErrorHandlerRegister()
      Do
         Sleep(500)
         $oLink = _IEGetObjById($oIE, 'ctl00_FooterContent_confirmacaoUsuario_BtnSim_LinkButton1')
      Until IsObj($oLink)
      _IEAction($oLink, 'click')

--- end ---

ERROR:

--> IE.au3 T3.0-2 Warning from function _IEGetObjById, $_IESTATUS_NoMatch (ctl00_FooterContent_confirmacaoUsuario_BtnSim_LinkButton1)

Whats wrong?

 

 

Link to comment
Share on other sites

10 hours ago, FabioPinheiro said:

Whats wrong?

No idea because you didn't post a runnable script and you didn't provide any additional details such as the contents of the Scite output window.

What version of AutoIT are you using? FWIW, you should see that error repeatedly until the object is found. If the object is never found, then it doesn't exist. :blink:

Link to comment
Share on other sites

So this line:

$oLink = _IEGetObjById($oIE, 'ctl00_FooterContent_confirmacaoUsuario_BtnSim_LinkButton1')

oLink will not be an object if the ID is missing. So after the call check with "IsObj" and if not object - wait.

Link to comment
Share on other sites

Hi, Juvigy.

ctl00_FooterContent_confirmacaoUsuario_BtnSim_LinkButton1 is a HTML ID. Look:

<a href="#" id="'ctl00_FooterContent_confirmacaoUsuario_BtnSim_LinkButton1" onclick="confUser()">Confirmar Usuário</a>

This link open in a modal popup, after ready a json. When i click i first link, open a modal, but before have a loading. This loading has a delay that depends on the system. it can take 1, 2, 3 ... N minutes. The Sleep command is very useful, but I set 5 minutes, when it takes 2 and I lose time.

 

I need a command that will wait until an HTML ID exists on the page. It cant be WinWait because it is an AJAX.

Thanx!

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