PhilC
PhilC

Reputation: 418

AutoIt - Internet Explorer Navigate to another page (Pop Dialogue Box)

I am using AutoIT within Internet Explorer to navigate from one web page to another

The code I am using is:

_IENavigate($oIE, "http://www.google.co.uk")

However the web page that it is coming from displays a JavaScript popup box. I would like to click the OK button to allow the Navigation to proceed

I have tried using the following code:

ControlClick("Windows Internet Explorer", "", "[CLASS:Button; TEXT:OK; Instance:1;]")

However this doesn't work due to the fact that when the dialogue box appears the AutoIT process seems to pause itself.

The title on the dialogue box is "Windows Internet Explorer" and there are two buttons. The button I would like to click has the text of "OK"

Has anyone else come across this before? If so how can I solve this problem?

Upvotes: 2

Views: 3730

Answers (1)

Jos van Egmond
Jos van Egmond

Reputation: 2360

_IENavigate by default waits until the page is fully loaded. The dialog box may prevent a page to be fully loaded. The correct solution would be to:

  • _IENavigate the page without waiting for the page to fully load
  • Wait until the dialog box appears and close it
  • Wait for the page to fully load

The parameters for _IENavigate are like this, and you need to set $f_wait to 0:

_IENavigate(ByRef $o_object, $s_url [, $f_wait = 1])

To wait for the dialog box to appear, you will probably simply repeatedly attempt to click it until the ControlClick function returns it did so successfully.

Upvotes: 2

Related Questions