Jump to content

Need lesson on frames and _IE functions


 Share

Recommended Posts

So I'm still pretty new to autoit, and I'm really struggling to get the _ie functionsand frames to work properly. everything I do seems to end up with a:

IE.au3 V2.3-1 Warning from function _IEFrameGetCollection, $_IEStatus_NoMatch

Currently I have my frame controls edited out, but Here is what I have so far:

Func _Login($LoginID, $LoginPass, $oTimeOut)
    Local $oIE, $oForm, $oName, $oPass, $Timer
    _IELoadWaitTimeout($oTimeOut)
    _IEErrorHandlerRegister()
    $oIE = _IECreate("editedurl")
    $oFrame = _IEFrameGetCollection($oIE,0)
    ;$oFrame = _IEFrameGetObjByName($oIE, "login")
    ;$oForm = _IEFormGetObjByName($oIE, "Login")
    
    ;$oName = _IEFormElementGetObjByName($oForm, "j_username")
    ;$oPass = _IEFormElementGetObjByName($oForm, "j_password")
    ;$oSubmit = _IEFormElementGetObjByName($oForm, "submit")
    ;_IEFormElementSetValue($oName, $LoginID)
    ;_IEFormElementSetValue($oPass, $LoginPass)
    ;_IEAction($oSubmit, "click")
    $Timer = TimerInit()
    Do
        Sleep(1)
    Until _IEPropertyGet($oIE, "locationurl") = "edited url" Or TimerDiff($Timer) > $oTimeOut
    _IEErrorHandlerDeRegister()
    
EndFunc   ;==>_ForumLogin

a view source shows:

CODE
<frameset name="APPLOGIN_FRAMESET" id="APPLOGIN_FRAMESET" cols="177,*" frameborder="NO" border="0" framespacing="0">

<frame name="login" id="login" marginheight="0" marginwidth="0" noresize src="login.jsp" scrolling="no" >

<frame name="main" id="main" scrolling="yes" src="prelogin.jsp">

</frameset>

I am after the login frame as hopefully you can tell from the autoit code commented out.

I really just don't understand how to use _ie and frames together. anyone have some good resources for this?

Link to comment
Share on other sites

It says IE.au3 V2.3-1, not AutoIt V2.3-1. Version control for IE.au3 is indepandant from AutoIt.

Resources to figure it out? Yes, please try the free DebugBar in my sig... very powerful tool that may quickly help you understand what is wrong.

Dale

Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y

Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

Link to comment
Share on other sites

It says IE.au3 V2.3-1, not AutoIt V2.3-1. Version control for IE.au3 is indepandant from AutoIt.

Resources to figure it out? Yes, please try the free DebugBar in my sig... very powerful tool that may quickly help you understand what is wrong.

Dale

Hello Dale, I am using the IE debug bar, just discovered it from a previous post actually... Very cool tool! Unfortunatly I think my lack of understanding is more in the how to actually use the autoit functions LOL. I'm still an autoit newb!
Link to comment
Share on other sites

Hello Dale, I am using the IE debug bar, just discovered it from a previous post actually... Very cool tool! Unfortunatly I think my lack of understanding is more in the how to actually use the autoit functions LOL. I'm still an autoit newb!

Also, Once you all educated me on how to use frames properly with autoit, perhaps you might be able to explain how to click this:

(without using the mouse of course)

<div name="Medical Management"

title=""

isCurrent="false">

<table class="menuitemTable" border="0" width="170" cellpadding="0" cellspacing="0">

<tr height="25" onclick="java script: void navClient.query('%2FMedical+Management','',false)">

Link to comment
Share on other sites

  • Moderators

Something like this should work...

#include <IE.au3>

$sURL = "www.SomeWebpage.com"

_IEErrorHandlerRegister()
$oIE = _IECreate($sURL)
$oDiv = _IEGetObjByName($oIE, "Medical Management")
$oTableRow = _IETagNameGetCollection($oDiv, "tr", 0)
_IEAction($oTableRow, "click")

