Valnurat Posted May 17, 2013 Share Posted May 17, 2013 I try to wait to a webpage is finish loading before continue, but it does not wait. What do I do wrong? #include <IE.au3> Local $username = InputBox("Username", "Enter your AD username.", "username", "") Local $passwd = InputBox("Security Check", "Enter your password for One4All.", "password", "*") Local $oIE = _IECreate("URL") Local $oForm = _IEFormGetObjByName($oIE, "mainForm") Local $oText = _IEFormElementGetObjByName($oForm, "j_username") _IEFormElementSetValue($oText, $username) Local $oText = _IEFormElementGetObjByName($oForm, "j_password") _IEFormElementSetValue($oText, $passwd) Local $hwnd = _IEPropertyGet($oIE, "hwnd") _IEAction($oForm, "focus") ControlSend($hwnd, "", "[CLASS:Internet Explorer_Server; INSTANCE:1]", "{Enter}") _IELoadWaitTimeout(60000) Local $osv = _IEGetObjById($oIE, "headerForm:menuUsers") $osv.fireEvent("onclick") Yours sincerely Kenneth. Link to comment Share on other sites More sharing options...
jdelaney Posted May 17, 2013 Share Posted May 17, 2013 (edited) use the helpfile (in scite, place cursor on the function, press f1): _IELoadWaitTimeout Retrieve or set the current value in milliseconds _IELoadWait will try before timing out. _IELoadWait Wait for a browser page load to complete before returning. Edited May 17, 2013 by jdelaney IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window. Link to comment Share on other sites More sharing options...
JohnOne Posted May 17, 2013 Share Posted May 17, 2013 It all depends in what context you use the term "finish loading" _IELoadWait() can return before all values of elements on a page are loaded into browser. If it;s the case that you need values loaded outside of normal html (I don't know jquery, ajax, flash etc...) you might want to test for the existence of a particular object on the page, which you consider to be present when "finish loading". . AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
Valnurat Posted May 18, 2013 Author Share Posted May 18, 2013 I have tried _IELoadWait() but that does not work. The script runs the 2 last line even that the page have not loaded. Sleep(5000) is the one that works. Yours sincerely Kenneth. Link to comment Share on other sites More sharing options...
JohnOne Posted May 18, 2013 Share Posted May 18, 2013 Yes we established that, but Sleep() is nasty workaround really and might not work from one time to the next. Best to check for last loaded object. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
Medic873 Posted May 18, 2013 Share Posted May 18, 2013 John how would you go about checking the last loaded object. Like find something on the page that take the longest to load but how would you reference if that has already loaded out of curiosity. Thank you Link to comment Share on other sites More sharing options...
JohnOne Posted May 18, 2013 Share Posted May 18, 2013 Well first I would write code to access the object when the page is fully loaded to my expectations. The object or value of property within object would ideally be one that is constant, like an id or name or some other value. An error handler would tell me if the object was not present, and a test of its property would tell me if it was loaded. There are many ways to accomplish it but seems not to be a standard method, and depends entirely 100% on what that website is and what it contains. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
MouseSpotter Posted May 18, 2013 Share Posted May 18, 2013 Is the website you accessing an asynchronous one? (A clue to asynchronous might be that the URL does not change when the page content does) If so then JohnOne's suggestion is likely the only way you will know a page has loaded. Link to comment Share on other sites More sharing options...
Medic873 Posted May 19, 2013 Share Posted May 19, 2013 The reason im asking is cause I think I am going through something very similar. I posted a thread about it java script / asp.net makes this type of thing difficult lol JohnOne I can't thank you enough already but do you think you might be able to structure a basic example ?? That would be amazing but if not I understand and you have already helped a ton. Link to comment Share on other sites More sharing options...
Valnurat Posted May 20, 2013 Author Share Posted May 20, 2013 Is the website you accessing an asynchronous one? (A clue to asynchronous might be that the URL does not change when the page content does) If so then JohnOne's suggestion is likely the only way you will know a page has loaded. My URL change from: http://name/views/security/login/login.xhtml to http://name/views/welcome/welcome.xhtml and I need to wait to the http://name/views/welcome/welcome.xhtml has loaded. Yours sincerely Kenneth. Link to comment Share on other sites More sharing options...
Valnurat Posted May 20, 2013 Author Share Posted May 20, 2013 Would you do it like this or do you have another idea? Local $sText = "" Do $sText = _IEBodyReadText ($oIE) Until StringInStr($sText, "Syncron") <> 0 Yours sincerely Kenneth. Link to comment Share on other sites More sharing options...
JohnOne Posted May 20, 2013 Share Posted May 20, 2013 Post the url. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
Valnurat Posted May 21, 2013 Author Share Posted May 21, 2013 (edited) It is located on our intranet, but this is the source. expandcollapse popup<! DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> < html xmlns="http://www.w3.org/1999/xhtml"><head> <meta http-equiv="content-type" content="text/html;charset=UTF-8" /> <meta http-equiv="X-UA-Compatible" content="IE=7" /> <title>Syncron Solutions - Welcome</title> <link rel="shortcut icon" type="image/x-icon" href="/faces/javax.faces.resource/favicon.ico?ln=img/unsecured&v=sync4.4.10.0_12.2.4.7" /><script type="text/javascript" src="/faces/javax.faces.resource/jsf.js?ln=javax.faces&v=sync4.4.10.0_12.2.4.7"></script><script type="text/javascript" src="/faces/javax.faces.resource/jquery.js?v=sync4.4.10.0_12.2.4.7"></script><script type="text/javascript" src="/faces/javax.faces.resource/class-0.0.2.js?ln=com/syncron/faces/js/unsecured&v=sync4.4.10.0_12.2.4.7"></script><script type="text/javascript" src="/faces/javax.faces.resource/utils.js?ln=com/syncron/faces/js/unsecured&v=sync4.4.10.0_12.2.4.7"></script><link type="text/css" rel="stylesheet" href="/faces/rfRes/facesUnsecured_ie.ecss?db=eAEzvfj0AAAF1QKs&ln=com%2fsyncron%2ffaces%2fcss%2funsecured&v=sync4.4.10.0_12.2.4.7" /><link type="text/css" rel="stylesheet" href="/faces/rfRes/wfUnsecured_ie.ecss?db=eAEzvfj0AAAF1QKs&ln=css%2funsecured&v=sync4.4.10.0_12.2.4.7" /><script type="text/javascript" src="/faces/javax.faces.resource/ajaxStatus.js?ln=js/unsecured&v=sync4.4.10.0_12.2.4.7"></script><link type="text/css" rel="stylesheet" href="/faces/rfRes/facesSecured_ie_7.ecss?db=eAEzvfj0AAAF1QKs&ln=com%2fsyncron%2ffaces%2fcss%2fsecured&v=sync4.4.10.0_12.2.4.7" /><link type="text/css" rel="stylesheet" href="/faces/rfRes/wfSecured_ie.ecss?db=eAEzvfj0AAAF1QKs&ln=css%2fsecured&v=sync4.4.10.0_12.2.4.7" /><script type="text/javascript" src="/faces/javax.faces.resource/richfaces.js?v=sync4.4.10.0_12.2.4.7"></script><script type="text/javascript" src="/faces/javax.faces.resource/richfaces-queue.js?v=sync4.4.10.0_12.2.4.7"></script><script type="text/javascript" src="/faces/javax.faces.resource/richfaces-base-component.js?v=sync4.4.10.0_12.2.4.7"></script><script type="text/javascript" src="/faces/javax.faces.resource/status.js?ln=org.richfaces&v=sync4.4.10.0_12.2.4.7"></script><script type="text/javascript" src="/faces/javax.faces.resource/popupBox.js?ln=com/syncron/faces/js/secured/components&v=sync4.4.10.0_12.2.4.7"></script><script type="text/javascript" src="/faces/javax.faces.resource/jquery.position.js?v=sync4.4.10.0_12.2.4.7"></script><script type="text/javascript" src="/faces/javax.faces.resource/richfaces-event.js?v=sync4.4.10.0_12.2.4.7"></script><script type="text/javascript" src="/faces/javax.faces.resource/popup.js?ln=org.richfaces&v=sync4.4.10.0_12.2.4.7"></script><link type="text/css" rel="stylesheet" href="/faces/rfRes/dropdownmenu.ecss?db=eAEzvfj0AAAF1QKs&ln=org.richfaces&v=sync4.4.10.0_12.2.4.7" /><script type="text/javascript" src="/faces/javax.faces.resource/menuKeyNavigation.js?ln=org.richfaces&v=sync4.4.10.0_12.2.4.7"></script><script type="text/javascript" src="/faces/javax.faces.resource/menu-base.js?ln=org.richfaces&v=sync4.4.10.0_12.2.4.7"></script><script type="text/javascript" src="/faces/javax.faces.resource/menu.js?ln=org.richfaces&v=sync4.4.10.0_12.2.4.7"></script><script type="text/javascript" src="/faces/javax.faces.resource/menugroup.js?ln=org.richfaces&v=sync4.4.10.0_12.2.4.7"></script><script type="text/javascript" src="/faces/javax.faces.resource/menuitem.js?ln=org.richfaces&v=sync4.4.10.0_12.2.4.7"></script><script type="text/javascript" src="/faces/javax.faces.resource/shortcut.js?ln=com/syncron/faces/js/unsecured&v=sync4.4.10.0_12.2.4.7"></script><script type="text/javascript" src="/faces/javax.faces.resource/tooltip.js?ln=com/syncron/faces/js/unsecured&v=sync4.4.10.0_12.2.4.7"></script><script type="text/javascript" src="/faces/javax.faces.resource/actions.js?ln=com/syncron/faces/js/unsecured&v=sync4.4.10.0_12.2.4.7"></script><script type="text/javascript" src="/faces/javax.faces.resource/target.js?ln=com/syncron/faces/js/unsecured&v=sync4.4.10.0_12.2.4.7"></script><link type="text/css" rel="stylesheet" href="/faces/rfRes/panel.ecss?db=eAEzvfj0AAAF1QKs&ln=org.richfaces&v=sync4.4.10.0_12.2.4.7" /><script type="text/javascript" src="/faces/javax.faces.resource/popup.js?ln=com/syncron/faces/js/secured/components&v=sync4.4.10.0_12.2.4.7"></script><script type="text/javascript" src="/faces/javax.faces.resource/popupRegister.js?ln=com/syncron/faces/js/unsecured&v=sync4.4.10.0_12.2.4.7"></script><script type="text/javascript" src="/faces/javax.faces.resource/jquery-ui-core.js?ln=org.richfaces&v=sync4.4.10.0_12.2.4.7"></script><script type="text/javascript" src="/faces/javax.faces.resource/jquery-dnd.js?ln=org.richfaces&v=sync4.4.10.0_12.2.4.7"></script><script type="text/javascript" src="/faces/javax.faces.resource/popupPanel.js?ln=org.richfaces&v=sync4.4.10.0_12.2.4.7"></script><script type="text/javascript" src="/faces/javax.faces.resource/popupPanelBorders.js?ln=org.richfaces&v=sync4.4.10.0_12.2.4.7"></script><script type="text/javascript" src="/faces/javax.faces.resource/popupPanelSizer.js?ln=org.richfaces&v=sync4.4.10.0_12.2.4.7"></script><link type="text/css" rel="stylesheet" href="/faces/rfRes/popupPanel.ecss?db=eAEzvfj0AAAF1QKs&ln=org.richfaces&v=sync4.4.10.0_12.2.4.7" /><script type="text/javascript" src="/faces/javax.faces.resource/component-control.js?ln=org.richfaces&v=sync4.4.10.0_12.2.4.7"></script><script type="text/javascript" src="/faces/javax.faces.resource/loadingProgress.js?ln=js/unsecured&v=sync4.4.10.0_12.2.4.7"></script><script type="text/javascript" src="/faces/javax.faces.resource/autoDetectWidth.js?ln=js/unsecured&v=sync4.4.10.0_12.2.4.7"></script></head><body> <span id="_ajaxStatusEventConnector"></span><span id="j_idt18"><span style="display:none" class="rf-st-start"></span><span class="rf-st-stop"></span><script type="text/javascript">new RichFaces.ui.Status("j_idt18",{"onstop":function(event){SyncAjaxStatus.fireStopAjax()},"onstart":function(event){SyncAjaxStatus.fireStartAjax()}} )</script></span> <span id="loadingProgress" style="display: none;"></span> <div id="tohide" class="loading" style="display: none;"><img id="loadingProgressImage" src="/faces/javax.faces.resource/websedit-ag-bar2.gif?ln=img/unsecured&v=sync4.4.10.0_12.2.4.7" class="loading-img" /> <div class="loading-text">Loading ...</div> </div> <script type="text/javascript"> observeAjaxCallsForLoadingProgress (1000); </script><div id="defaultPopupBox_internal"></div> <div id="custom-doc" style=" width: 1609px; min-width: 120.78639230769231em; "> <div id="header"> < form id="headerForm" name="headerForm" method="post" action="/views/welcome/welcome.xhtml" enctype="application/x-www-form-urlencoded"> < input type="hidden" name="headerForm" value="headerForm" /> <div id="topBannerSection"> <div class="topLogo"></div> <div class="topLogo"><img id="headerForm:j_idt26" src="/faces/javax.faces.resource/transparent.gif?ln=img&v=sync4.4.10.0_12.2.4.7" /></div><a href="#" onclick="mojarra.jsfcljs(document.getElementById('headerForm'),{'headerForm:j_idt28':'headerForm:j_idt28'},'');return false"><img id="headerForm:j_idt29" src="/faces/javax.faces.resource/syncron_logo_small.gif?ln=img&v=sync4.4.10.0_12.2.4.7" /></a> </div> <div id="yui-main"> <div class="yui-b" id="dropDownMenuSection"> <div class="yui-g" id="topMenu"> <div class="first menuLeft"><span id="headerForm:j_idt31"><div class="rf-ddm-lbl rf-ddm-unsel pd_menuheader " id="headerForm:menuResources"><div class="rf-ddm-lbl-dec" id="headerForm:menuResources_label">Resources</div><div class="rf-ddm-pos"><div class="rf-ddm-lst" id="headerForm:menuResources_list" style="display:none;min-width:250px;"><div class="rf-ddm-lst-bg"><div class="rf-ddm-itm rf-ddm-itm-unsel pd_item" id="headerForm:menuCustomerPriceList" onclick="window.location.href = '/views/One4AL/customerPriceList/customerPriceList.xhtml'"><span class="rf-ddm-itm-ic "><div class="rf-ddm-emptyIcon"></div></span><span class="rf-ddm-itm-lbl ">Customer Price List </span><script type="text/javascript">new RichFaces.ui.MenuItem("headerForm:menuCustomerPriceList",{"mode":"client"} );</script></div></div></div></div><script type="text/javascript">new RichFaces.ui.Menu("headerForm:menuResources").initiateGroups();</script></div><div class="rf-ddm-lbl rf-ddm-unsel pd_menuheader " id="headerForm:menuAdministration"><div class="rf-ddm-lbl-dec" id="headerForm:menuAdministration_label">Administration</div><div class="rf-ddm-pos"><div class="rf-ddm-lst" id="headerForm:menuAdministration_list" style="display:none;min-width:250px;"><div class="rf-ddm-lst-bg"><div class="rf-ddm-itm rf-ddm-itm-unsel pd_menuheader" id="headerForm:menuMonitor"><span class="rf-ddm-itm-ic "><div class="rf-ddm-emptyIcon"></div></span><span class="rf-ddm-itm-lbl ">Monitor</span><div class="rf-ddm-nd"><div class="rf-ddm-lst rf-ddm-sublst" id="headerForm:menuMonitor_list" style="display:none;min-width:250px;"><div class="rf-ddm-lst-bg"><div class="rf-ddm-itm rf-ddm-itm-unsel pd_menuheader pd_item" id="headerForm:menuActiveSessions" onclick="window.location.href = '/views/securitymanagement/activesessions/activesessions.xhtml'"><span class="rf-ddm-itm-ic "><div class="rf-ddm-emptyIcon"></div></span><span class="rf-ddm-itm-lbl ">Active web sessions</span><script type="text/javascript">new RichFaces.ui.MenuItem("headerForm:menuActiveSessions",{"mode":"client"} );</script></div></div></div></div></div><div class="rf-ddm-itm rf-ddm-itm-unsel pd_menuheader" id="headerForm:menuLogs"><span class="rf-ddm-itm-ic "><div class="rf-ddm-emptyIcon"></div></span><span class="rf-ddm-itm-lbl ">Logs</span><div class="rf-ddm-nd"><div class="rf-ddm-lst rf-ddm-sublst" id="headerForm:menuLogs_list" style="display:none;min-width:250px;"><div class="rf-ddm-lst-bg"><div class="rf-ddm-itm rf-ddm-itm-unsel pd_menuheader pd_item" id="headerForm:menuLoginAttempts" onclick="window.location.href = '/views/securitymanagement/loginattempts/loginattempts.xhtml'"><span class="rf-ddm-itm-ic "><div class="rf-ddm-emptyIcon"></div></span><span class="rf-ddm-itm-lbl ">User login</span><script type="text/javascript">new RichFaces.ui.MenuItem("headerForm:menuLoginAttempts",{"mode":"client"} );</script></div></div></div></div></div></div></div></div><script type="text/javascript">new RichFaces.ui.Menu("headerForm:menuAdministration").initiateGroups([{"id":"headerForm:menuMonitor"} ,{"id":"headerForm:menuLogs"} ] );</script></div><div class="rf-ddm-lbl rf-ddm-unsel pd_menuheader " id="headerForm:menuConfiguration"><div class="rf-ddm-lbl-dec" id="headerForm:menuConfiguration_label">Configuration</div><div class="rf-ddm-pos"><div class="rf-ddm-lst" id="headerForm:menuConfiguration_list" style="display:none;min-width:250px;"><div class="rf-ddm-lst-bg"><div class="rf-ddm-itm rf-ddm-itm-unsel pd_menuheader" id="headerForm:menuSecurity"><span class="rf-ddm-itm-ic "><div class="rf-ddm-emptyIcon"></div></span><span class="rf-ddm-itm-lbl ">Security</span><div class="rf-ddm-nd"><div class="rf-ddm-lst rf-ddm-sublst" id="headerForm:menuSecurity_list" style="display:none;min-width:250px;"><div class="rf-ddm-lst-bg"><div class="rf-ddm-itm rf-ddm-itm-unsel pd_menuheader pd_item" id="headerForm:menuUsers" onclick="window.location.href = '/views/securitymanagement/users/users.xhtml'"><span class="rf-ddm-itm-ic "><div class="rf-ddm-emptyIcon"></div></span><span class="rf-ddm-itm-lbl ">User</span><script type="text/javascript">new RichFaces.ui.MenuItem("headerForm:menuUsers",{"mode":"client"} );</script></div><div class="rf-ddm-itm rf-ddm-itm-unsel pd_menuheader pd_item" id="headerForm:menuRoles" onclick="window.location.href = '/views/securitymanagement/roles/roles.xhtml'"><span class="rf-ddm-itm-ic "><div class="rf-ddm-emptyIcon"></div></span><span class="rf-ddm-itm-lbl ">Role</span><script type="text/javascript">new RichFaces.ui.MenuItem("headerForm:menuRoles",{"mode":"client"} );</script></div><div class="rf-ddm-itm rf-ddm-itm-unsel pd_menuheader pd_item" id="headerForm:menuPermissions" onclick="window.location.href = '/views/securitymanagement/permissions/permissions.xhtml'"><span class="rf-ddm-itm-ic "><div class="rf-ddm-emptyIcon"></div></span><span class="rf-ddm-itm-lbl ">Permission</span><script type="text/javascript">new RichFaces.ui.MenuItem("headerForm:menuPermissions",{"mode":"client"} );</script></div><div class="rf-ddm-itm rf-ddm-itm-unsel pd_menuheader pd_item" id="headerForm:menuWebUser" onclick="window.location.href = '/views/xslt/webuser.xhtml'"><span class="rf-ddm-itm-ic "><div class="rf-ddm-emptyIcon"></div></span><span class="rf-ddm-itm-lbl ">Web User</span><script type="text/javascript">new RichFaces.ui.MenuItem("headerForm:menuWebUser",{"mode":"client"} );</script></div><div class="rf-ddm-itm rf-ddm-itm-unsel pd_menuheader pd_item" id="headerForm:menuWebUserGroup" onclick="window.location.href = '/views/xslt/webusergroup.xhtml'"><span class="rf-ddm-itm-ic "><div class="rf-ddm-emptyIcon"></div></span><span class="rf-ddm-itm-lbl ">Web User Group</span><script type="text/javascript">new RichFaces.ui.MenuItem("headerForm:menuWebUserGroup",{"mode":"client"} );</script></div><div class="rf-ddm-itm rf-ddm-itm-unsel pd_menuheader pd_item" id="headerForm:menuWebUserStructure" onclick="window.location.href = '/views/xslt/webstructure.xhtml'"><span class="rf-ddm-itm-ic "><div class="rf-ddm-emptyIcon"></div></span><span class="rf-ddm-itm-lbl ">Web Structure</span><script type="text/javascript">new RichFaces.ui.MenuItem("headerForm:menuWebUserStructure",{"mode":"client"} );</script></div></div></div></div></div></div></div></div><script type="text/javascript">new RichFaces.ui.Menu("headerForm:menuConfiguration").initiateGroups([{"id":"headerForm:menuSecurity"} ] );</script></div></span> </div> <div id="userDetails"><span id="headerForm:my_notification_panel" class="btn-group"><span id="headerForm:my_notificationspan" class="btn-wrapper btn-link " style="margin-right: 0px;"><a id="headerForm:my_notification" name="headerForm:my_notification" class="btn btn-link hd_notifications" href="#" onclick="RichFaces.ajax("headerForm:my_notification",event,{"parameters":{"syncRender":""} ,"incId":"1"} );return false;" onmouseup="this.blur(); "><img src="/faces/javax.faces.resource/notifications.png?ln=img&v=sync4.4.10.0_12.2.4.7" alt="" /><span>Notifications</span></a></span></span><span id="headerForm:homespan" class="btn-wrapper btn-link "><a id="headerForm:home" name="headerForm:home" class="btn btn-link " href="#" onclick="RichFaces.ajax("headerForm:home",event,{"parameters":{"syncRender":""} ,"incId":"1"} );return false;" onmouseup="this.blur(); "><img src="/faces/javax.faces.resource/house_go.png?ln=img&v=sync4.4.10.0_12.2.4.7" alt="" /><span>Home</span></a></span><span id="headerForm:profilespan" class="btn-wrapper btn-link "><a id="headerForm:profile" name="headerForm:profile" class="btn btn-link " href="#" onclick="RichFaces.ajax("headerForm:profile",event,{"parameters":{"syncRender":""} ,"incId":"1"} );return false;" onmouseup="this.blur(); "><img src="/faces/javax.faces.resource/user_edit.png?ln=img&v=sync4.4.10.0_12.2.4.7" alt="" /><span>DKSOKVK</span></a></span><span id="headerForm:logoutspan" class="btn-wrapper btn-link "><a id="headerForm:logout" name="headerForm:logout" class="btn btn-link " href="#" onclick="RichFaces.ajax("headerForm:logout",event,{"parameters":{"syncRender":""} ,"incId":"1"} );return false;" onmouseup="this.blur(); "><img src="/faces/javax.faces.resource/door_out.png?ln=img&v=sync4.4.10.0_12.2.4.7" alt="" /><span>Log out</span></a></span> </div> </div> </div> </div><input type="hidden" name="javax.faces.ViewState" id="javax.faces.ViewState" value="5738580869017089787:-8998397506440394930" autocomplete="off" /> </ form> </div> <div id="bd"> <div id="yui-main"> <div class="yui-b"> < form id="coreForm" name="coreForm" method="post" action="/views/welcome/welcome.xhtml" enctype="application/x-www-form-urlencoded"> < input type="hidden" name="coreForm" value="coreForm" /> <div id="viewContent"><div class="rf-p " id="coreForm:j_idt36"><div class="rf-p-hdr viewHeader" id="coreForm:j_idt36_header"><span id="coreForm:viewHeader"><table width="100%"> < tbody> < tr> < td class="view_title align_left"><span id="coreForm:j_idt38" class="viewHeaderTitle"> Welcome </span></td> < td class="bread_crumb align_right"></td> < td class="link_to_this_page"><span id="coreForm:linkToThisPageBox"><span id="coreForm:linkToThisPagespan" class="btn-wrapper btn-link btn-icon" data-sync-tooltip="{"text":["Link to this page"]}"><a id="coreForm:linkToThisPage" name="coreForm:linkToThisPage" class="btn btn-link btn-icon linkToThisPageAnchor" href="#" onclick="return false;" onmouseup="this.blur(); "><img src="/faces/javax.faces.resource/link_to_this_page.png?ln=com/syncron/faces/images/icons&v=sync4.4.10.0_12.2.4.7" alt="" /></a></span><div id="coreForm:j_idt43" class="popup" style="position: absolute; display: none;" tabindex="-1"><script type="text/javascript">//<![CDATA[ shortcut.add( "ESC", function(event){ SyncUtils.fireEvent('coreForm:j_idt43_close_icon', 'click')}, {'type':'keydown','propagate':false,'target':document.getElementById("coreForm:j_idt43")}) //]]> </ script><div class="popup_header"><span id="coreForm:j_idt43_close_iconspan" class="btn-wrapper btn-link btn-icon" data-sync-tooltip="{"text":["close"]}"><a id="coreForm:j_idt43_close_icon" name="coreForm:j_idt43_close_icon" class="btn btn-link btn-icon close_icon" href="#" onclick="var popupElem = $d('coreForm:j_idt43'); if (popupElem && popupElem.popup) { popupElem.popup.closeDown(); };return false;" onmouseup="this.blur(); "><img src="/faces/javax.faces.resource/close_window.png?ln=com/syncron/faces/images/unsecured&v=sync4.4.10.0_12.2.4.7" alt="" /></a></span><div id="coreForm:j_idt43-dragHandle" class="popup_handle">Link to this page</div></div><div class="popup_content"> <div style="text-align: left" class="inputsGridLayout"> <p style="margin: 0px; ">Paste the following link into email or IM: </p><input id="coreForm:linkToThisPageContent" type="text" name="coreForm:linkToThisPageContent" value="http://seluws0211/views/welcome/welcome.xhtml" style="width: 100%; resize: none; padding: 2px; overflow: hidden; word-wrap: normal; white-space: pre; border: 1px solid black; background-color: white;" disabled="disabled" /> </div></div></div></span></td> </ tr> </ tbody> </ table> </ span></div><div class="rf-p-b viewContent" id="coreForm:j_idt36_body"><div id="coreForm:j_idt46" style="margin-bottom: 1px; width:100%;height:0;"></div> <span id="viewContentContainer"> <div style="float: right" id="welcomeImage"><img id="coreForm:j_idt49" src="/faces/javax.faces.resource/s9_welcome.jpg?ln=img&v=sync4.4.10.0_12.2.4.7" /> </div> Welcome you are now ready to work with One4AL administration GUI. <div style="clear: both;"> </div> </span><div id="coreForm:errorPopup" style="visibility: hidden;"><div class="rf-pp-shade" id="coreForm:errorPopup_shade" style="z-index:100;"><button class="rf-pp-btn" id="coreForm:errorPopupFirstHref"></button></div><div class="rf-pp-cntr " id="coreForm:errorPopup_container" style="position: fixed; z-index:100; "><div class="rf-pp-shdw" id="coreForm:errorPopup_shadow"></div><div class="rf-pp-hdr " id="coreForm:errorPopup_header"><div class="rf-pp-hdr-cnt" id="coreForm:errorPopup_header_content"><span id="coreForm:errorPopup-headerText">Error</span></div></div><div class="rf-pp-hdr-cntrls " id="coreForm:errorPopup_header_controls"><span id="coreForm:errorPopup-controls" class="closeModalIcon"><img id="coreForm:errorPopup-img" src="/faces/javax.faces.resource/close_window.png?ln=com/syncron/faces/images/unsecured&v=sync4.4.10.0_12.2.4.7" onclick="RichFaces.ui.ComponentControl.execute(event,{"selector":null,"target":["coreForm:errorPopup"] ,"callback":function(event,component){component['hide'].apply(component,[] );}} ); return false;" /></span></div><div class="rf-pp-cnt-scrlr" id="coreForm:errorPopup_content_scroller"><div class="rf-pp-cnt" id="coreForm:errorPopup_content"><table id="coreForm:errorPopup-gridOver" class="center" style="height:127px"> < tbody> < tr> < td><table id="coreForm:errorPopup-grid" class="center"> < tbody> < tr> < td><span id="coreForm:errorPopupMessages"></span></td> </ tr> </ tbody> </ table> </ td> </ tr> </ tbody> </ table> < div id="coreForm:errorPopup-unsaved-toolbar" class="toolbar toolbar-layout-grid"><div style="float: right"><div class="toolbar-grp primary"><span class="primary_button"><span id="coreForm:errorPopup-unsaved-toolbar:errorPopup-okspan" class="btn-wrapper "><a id="coreForm:errorPopup-unsaved-toolbar:errorPopup-ok" name="coreForm:errorPopup-unsaved-toolbar:errorPopup-ok" class="btn " href="#" onclick="RichFaces.ui.PopupPanel.hidePopupPanel('coreForm:errorPopup');;return false;" onmouseup="this.blur(); "><span>OK</span></a></span></span></div></div><span class="clearfix"></span></div></div></div></div><script type="text/javascript">new RichFaces.ui.PopupPanel("coreForm:errorPopup",{"domElementAttachment":"form"} );</script></div></div></div> </div><input type="hidden" name="javax.faces.ViewState" id="javax.faces.ViewState" value="5738580869017089787:-8998397506440394930" autocomplete="off" /> </ form> </div> </div> </div> <div id="ft"> <div id="footer"> One4AL 4.4.10, ©204 Syncron International AB </div> </div> </div><div id="defaultPopupBox_HiddenMarkup_internal"></div> < form id="autoDetectWidthForm" name="autoDetectWidthForm" method="post" action="/views/welcome/welcome.xhtml" enctype="application/x-www-form-urlencoded"> < input type="hidden" name="autoDetectWidthForm" value="autoDetectWidthForm" /> <span style="display: none" id="autoDetectedWidth">1659</span><span id="autoDetectWidthForm:j_idt60" style="display: none;"><script type="text/javascript">saveAutoDetectedWidth=function(width){RichFaces.ajax("autoDetectWidthForm:j_idt60",null,{"parameters":{"width":width} ,"incId":"1"} )};</script></span><input type="hidden" name="javax.faces.ViewState" id="javax.faces.ViewState" value="5738580869017089787:-8998397506440394930" autocomplete="off" /> </ form> <span id="currentsession" style="display: none;">34D7F736E92C0A9AF36F90A1229B566D</span> <script type="text/javascript">$(window).load(function() { window.setTimeout(function() { new Popup("coreForm:linkToThisPage","coreForm:j_idt43",300,{"isDraggable":true,"dragHandleId":"coreForm:j_idt43\u002DdragHandle","xoffset":0,"yoffset":6,"explicitClose":true} );}, 1); });</script></body> </ html> Edited May 21, 2013 by Valnurat Yours sincerely Kenneth. Link to comment Share on other sites More sharing options...
Valnurat Posted May 22, 2013 Author Share Posted May 22, 2013 Hi John. I hope you can help me. Br Yours sincerely Kenneth. Link to comment Share on other sites More sharing options...
DaleHohm Posted May 22, 2013 Share Posted May 22, 2013 Presumably something visual on the page alerts you that the load is finished. What would that be? Figure out how to identify that element in the document source and look for it using some of the methods above. The webpage source that you posted makes mention of Ajax, which is an asynchronous document update framework (and the update can happen after the page has technically finished loading, which is why _IELoadWait is doing what is supposed to do, just not what you want it to do). 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 More sharing options...
Valnurat Posted May 24, 2013 Author Share Posted May 24, 2013 In Post#11 I have written what I think is visible. But I do not know if I'm doing it right. Yours sincerely Kenneth. Link to comment Share on other sites More sharing options...
Solution jdelaney Posted May 24, 2013 Solution Share Posted May 24, 2013 (edited) As long as you loop for whatever object you are attempting to interact with, and not just try to grab it once, and assume you have it, I don't see what the issue is...do this kind of loop with ALL your object grabbing (of course, this is just a sample...add whatever _IE function you need, obviously) $iTimer = TimerInit() $oObj = _IEGetObjById($oIE, "yourID") While Not IsObj($oObj) And TimerDiff($iTimer)<5000 sleep (100) $oObj = _IEGetObjById($oIE, "yourID") WEnd If IsObj($oObj) Then MsgBox(1,1,"ABLE to grab object within 5 seconds") Else MsgBox(1,1,"unable to grab object within 5 seconds") EndIf then, you can get fancy, and create encapsulating functions for all that you need, so you don't need repeating blocks of code: Func _WaitFor_IEGetObjById($oCallersIE, $iCallersID, $iCallersMaxWaitMilSec = 5000) ConsoleWrite("Func[_WaitFor_IEGetObjById]: Start with params=[IsObj(" & $oCallersIE & ")," & $iCallersID & "," & $iCallersMaxWaitMilSec & "]." & @CRLF) $iTimer = TimerInit() $oObj = _IEGetObjById($oCallersIE, $iCallersID) While Not IsObj($iObj) And TimerDiff($iTimer) < $iCallersMaxWaitMilSec Sleep(100) $oObj = _IEGetObjById($oCallersIE, $iCallersID) WEnd If IsObj($oObj) Then ConsoleWrite("Func[_WaitFor_IEGetObjById]: Found callers ID=[" & $iCallersID & "]." & @CRLF) Return $oObj Else ConsoleWrite("Func[_WaitFor_IEGetObjById]: UNable to find callers ID=[" & $iCallersID & "] within milliseconds=[" & iCallersMaxWaitMilSec & "]." & @CRLF) Return False EndIf EndFunc ;==>_WaitFor_IEGetObjById you can even make one function...as long as they accept the proper params (or create array to hold the params...then can be any number) AND they do not have by-ref variables: If $bContinue Then $oObject4 = _WaitFor_IEObj($oIE, "_IEGetObjById", 4) $bContinue = IsObj($oObject4) ; your action EndIf Exit Func _WaitFor_IEObj($oCallersIE, $sCallerIEFuncName, $iCallersIdentifier, $iCallersMaxWaitMilSec = 5000) ConsoleWrite("Func[_WaitFor_IEGetObjById]: Start with params=[IsObj(" & $oCallersIE & ")," & $sCallerIEFuncName & "," & $iCallersIdentifier & "," & $iCallersMaxWaitMilSec & "]" & @CRLF) $iTimer = TimerInit() $oObj = Call($sCallerIEFuncName, $oCallersIE, $iCallersIdentifier) While Not IsObj($oObj) And TimerDiff($iTimer) < $iCallersMaxWaitMilSec Sleep(500) $oObj = Call($sCallerIEFuncName, $oCallersIE, $iCallersIdentifier) WEnd If IsObj($oObj) Then ConsoleWrite("Func[_WaitFor_IEGetObjById]: Found callers ID=[" & $iCallersIdentifier & "]" & @CRLF) Return $oObj Else ConsoleWrite("Func[_WaitFor_IEGetObjById]: UNable to find callers ID=[" & $iCallersIdentifier & "]" & @CRLF) Return False EndIf EndFunc ;==>_WaitFor_IEObj Edited May 24, 2013 by jdelaney Arjuntina 1 IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window. Link to comment Share on other sites More sharing options...
Valnurat Posted May 30, 2013 Author Share Posted May 30, 2013 Just a small add question. How do you call exampel 2? Func _WaitFor_IEGetObjById($oCallersIE, $iCallersID, $iCallersMaxWaitMilSec = 5000) ConsoleWrite("Func[_WaitFor_IEGetObjById]: Start with params=[IsObj(" & $oCallersIE & ")," & $iCallersID & "," & $iCallersMaxWaitMilSec & "]." & @CRLF) $iTimer = TimerInit() $oObj = _IEGetObjById($oCallersIE, $iCallersID) While Not IsObj($iObj) And TimerDiff($iTimer) < $iCallersMaxWaitMilSec Sleep(100) $oObj = _IEGetObjById($oCallersIE, $iCallersID) WEnd If IsObj($oObj) Then ConsoleWrite("Func[_WaitFor_IEGetObjById]: Found callers ID=[" & $iCallersID & "]." & @CRLF) Return $oObj Else ConsoleWrite("Func[_WaitFor_IEGetObjById]: UNable to find callers ID=[" & $iCallersID & "] within milliseconds=[" & iCallersMaxWaitMilSec & "]." & @CRLF) Return False EndIf EndFunc ;==>_WaitFor_IEGetObjById Yours sincerely Kenneth. Link to comment Share on other sites More sharing options...
jdelaney Posted May 31, 2013 Share Posted May 31, 2013 (edited) well, if you were attempting to find this node: <img id="headerForm:j_idt26" src="/faces/javax.faces.resource/transparent.gif?ln=img&v=sync4.4.10.0_12.2.4.7" /> the id = "headerForm:j_idt26" you would then call the function like (where $oIE is returned from from _ieattach or _iecreate: $oImage = _WaitFor_IEGetObjById($oIE, "headerForm:j_idt26") Func _WaitFor_IEGetObjById($oCallersIE, $iCallersID, $iCallersMaxWaitMilSec = 5000) ConsoleWrite("Func[_WaitFor_IEGetObjById]: Start with params=[IsObj(" & $oCallersIE & ")," & $iCallersID & "," & $iCallersMaxWaitMilSec & "]." & @CRLF) $iTimer = TimerInit() $oObj = _IEGetObjById($oCallersIE, $iCallersID) While Not IsObj($iObj) And TimerDiff($iTimer) < $iCallersMaxWaitMilSec Sleep(100) $oObj = _IEGetObjById($oCallersIE, $iCallersID) WEnd If IsObj($oObj) Then ConsoleWrite("Func[_WaitFor_IEGetObjById]: Found callers ID=[" & $iCallersID & "]." & @CRLF) Return $oObj Else ConsoleWrite("Func[_WaitFor_IEGetObjById]: UNable to find callers ID=[" & $iCallersID & "] within milliseconds=[" & iCallersMaxWaitMilSec & "]." & @CRLF) Return False EndIf EndFunc ;==>_WaitFor_IEGetObjById another route...look into this node while loading, and while not loading: <span id="loadingProgress" style="display: none;"></span> There will be a way to grab this while loading, and then, loop for the attribute to NOT be loading....there will be differences in the style attribute in the diff states Edited May 31, 2013 by jdelaney IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now