Jump to content

Should I be using _ieloadwait?


Recommended Posts

I'm stumped as usual :)

Here's what I'm trying to do. I open a ie form I regularly fill out and hit submit. After submit is done the page redirects to another url with link to install a file.

Obviously I can't use _ieloadwait($oIE) because it $oIE refers to the original url. So my question is how do I wait for the second page to become active and then click the link by text? Sorry if it's not tidy. Would appreciate any pointers you could give me. Thanks in advance.

#Region ;**** Directives created by AutoIt3Wrapper_GUI ****

#AutoIt3Wrapper_outfile=the.exe

#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****

#include <IE.au3>

Dim $sURL = ("http://myfirsturl")

Dim $oIE = _IECreate($sURL)

$s_action = "click"

If $CmdLine[2] = do this

If $CmdLine[2] = do this

;Find the form and the form fields we are interested in

$o_form = _IEFormGetObjByName($oIE, "UIForm")

$o_mail = _IEFormElementGetObjByName($o_form, "tbEmail")

$o_company = _IEFormElementGetObjByName($o_form, "tbOrg")

$o_dept = _IEFormElementGetObjByName($o_form, "tbOrgUnit")

$o_city = _IEFormElementGetObjByName($o_form, "tbLocality")

$o_state = _IEFormElementGetObjByName($o_form, "tbState")

$o_country = _IEFormElementGetObjByName($o_form, "tbCountry")

$o_name = _IEFormElementGetObjByName($o_form, "tbCommonName")

$o_friend = _IEFormElementGetObjByName($o_form, "tbFriendlyName")

$o_template = _IEFormElementGetObjByName($o_form, "lbCertTemplate")

$o_option = _IEFormElementGetObjByName($o_form, "cbLocalMachineStore")

$o_submit = _IEFormElementGetObjByName($o_form, "btnSubmit")

$o_option.checked = True

; Set the value of the form fields

_IEFormElementSetValue($o_mail, "yosoy@gmail.com")

_IEFormElementSetValue($o_company, "mycompany")

_IEFormElementSetValue($o_dept, "thedepartment")

_IEFormElementSetValue($o_city, "los angeles")

_IEFormElementSetValue($o_state, "ca")

_IEFormElementSetValue($o_country, "US")

_IEFormElementOptionselect($o_template, $TEMPLATENAME)

_IEFormElementSetValue($o_name, $CmdLine[1])

_IEFormElementSetValue($o_friend, $CmdLine[1])

_IEFormElementSetValue($o_option, 1)

Sleep(3000)

_IEAction($o_submit, $s_action)

;INSTALL THE CERT INTO LOCAL MACHINE STORE

Dim $fURL = ("http://mysecondurl")

Dim $fIE = _IELoadWait($fURL)

$s_linkText = "Install this certificate"

_IELinkClickByText($fIE, $s_linkText)

Edited by W00tever
Link to comment
Share on other sites

_IELoadWait is NOT for the URL. You call _IELoadWait($ieobj) to wait for the object to finish whatever it is loading.

Navigate first, then call load wait on the object.

sorry, I'm not following. the page redirects on its own. ienavigate sounds like trying to direct to a page.

Link to comment
Share on other sites

Navigate means to leave the current page. I didn't say _IENavigate.

Clicking a link or submitting a form will start a navigate. Load wait will wait for it to finish, no matter what started it.

Like this?

Dim $fURL = ("mysecondurl")

Dim $fIE = ($fURL)

$s_linkText = "Install certificate"

_IELoadWait($fIE)

_IELinkClickByText($fIE, $s_linkText)

Link to comment
Share on other sites

I have no idea what that is.

$ieobj = _IECreate("your params here")

_IEClickLinkByText($ieobj, "your link text here")

_IELoadWait($ieobj)

What's with the strings in parenthesis?

I cannot invoke iecreate because I don't want a new instance of IE, the page I want is already loaded.

beats me about the parenthesis, it works like that:)

here's the problem

In sequential order

1. Dim $sURL = ("http://myfirsturl")

Dim $oIE = _IECreate($sURL)

2. finds and fills out the form fields

3. clicks submit.

4. redirects to another url.

5. since $oIE no longer exists I cannot pass submit on the new page.

Link to comment
Share on other sites

Why would $oIE no longer exist? The IE object is, in a way, a handle to the window. You perform operations on it. Just because it changes pages doesn't mean the object ceases to exist. Where did you get that idea?

Because $oIE = _IECreate($sURL) where $sURL = ("http://myfirsturl") When the page changes to another url then $oIE doesn't exist.

that's the wacky way I read it :)

Link to comment
Share on other sites

No... And stop putting parenthesis around your strings. It's unnecessary and annoying to read.

You have a handle to an object, not a web page. It still exists.

sorry to annoy, everyone has to start somewhere :) I made it this far by myself with only two questions alot more effort than most so I don't know why you have to be so terse.

Just started writing right out of the help file. If the parenthesis arent required why are they here...?

#include <IE.au3>

$oIE = _IECreate ("www.autoitscript.com")

; *******************************************************

; Example 2 - Create new browser windows pointing to each of 3 different URLs

; if one does not already exist ($f_tryAttach = 1)

; do not wait for the page loads to complete ($f_wait = 0)

; *******************************************************

;

#include <IE.au3>

_IECreate ("www.autoitscript.com", 1, 1, 0)

_IECreate ("my.yahoo.com", 1, 1, 0)

_IECreate ("www.google.com", 1, 1, 0)

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