If you have any questions, do ask.

Link to comment
Share on other sites

Something like this should work...

#include <IE.au3>

$sURL = "www.SomeWebpage.com"

_IEErrorHandlerRegister()
$oIE = _IECreate($sURL)
$oDiv = _IEGetObjByName($oIE, "Medical Management")
$oTableRow = _IETagNameGetCollection($oDiv, "tr", 0)
_IEAction($oTableRow, "click")

If you have any questions, do ask.

Thanks that looks like it will work for the javascript control, I haven't been able to test it though because I have to understand how to deal with this horribly designed frames page.

This is the view source you get just from displaying the source in IE:

CODE
<frameset name="APP_FRAMESET" id="APP_FRAMESET" rows="100%,*" frameborder="NO" border="0" framespacing="0" onunload="endSession()">

<frame name="APPCONTAINER" id="APPCONTAINER" scrolling=yes marginheight="0" marginwidth="0" src="dac/structure/app/content.jsp" >

</frameset>

The javascript onclick event I want to click is in another frame set in the APPCONTAINER (content.jsp) page, it's frameset looks like this:

CODE
<frameset name="APPCONTENT_FRAMESET" id="APPCONTENT_FRAMESET" cols="170,*" frameborder="NO" border="0" framespacing="0">

<frame name="nav" id="nav" marginheight="0" marginwidth="0" scrolling="NO" noresize="true" src="dac/pages/navigation/menu.jsp?_path=/&_wpID=0"></frame>

<frame name="main" id="main" scrolling=yes src="/tzg/eservice/dac/structure/router.jsp?_path=/Home&_wpID=homepage&_ns=DEFAULT"></frame>

</frameset>

The control is in the nav frame. So my question is how can I specify to click this link when it's nested in two sets of frames?
Link to comment
Share on other sites

You need to drill in.

$oIE = _IECreate(your-url)
$oFrame1 = _IEFrameGetObjByName($oIE, "APPCONTAINER")
$oFrame2 = _IEFrameGetObjByName($oFrame1, "nav")

Then do everything with $oFrame2 as you would with $oIE if there were no frames.

Dale

Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y

Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

Link to comment
Share on other sites

You need to drill in.

$oIE = _IECreate(your-url)
$oFrame1 = _IEFrameGetObjByName($oIE, "APPCONTAINER")
$oFrame2 = _IEFrameGetObjByName($oFrame1, "nav")oÝ÷ Ù8^Ú½êò¶§­Mú ZÚí³*.Â¥w­Mú "~Ø^­ì­éè~¶¦zÀÚïêº^N§ÀÚâ-)ä"k¬µ·¢)ಶ§
è
+¶¬Áæéj¢²·¦zËvêHßÙ¬¶)eëmx-ëÁªçx,ëbjíÕÛ}Vj¹âë¢gîËb¢rëNn0r5©Ó~+Z¶ë
 Æ­r¶ F®Ý]·ÔJ뢷ë¢gîËb¢rM¨
jgzШW¶*'Ó~+Z¶ëö¥ÐÚµ¤ò¥î¶ F®Ý]·ÔJ뢷ë¢gîËb¢rËb¢}7赫n°ïjX
«ZO*^jëh×6$oIE = _IECreate("edited url")
Do
        Sleep(10)
    Until _IEPropertyGet($oIE, "locationurl") = "edited url disclaimer" or TimerDiff($timer) > $oTimeOut
    
Send($LoginID & "{TAB}" & $LoginPass & "{TAB}" & @CR)
        
    WinWaitActive("Disclaimer")
    WinSetState("Disclaimer", "", @SW_MAXIMIZE)
    send("+{TAB}" & "{TAB 4}" & @CR)

    $Timer = TimerInit()
    Do
        Sleep(1)
    Until _IEPropertyGet($oIE, "locationurl") = "edited url where disclaimer=accepted" Or TimerDiff($Timer) > $oTimeOut
    _IEErrorHandlerDeRegister()
sleep(9000)

