Jump to content

How to go down multiple levels in website


Recommended Posts

Hi,

I'm trying to navigate down my company's website. I successfully use _IELinkClickByText to open the first link ("Today's Events") which opens a new page with a different address.

Then I need to click on another link ("Meetings") on this new page to get to my destination but I can't get it right.

I cannot use _IENavigate as the address link of "Meetings" can change.

I cannot find any good example on this forum and the web to follow, so I hope someone can help.

#include <IE.au3> 


;Main Page
$oIE =_IECreate ("http://abc/xyz/", 0, 1, 1, 1)
WinSetState("Report - ABC - Windows Internet Explorer","",@SW_MAXIMIZE)   
Send("{Enter}")         ;Login


; Second Level
_WinWaitActivate("ABC Intranet Systems - Windows Internet Explorer","")     
_IELinkClickByText ($oIE, "Today's Events")       ;Click on this link after logging in.



; Third Level
_WinWaitActivate("Report - ABC - Windows Internet Explorer","")     
$oIE = _IEAttach ("Report - ABC - Windows Internet Explorer","", "url")    ; I want to click on "Meetings", the addess of which is not constant.
_IELinkClickByText ($oIE, "Meetings")





#region --- Internal functions Au3Recorder Start ---
Func _WinWaitActivate($title,$text,$timeout=0)
    WinWait($title,$text,$timeout)
    If Not WinActive($title,$text) Then WinActivate($title,$text)
    WinWaitActive($title,$text,$timeout)
EndFunc
Link to comment
Share on other sites

When I use _IEGetLink, I got zero link. I made the following modification, setting the address of the new window to $oIE and then try to _IELinkClickByText. It did not work, apparently that is not how it is done.

; Third Level
_WinWaitActivate("Report - ABC - Windows Internet Explorer","")
$var = ControlGetText("[CLASS:IEFrame]", "", "Edit1")
$oIE = _IEAttach($var,"url")
_IELinkClickByText ($oIE, "eReport")

I know _IELinkClickByText works with _IECreate. Is there a way to use the address of the new window that is opened with a click to work with something like _IECreate?

 

By the way, my company is using IE10, with Mcafee.

Edited by Mucho
Link to comment
Share on other sites

you need to do a collection FIRST.

Look at these examples:

; *******************************************************
; Example 1 - Get a reference to a specific form by 0-based index,
;               in this case the first form on the page
; *******************************************************

#include <IE.au3>

Local $oIE = _IECreate("http://www.google.com")
Local $oForm = _IEFormGetCollection($oIE, 0)
Local $oQuery = _IEFormElementGetCollection($oForm, 1)
_IEFormElementSetValue($oQuery, "AutoIt IE.au3")
_IEFormSubmit($oForm)

; *******************************************************
; Example 2 - Get a reference to the collection of forms on a page,
;               and then loop through them displaying information for each
; *******************************************************

#include <IE.au3>

$oIE = _IECreate("http://www.autoitscript.com")
Local $oForms = _IEFormGetCollection($oIE)
MsgBox(0, "Forms Info", "There are " & @extended & " forms on this page")
For $oForm In $oForms
    MsgBox(0, "Form Info", $oForm.name)
Next

; *******************************************************
; Example 3 - Get a reference to the collection of forms on a page,
;               and then loop through them displaying information for each
;               demonstrating use of form index
; *******************************************************

#include <IE.au3>

$oIE = _IECreate("http://www.autoitscript.com")
$oForms = _IEFormGetCollection($oIE)
Local $iNumForms = @extended
MsgBox(0, "Forms Info", "There are " & $iNumForms & " forms on this page")
For $i = 0 To $iNumForms - 1
    $oForm = _IEFormGetCollection($oIE, $i)
    MsgBox(0, "Form Info", $oForm.name)
Next
Link to comment
Share on other sites

Mbalzeshari,

Using the examples you supplied and substituting my company's intranet address (of the window opened by the IELinkClickbyText at the second level) at the _IECreate function, I got "0" forms from both Msgboxes. There are actually 58 or more links on the page.

 

Here are some of the Window Info for what it is worth.

 

>>>> Window <<<<
Title:    Report - ABC - Windows Internet Explorer
Class:    IEFrame
Position:    -8, -8
Size:    1296, 1010
Style:    0x17CF0000
ExStyle:    0x00000100
Handle:    0x0007159A

>>>> Control <<<<
Class:    Internet Explorer_Server
Instance:    1
ClassnameNN:    Internet Explorer_Server1
Name:    
Advanced (Class):    [CLASS:Internet Explorer_Server; INSTANCE:1]

Edited by Mucho
Link to comment
Share on other sites

Cant you save the page source to a file and read the names in the html within the "'s after an a href tag . Then do an array search for the word meetings and get the array number and use the tab key that many times and just hit enter on it with the send function?

Get Scite to add a popup when you use a 3rd party UDF -> http://www.autoitscript.com/autoit3/scite/docs/SciTE4AutoIt3/user-calltip-manager.html

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

×
×
  • Create New...