;display frames below
$oFrame1 = _IEFrameGetObjByName($oIE, "APPCONTAINER")
$oFrame2 = _IEFrameGetObjByName($oFrame1, "nav")

HTML displayed from IE:

CODE

<!-- CONTAINER.JSP

Sets the main frame for the application.

-->

<html>

<base href="edited url" />

<head>

<script src="dac/lib/prototype.js"></script>

<script src="dac/lib/util/Hash.js"></script>

<script src="dac/lib/util/Packed.js"></script>

<script src="dac/lib/WindowMaker.js"></script>

<script src="dac/lib/ui/WindowClient.js"></script>

<script LANGUAGE="javascript">

<!--

var isLogingInAgain = false;

function endSession()

{

/* Removed this feature as of 4.30 release

if ( isLogingInAgain )

{

return;

}

var windowClient = new WindowClient();

windowClient.openHiddenWindow("/tzg/eservice/login/pages/doSessionend.jsp");

*/

}

//-->

</SCRIPT>

<LINK REL=StyleSheet HREF="/tzg/eservice/css/healthweb.css" TITLE="Health" TYPE="text/css">

<title>Healthweb eApp</title>

</head>

<frameset name="APP_FRAMESET" id="APP_FRAMESET" rows="100%,*" frameborder="NO" border="0" framespacing="0" onunload="endSession()">

<frame name="APPCONTAINER" id="APPCONTAINER" scrolling=yes marginheight="0" marginwidth="0" src="dac/structure/app/content.jsp" >

</frameset>

</html>

APPCONTAINER page HTML (warning it's a lot of javascript):

CODE

<html>

<head>

<!--GENERIC.JSP

Gets the beans from session and application to be used in most of the JSP pages.

-->

<!--

INIT.JSP

This file would be included in all the front end files which would be accessed

by users. Monitors cookie and session.

-->

<!-- ERSCRIPT.JSP

Includes conditionally the error reporting Javascript.

-->

<base href="edited url" />

<script language="javascript" id="universal.bhv.script">

/**

* Does the current browser support <code>window.event</code>?

*

* @return whether <code>window.event</code> is supported

*/

function hasEvents()

{

return window.event ? true : false;

}

/**

* On ENTER, validate a <form>, granted the page contains a matching

* <code>validate()</code> function.

*/

function onkeypress_validate()

{

if (!hasEvents() || !validate)

return true;

if (window.event.keyCode == "13")

{

var focused = window.event.srcElement;

for (var i = 0; i < document.links.length; ++i)

{

if (focused == document.links)

{

window.event.returnValue = true;

return true;

}

}

// If Control ..

if (focused.form)

{

var type = focused.type;

if (type)

{

type = type.toUpperCase();

if

(

type == "TEXTAREA" ||

type == "BUTTON" ||

type == "SUBMIT" ||

type == "RESET"

)

{

window.event.returnValue = true;

return true;

}

}

}

validate();

window.event.returnValue = false;

}

return true;

}

/*********************************

* On Enter key hit, trigger

* the search pop-up

**********************************/

function onkeypress_searchpopup()

{

if (!hasEvents() || !searchpopup)

return true;

if (window.event.keyCode == "13")

{

var focused = window.event.srcElement;

for (var i = 0; i < document.links.length; ++i)

{

if (focused == document.links)

{

window.event.returnValue = true;

return true;

}

}

// If Control ..

if (focused.form)

{

var type = focused.type;

if (type)

{

type = type.toUpperCase();

if

(

type == "TEXTAREA" ||

type == "BUTTON" ||

type == "SUBMIT" ||

type == "RESET"

)

{

window.event.returnValue = true;

return true;

}

}

}

searchpopup();

window.event.returnValue = false;

}

return true;

}

/*****************************************************

* On Enter key hit, trigger the dropdowns..

* a duplicate of above, but facilitates in handling

* jsps with multiple forms

*****************************************************/

function onkeypress_selectdropdown()

{

if (!hasEvents() || !searchpopup)

return true;

if (window.event.keyCode == "13")

{

var focused = window.event.srcElement;

for (var i = 0; i < document.links.length; ++i)

{

if (focused == document.links)

{

window.event.returnValue = true;

return true;

}

}

// If Control ..

if (focused.form)

{

var type = focused.type;

if (type)

{

type = type.toUpperCase();

if

(

type == "TEXTAREA" ||

type == "BUTTON" ||

type == "SUBMIT" ||

type == "RESET"

)

{

window.event.returnValue = true;

return true;

}

}

}

selectdropdown();

window.event.returnValue = false;

}

return true;

}

/**

* Is browser IE 4+

*

* @return boolean whether or not browser is IE4+

*/

function isIE4Above()

{

var i = navigator.userAgent.indexOf('MSIE', 0);

if (i < 0) // not Internet Explorer!

return false;

var s = navigator.userAgent.substring(i + 4, 255);

var Ver = parseFloat(s);

if (Ver < 4.01)

return false;

if (screen.availHeight < 500)

return false;

return true;

}

function default_navigation_onmouseover()

{

if (!hasEvents())

return true;

window.event.srcElement.className =

"DefaultNavigationHighlighted";

return true;

}

function default_navigation_onmouseout()

{

if (!hasEvents())

return true;

window.event.srcElement.className =

"DefaultNavigation";

return true;

}

function form_control_onfocus()

{

if (!hasEvents())

return true;

window.event.srcElement.className =

"FormControlHighlighted";

return true;

}

function form_control_onblur()

{

if (!hasEvents())

return true;

window.event.srcElement.className =

"FormControl";

return true;

}

function transmitter_navigation_onmouseover()

{

if (!hasEvents())

return true;

window.event.srcElement.className =

"TransmitterNavigationHighlighted";

return true;

}

function transmitter_navigation_onmouseout()

{

if (!hasEvents())

return true;

window.event.srcElement.className =

"TransmitterNavigation";

return true;

}

function transmitter_button_onmouseover()

{

if (!hasEvents())

return true;

window.event.srcElement.className =

"TransmitterButtonHighlighted";

return true;

}

function transmitter_button_onmouseout()

{

if (!hasEvents())

return true;

window.event.srcElement.className =

"TransmitterButton";

return true;

}

</script>

<style id="universal.bhv.style">

.DefaultBody

{

text-align: center;

background: #fff;

margin-top: 6px;

margin-left: 10px;

margin-right: 16px;

margin-bottom: 6px;

}

.DefaultNavigation

{

font-family: Arial, Helvetica, sans-serif;

font-size: 12pt;

font-style: normal;

font-weight: bold;

text-decoration: none;

color: #00a;

}

.DefaultNavigationHighlighted

{

font-family: Arial, Helvetica, sans-serif;

font-size: 12pt;

font-style: normal;

font-weight: bold;

text-decoration: underline;

color: #33e;

}

.FormControl

{

background-color: #FFFFFF;

font-family: Arial;

font-size: 10pt;

font-style: normal;

font-weight: normal;

color: #000000;

}

.FormControlDisplay

{

font-family: Arial;

font-size: 10pt;

font-style: normal;

font-weight: normal;

text-decoration: none;

color: #003333;

}

.FormControlHighlighted

{

background-color: #ccccff;

font-family: Arial;

font-size: 10pt;

font-style: NORMAL;

font-weight: NORMAL;

color: #000000;

}

.FormControlReadOnly

{

background-color: #D4D4D4;

font-family: Arial;

font-size: 10pt;

font-style: italic;

font-weight: normal;

color: #555;

}

.FormControlRadioCheckbox

{

background-color: #E4E4E4;

}

.FormLabel

{

font-family: Arial;

font-size: 10px;

font-style: normal;

font-weight: normal;

text-decoration: normal;

color: #003333;

}

.TransmitterNavigation

{

font-family: Arial,Tahoma,sans-serif;

font-size: 12px;

font-style: normal;

font-weight: BOLD;

text-decoration: NONE;

color: #00386A;

}

.TransmitterNavigationHighlighted

{

font-family: Arial,Tahoma,sans-serif;

font-size: 12px;

font-style: normal;

font-weight: BOLD;

text-decoration: underline;

color: #00386A;

}

.TransmitterButton

{

background-color: #00008b;

font-family: Arial, Helvetica, sans-serif;

font-size: 8pt;

font-style: normal;

font-weight: bold;

text-decoration: none;

color: #fff;

}

.TransmitterButtonHighlighted

{

background-color: #483d8b;

font-family: Arial, Helvetica, sans-serif;

font-size: 8pt;

font-style: normal;

font-weight: bold;

text-decoration: none;

color: #ff0;

}

</style>

<script language="javascript" src="/tzg/eservice/dac/lib/frame/FrameFinder.js"></script>

<script language="javascript">

/**

* Default ctor.

*/

function SubNavClientConstants()

{

/**

* URL for Home page of app

*/

this.URL_HOME =

"/tzg/eservice/dac/structure/app/content.jsp";

/**

* URL of default help page

*/

this.URL_HELP = "/tzg/eservice/dac/help/help.jsp";

/**

* Current state

*

* @todo tag handler for this??

*/

this.STATE = "content=new";

/**

* URL of About page for app

*/

this.URL_ABOUT = "/tzg/eservice/dac/about/about.jsp";

/**

* URL of Logoff view

*/

this.URL_LOGOFF = "/tzg/eservice/dac/pages/signoff.jsp?topRowBtns=NO";

/**

* URL of Loginagain

*/

this.URL_LOGINAGAIN =

"/tzg/eservice/entry/greet.login";

/**

* Context path of the app

*/

this.CONTEXT_PATH = "/tzg/eservice";

}

</script>

<script language="javascript" src="/tzg/eservice/dac/lib/clients/SubNavClient.js"></script>

<script language="Javascript" src="/tzg/eservice/dac/lib/cookie.js"></script>

<script language="javascript">

<!--

// Check 1 of 3 to make sure user didn't log out

if ( !IsUserInSession('SErFQuDSFgy1cokSRkSiumN') )

{

EndSession();

}

/**

* End the session

*/

function EndSession()

{

subNavClient.loginAgain();

}

//-->

</script>

<!-- END INIT.JSP -->

<title>Healthweb eApp</title>

<script language="Javascript">

<!--

window.status = "Welcome to eService";

//-->

</script>

</head>

<frameset name="APPCONTENT_FRAMESET" id="APPCONTENT_FRAMESET" cols="170,*" frameborder="NO" border="0" framespacing="0">

<frame name="nav" id="nav" marginheight="0" marginwidth="0" scrolling="NO" noresize="true" src="dac/pages/navigation/menu.jsp?_path=/&_wpID=0"></frame>

<frame name="main" id="main" scrolling=yes src="/tzg/eservice/dac/structure/router.jsp?_path=/Home&_wpID=homepage&_ns=DEFAULT"></frame>

</frameset>

</html>

Link to comment
Share on other sites

Oh I missed the code that's erroring in my copy paste, but I'm sure you could figure it out...

for some reason edit isn't working on my above post, might be to big or something.

this is in the autoit code, right below the:

;display frames below

$oFrame1 = _IEFrameGetObjByName($oIE, "APPCONTAINER")

$oFrame2 = _IEFrameGetObjByName($oFrame1, "nav")

add this:

$oDiv = _IEGetObjByName($oIE, "Medical Management")

$oTableRow = _IETagNameGetCollection($oDiv, "tr", 0)

_IEAction($oTableRow, "click")

Link to comment
Share on other sites

Make sure you have gotten where you need to go and that you are not being bitten by dynamic page generation. Verify page content with:

ConsoleWrite(_IEDocReadHTML($oFrame) & @CR)

Dale

p.s. also suggest you install the free DebugBar you'll find a link to in my sig -- great tool

Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y

Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

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