dnnytn

How to Click on Javascript / Dojo TreeNode on Webpage

6 posts in this topic

Hi Everyone, due to email system migration, I am trying to automate the email forwarding per account basis on webmail. The action required for each user is:

1. Logging in to webmail for the user

2. Click on the "Options" link

3. On the pop-up box, click on "Mail", then "Forwarding" (Screen shot provided)

4. Followed by keying in the forwarding details. 

I am stuck on step 3. It appears that the links for "Mail" and "Forwarding" are javascript and not real links. I do not have any programming and development experience and just started with AutoIT 2 weeks back just for this specific task. 

The source for the page is here, it looks like the part that i should be focusing on is : 

 

<!DOCTYPE HTML PUBLIC '-//W3C//DTD HTML 4.01 Strict//EN' 'http://www.w3.org/TR/html4/strict.dtd'>
<html>
<head>
  <meta http-equiv='X-UA-Compatible' content='IE=EmulateIE7'>
  <title>WebMail - Corporate Edition - Options</title>
  
  <link rel='stylesheet' type='text/css' href='/extras/dojo/dojo1.4.3/dojox/grid/resources/Grid.css'>
  <link rel='stylesheet' type='text/css' id='tundraGrid' href='/extras/dojo/dojo1.4.3/dojox/grid/resources/tundraGrid.css'>

  
  <meta http-equiv='X-UA-Compatible' content='IE=EmulateIE7'>
  <meta http-equiv='Content-Type' content='text/html; charset=utf-8'>
  <script type='text/javascript'> 
  try{ 
  document.execCommand('BackgroundImageCache', false, true); 
  }catch(e){} 
  </script>   
  
<link rel='stylesheet' type='text/css' href='/extras/dojo/dojo1.4.3/dojo/resources/dojo.css'>
<link rel='stylesheet' type='text/css' id='tundra' href='/extras/dojo/dojo1.4.3/dijit/themes/tundra/tundra.css'>
<style type='text/css'>
  html, body, pre, input,
  .dijitTextBox,
  .dijitComboBox,
  .dijitMenuItem,
  .dijitSpinner,
  .dojoxGrid,
  .dijitTextArea {
     font-family:  'Lucida Grande', Tahoma, Arial, Helvetica, sans-serif !important;
  }
  .miraLoadingImg { background: url('/extras/dojo/dojo1.4.3/dojox/image/resources/images/loading.gif'); }
  .tundra .miraToolbar { background:url('/extras/dojo/dojo1.4.3/dijit/themes/tundra/images/titleBar.png') repeat-x top left !important; }
  .tundra .miraNoSortHeader:hover { background:url('/extras/dojo/dojo1.4.3/dijit/themes/tundra/images/tabEnabled.png') repeat-x top left !important; } 
  .tundra .miraNoSortHeader {background:url('/extras/dojo/dojo1.4.3/dijit/themes/tundra/images/tabEnabled.png') repeat-x top left !important; } 
  .tundra .dojoxGridHeader th {background:#E9E9E9 url('/extras/dojo/dojo1.4.3/dijit/themes/tundra/images/tabEnabled.png') repeat-x top left !important; border-top:0px !important; }
  
  .soria .miraNoSortHeader:hover{ background:url('/extras/dojo/dojo1.4.3/dijit/themes/soria/images/titleBar.png') repeat-x top left; }
  .soria .miraToolbar { background:#eaeaea url('/extras/dojo/dojo1.4.3/dijit/themes/soria/images/titleBar.png') repeat-x top left; }

  .nihilo .miraNoSortHeader:hover{ background:url('/extras/dojo/dojo1.4.3/dijit/themes/nihilo/images/titleBar.png') repeat-x top left; }
  .nihilo .miraToolbar { background:#eaeaea url('/extras/dojo/dojo1.4.3/dijit/themes/nihilo/images/titleBar.png') repeat-x top left; }
  .nihilo .dojoxGridHeader .dojoxGridCell{background:#E9E9E9 url('/extras/dojo/dojo1.4.3/dijit/themes/tundra/images/tabEnabled.png') repeat-x top left !important; }
  .nihilo .dijitTitlePaneTitle{background:#E9E9E9 url('/extras/dojo/dojo1.4.3/dijit/themes/tundra/images/tabEnabled.png') repeat-x top left !important; }                   
  .nihilo .dijitToolbar{background:#E9E9E9 url('/extras/dojo/dojo1.4.3/dijit/themes/tundra/images/tabEnabled.png') repeat-x top left !important; }
  .nihilo .dojoxGridHeader th{background:#E9E9E9 url('/extras/dojo/dojo1.4.3/dijit/themes/tundra/images/tabEnabled.png') repeat-x top left !important;
    border-top:0px!important;   
     }
  .dojoxGridMasterHeader {background:#E9E9E9 url('/extras/dojo/dojo1.4.3/dijit/themes/tundra/images/tabEnabled.png') repeat-x top left !important; }
  .dojoxGridHeader th{background:#E9E9E9 url('/extras/dojo/dojo1.4.3/dijit/themes/soria/images/titleBar.png') repeat-x top left !important;
    border-top:0px!important;   
     }
    
    
  .miraPlus { 
    background-image:url('/extras/dojo/dojo1.4.3/dijit/themes/tundra/images/plusButton.gif'); 
    background-repeat: no-repeat;
    text-align: center;
    vertical-align: middle;
    width: 16px;
    height: 16px;
  }
  .miraMinus { 
    background-image:url('/extras/dojo/dojo1.4.3/dijit/themes/tundra/images/minusButton.gif'); 
    background-repeat: no-repeat;
    text-align: center;
    vertical-align: middle;
    width: 16px;
    height: 16px;
  }
  .miraClose { 
    background-image:url('/extras/dojo/dojo1.4.3/dojox/image/resources/images/close.png');
    background-repeat: no-repeat;
    text-align: center;
    vertical-align: middle;
    width: 16px;
    height: 16px;
  }
  p font {line-height: 120%;}
  h1 font {line-height: 120%;}
  h2 font {line-height: 120%;}
  h3 font {line-height: 120%;}
  h4 font {line-height: 120%;}
  h5 font {line-height: 120%;}
  h6 font {line-height: 120%;}
</style>

 
<script type='text/javascript' src='/extras/dojo/dojo1.4.3/dojo/aggregate_dojo.js' 
        djConfig='isDebug: false, debugAtAllCosts: false,  parseOnLoad: true, usePlainJson: true, 
        baseUrl: "/extras/dojo/dojo1.4.3/dojo/", 
        locale:"en-us", extraLocale: ["en-us"]'></script> 

<script type='text/javascript' src='/extras/dojo/dojo1.4.3/dojo/ce.js'></script>

  
<style type='text/css'>
.gen_silk_icon {
  background-image: url(/wm/eml/icons/silk_imagemap.png?locale=en_US.ISO_8859-1&ui_ver=4.3.7-GA.5&brand=system&deldom=);
  background-repeat: no-repeat;
  width: 16px;
  height: 16px;
  text-align: center;
  vertical-align: middle;
}

.miraLogo {
  background-image: url(/wm/eml/icons/lhs_banner_logo.gif?locale=en_US.ISO_8859-1&ui_ver=4.3.7-GA.5&brand=system&deldom=);
  background-repeat: no-repeat;
  background-position: center center;
  width: 100%;
  height: 100%;
}

.handle {
  background-image: url(/wm/eml/icons/handle.png?locale=en_US.ISO_8859-1&ui_ver=4.3.7-GA.5&brand=system&deldom=);
  background-repeat: repeat-y;
  background-position: 0px 0px;
}

.genInfoSplitter {
  background-image: url(/wm/eml/icons/info_card_splitter.gif?locale=en_US.ISO_8859-1&ui_ver=4.3.7-GA.5&brand=system&deldom=);
  background-repeat: repeat-x;
  background-position: bottom;
  background-color: transparent;
  height: 4px;
  width: 100%;
  margin: 0px;
  padding: 0px;
}

.mcalFreeBusyGridInvalidRow {
  background-image: url(/wm/eml/icons/calendar_freebusy_invalid.gif?locale=en_US.ISO_8859-1&ui_ver=4.3.7-GA.5&brand=system&deldom=);
  position: absolute;
  border-width: 1px 1px 1px 1px;
  border-style: solid;
  border-color: #dddddd;
  z-index: 3;
  height: 19px;
}
</style>

  <link rel='stylesheet' type='text/css' id='system-default' href='/wm/eml/extras/css/aggregated_css/uui_system-default.css?ui_ver=4.3.7-GA.5&locale=en_US.ISO_8859-1&brand=system&deldom='>
  
  <link rel='SHORTCUT ICON' href='/wm/eml/icons/mirapoint.ico?locale=en_US.ISO_8859-1&ui_ver=4.3.7-GA.5&brand=system&deldom='>
  <script type='text/javascript' src='/wm/eml/eui.js?ui_ver=4.3.7-GA.5&locale=en_US.ISO_8859-1&brand=system&deldom='></script>
  
<script type='text/javascript'>
<!-- 
if (typeof __mainWindow__ != 'undefined' && __mainWindow__.__debug__) __include__('/wm/eml/debug.js'); 
//-->
</script>


<script type='text/javascript'>
<!--
    // dojo widgets, handles, etc.
    var model = null, tree = null, 
    stores = {},
    connects = [],
    lhs_item = null,
    anyone_perm_item = null,
    opt_change_ui_cb = dojo.hitch(eUI, 'opt_change_ui'),
    options_items = [];

    
options_items.push({
    'id'        : 'general',
    'label'     : localevar.get('General'),
    'url'       : null,
    'toplevel'  : true,
    'noselect'  : true
});

    

options_items.push({
    'id'    :   'popt_personal',
    'label' :   localevar.get('Account'),
    'url'   :   '/wm/eml/popt_personal.html',
    'pName' :   'general'
});


options_items.push({
    'id'    :   'changepass',
    'label' :   localevar.get('Change Password'), 
    'url'   :   '/cgi-bin/euadmin.cgi/eup/changepass.html',
    'pName' :   'general'
});


options_items.push({
    'id'    :   'popt_colortheme',
    'label' :   localevar.get('Color Theme'), 
    'url'   :   '/wm/eml/popt_colortheme.html',
    'pName' :   'general'
});


options_items.push({
    'id'    :   'popt_aboutpage',
    'label' :   localevar.get('About'), 
    'url'   :   '/wm/eml/popt_aboutpage.html',
    'pName' :   'general'
});


    
options_items.push({
    'id'        : 'mail',
    'label'     : localevar.get('Mail'),
    'url'       : null,
    'toplevel'  : true,
    'noselect'  : true
});

    

options_items.push({
    'id'    :   'mopt_general',
    'label' :   localevar.get('Settings'), 
    'url'   :   '/wm/eml/mopt_general.html',
    'pName' :   'mail'
});


options_items.push({
    'id'    :   'mopt_composing',
    'label' :   localevar.get('Composing'), 
    'url'   :   '/wm/eml/mopt_composing.html',
    'pName' :   'mail'
});


options_items.push({
    'id'        :   'autoreply',
    'label'     :   localevar.get('Auto-Reply'), 
    'url'       :   '/cgi-bin/euadmin.cgi/eup/autoreply.html',
    'pName'     :   'mail'
});


options_items.push({
    'id'    :   'forward',
    'label' :   localevar.get('Forwarding'), 
    'url'   :   '/cgi-bin/euadmin.cgi/eup/forward.html',
    'pName' :   'mail'
});


options_items.push({
    'id'    :   'mopt_signature',
    'label' :   localevar.get('Signature'), 
    'url'   :   '/wm/eml/mopt_signature.html',
    'pName' :   'mail'
});


options_items.push({
    'id'    :   'getmail',
    'label' :   localevar.get('External Mail'), 
    'url'   :   '/cgi-bin/euadmin.cgi/eup/getmail.html',
    'pName' :   'mail'
});


options_items.push({
    'id'    :   'whitelist',
    'label' :   localevar.get('Allowed Senders'), 
    'url'   :   '/wm/eml/mopt_uce.html?ucetype=wl',
    'pName' :   'mail'
});


options_items.push({
    'id'    :   'blacklist',
    'label' :   localevar.get('Blocked Senders'), 
    'url'   :   '/wm/eml/mopt_uce.html?ucetype=bl',
    'pName' :   'mail'
});


options_items.push({
    'id'    :   'whitelistto',
    'label' :   localevar.get('Allowed Mailing Lists'), 
    'url'   :   '/wm/eml/mopt_uce.html?ucetype=recipwl',
    'pName' :   'mail'
});


options_items.push({
    'id'    :   'contfilt_adv',
    'label' :   localevar.get('Message Filters'), 
    'url'   :   '/cgi-bin/euadmin.cgi/eup/contfilt_adv.html',
    'pName' :   'mail'
});


    
options_items.push({
    'id'    :   'calendar',
    'label' :   localevar.get('Calendar'),
    'url'   :   null,
    'toplevel'  :   true,
    'service'   :   'calendar',
    'noselect'  :   true
});

    

options_items.push({
    'id'    :   'prefs_gen',
    'label' :   localevar.get('Presentation'), 
    'url'   :   '/mc/ecal/prefs_gen.html',
    'pName' :   'calendar'
});


options_items.push({
    'id'    :   'reminders',
    'label' :   localevar.get('Reminders'), 
    'url'   :   '/mc/ecal/reminders.html',
    'pName' :   'calendar'
});


options_items.push({
    'id'        :   'permissions',
    'label'     :   localevar.get('Sharing Controls'), 
    'url'       :   '/mc/ecal/permissions.html',
    'service'   :   'group_calendar',
    'pName'     :   'calendar'
});


options_items.push({
    'id'        :   'prefs_publish',
    'label'     :   localevar.get('Publish'), 
    'url'       :   '/mc/ecal/prefs_publish.html',
    'service'   :   'group_calendar',
    'pName'     :   'calendar'
});


    


options_items.push({
    'id'    :   'downloads',
    'label' :   localevar.get('Downloads'),
    'url'   :   null,
    'noselect'  :   true,
    'toplevel'  :   true
});

options_items.push({
    'id'    :   'download_ConnectR',
    'label' :   localevar.get('ConnectR for Outlook'), 
    'url'   :   '/mc/ecal/download_ConnectR.html',
    'pName' :   'downloads'
});





    dojo.addOnLoad(function(){
        stores.lhs = new dojo.data.ItemFileWriteStore({  data: { identifier:   'id',
                                 label:        'label',
                                 items:        eUI.prepareTree(options_items)
                              }
                              });
                            

        model = new dijit.tree.ForestStoreModel({
                                        store: stores.lhs,
                                        query: {toplevel:true},
                                        rootId: "options_root",
                                        childrenAttrs: ["children"]
                                });

        tree = new mira.Tree({
                                    model:      model,
                                    showRoot:   false,
                                    persist:    true,
                    id:         "options_tree"
                                   },
                                   document.getElementById("options_tree_here"));

        tree.startup();

    if (__mainWindow__.prefsMgr.haveService('group_calendar')) {
        stores.permissions = new mira.DataStore({
                            data:   {   identifier:'id',
                    label:'label',
                    items: []}
                    });
    }

        connects.push(dojo.connect(tree, "onClick", eUI, eUI.options_click));    

    eUI.popupLoaded();
    __mainWindow__.prefsMgr.go(eUI, options_items[1]);
    });

//-->
</script>
</head>
<body class="miraPopup tundra" onunload='eUI.eup_unload();'>
<div class="miraPreloader miraLoadingImg" id="mira_preloader"></div>
<div id ="mira_standby" target="opt_rhs" dojoType="dojox.widget.Standby" color="#eeeeee" zIndex="12000"></div>
<div dojoType="dijit.layout.BorderContainer" design="sidebar" style="height:100%;width:100%; overflow:hidden;" gutters="true">
    <div dojoType="dijit.layout.ContentPane" region="left" style="width:225px;" splitter="true">
    <div class="genTitle" style="width:100%;">Options</div>
    <div id="options_tree_here"></div>
    </div>
    <div dojoType="dijit.layout.ContentPane" id="opt_rhs" region="center" style="" onLoad="eUI.options_rhs_loaded();">
    </div>
</div>
</body>
</html>

It seems like the part i should be focusing on is here:

options_items.push({
    'id'    :   'forward',
    'label' :   localevar.get('Forwarding'), 
    'url'   :   '/cgi-bin/euadmin.cgi/eup/forward.html',
    'pName' :   'mail'
});

After searching the forum and reading the help file, I have attempted at least the following: 

1. _IENavigate - fail as the URL is special for each logged in session

2. _IELinkClickByText - failed as no link is found ( i used _IELinkGetCollection = 0 link found)

3. IETableGetCollection - only found 2 tables and its only for the right hand pane of the page. 

4. IEPropertyGet 'innertext' - no errors, but no clicking actions

5. _IETagNameAllGetCollection - Found Tagname: DIV, ID: dijit__TreeNode_10, innertext: * Forwarding but not able to use these information to get autoit to click.

6. _IEImgGetCollection - Found 41 instances of *blank.gif, tried to randomly click an index of gif, but no visible actions being done. 

 

My code is here, it is heavily commented out by the past attempts, so it must be hard to read, apologies in advance. The trouble begins at line 82. Any help or advice is greatly appreciated.

#cs ----------------------------------------------------------------------------

 AutoIt Version: 3.3.14.2
 Author:         Danny

 Script Function:
    Automate Mirapoint Forwarding PER user basis. THis needs to run for each
    user that is migrating

#ce ----------------------------------------------------------------------------
#include <IE.au3>
#include <MsgBoxConstants.au3>
;~ #include <Array.au3>

Global $i = 0

If $i = 7 Then
   MsgBox(0, "Rerun", "Lets try that again. Ensure that values are correctly entered")
EndIf

;~ MsgBox(0, "Notice", "System will now help you to forward your mails. Please key in your account information and do not interrupt the process")
;Get Email Address from user
Global $EmailAddr = "username@olddomain.com"

; Asks the user to enter a password.
Global $Password = "passwordentered"

;Get Forwarding Address from user
Global $FwdAddr = "FIRST.LASTname@newdomain.com"

; Display a progress bar window.
    ProgressOn("Progress Meter", "DO NOT INTERRUPT PROCESS", "0%", @DesktopWidth - 310, 0)

; Update the progress value of the progress bar window
    ProgressSet("25%", "25%")



; Open Webmail using IE
Global $oIE = _IECreate("http://webmail.sg.yusen-logistics.com")

_IELoadWait($oIE)

;click on Continue
_IELinkClickByText($oIE, "Continue to this website (not recommended).")

;fill in the user and password and click login button
Global $FormUser = _IEGetObjByName($oIE, "user")
Global $FormPassword = _IEGetObjByName($oIE, "password")
Global $Formlogin = _IEGetObjByName($oIE, "login")
_IEFormElementSetValue($FormUser, $EmailAddr)
_IEFormElementSetValue($FormPassword, $Password)
_IEAction($Formlogin, "click")
_IELoadWait($oIE)

; Update the progress value of the progress bar window
    ProgressSet("50%", "50%")

;#### Click on the "Options" link found on the first frame on top of the website ( 0 )
$oFrame = _IEFrameGetCollection ($oIE)
Local $iNumFrames = @extended
;~ Local $sTxt = $iNumFrames & " frames found" & @CRLF & @CRLF
;~ Local $oFrame = 0
;~ For $i = 0 To ($iNumFrames - 1)
;~     $oFrame = _IEFrameGetCollection($oIE, $i)
;~     $sTxt &= _IEPropertyGet($oFrame, "innertext") & @CRLF
;~ Next
;~ MsgBox($MB_SYSTEMMODAL, "Frames Info", $sTxt)
Sleep(3000)
_IELinkClickByText($oFrame, "Options");click Options link from frame object from its text
_IELoadWait($oIE)



;attach script to new pop up window
$oIE = _IEAttach("https://webmail.sg.yusen-logistics.com/cgi-bin/euadmin.cgi/eup/", "url")
Sleep(6000)


; Update the progress value of the progress bar window
    ProgressSet("65%", "65%")

;### Try using IEFormGetCollection = 1 form, invalid object type
;~ Local $oForms = _IEFormElementGetCollection($oIE)
;~ Local $iNumForms = @extended
;~ MsgBox($MB_SYSTEMMODAL, "Forms Info", "There are " & $iNumForms & " forms on this page")
;~ Local $oForm
;~ For $i = 0 To $iNumForms - 1
;~     $oForm = _IEFormGetCollection($oIE, $i)
;~     MsgBox($MB_SYSTEMMODAL, "Form Info", $oForm.name)
;~ Next






;### Try using IEImgGetCollection = 41 blank.gifs found
;~ Local $oImgs = _IEImgGetCollection($oIE)
;~ Local $iNumImg = @extended

;~ Local $sTxt = "There are " & $iNumImg & " images on the page" & @CRLF & @CRLF
;~ For $oImg In $oImgs
;~    $sTxt &= $oImg.src & @CRLF



;~ Next
;~ MsgBox($MB_SYSTEMMODAL, "Img Info", $sTxt)
;~ _IEImgClick($oIE, "https://webmail.sg.yusen-logistics.com/extras/dojo/dojo1.4.3/dojo/resources/blank.gif", "src", 10)



;#### Try using TagNameGetCollection using DIV
;~ Local $oTags_coll = _IETagNameGetCollection($oIE, "DIV")
;~    For $oTag_enum in $oTags_coll
;~    if $oTag_enum.innertext = "Forwarding" then
;~       MsgBox($MB_SYSTEMMODAL, "ID", "ID :" & $oTag_enum.id)


;~            _IEAction($oTag_enum, "click")

;~            ExitLoop

;~        EndIf
;~    Next

;~ ;#### Try using IETableGetCollection = 2 tables, only shows the right hand pane
;~ Local $oTable = _IETableGetCollection($oIE)
;~ Local $iNumTables = @extended
;~ MsgBox($MB_SYSTEMMODAL, "Table Info", "There are " & $iNumTables & " tables on the page")
;~ Local $oTable = _IETableGetCollection($oIE, 1)
;~ Local $aTableData = _IETableWriteToArray($oTable)
;~ _ArrayDisplay($aTableData)


;#### Try using IEPropertyGet then action click
;~ If _IEPropertyGet($oIE, "innertext") Then
;~     MsgBox($MB_SYSTEMMODAL, "Status", "Forwarding link found")
;~   If String(_IEPropertyGet($oIE, "innertext")) = "* Forwarding" Then
;~    _IEAction($oIE, "focus")
;~       _IEAction($oIE, "click")
;~ Else
;~     MsgBox($MB_SYSTEMMODAL, "Status", "Forwarding link not found")

;~ EndIf


;#### Send manual keyboard commands

;~ Send("{TAB 3}")
;~ Send("{DOWN 9}")
;~ Send("{ENTER}")

;#### Get all frames = 0 Frames found
;~ Local $oFrames = _IEFrameGetCollection($oIE)
;~ Local $iNumFrames = @extended
;~ Local $sTxt = $iNumFrames & " frames found" & @CRLF & @CRLF
;~ Local $oFrame = 0
;~ For $i = 0 To ($iNumFrames - 1)
;~     $oFrame = _IEFrameGetCollection($oIE, $i)
;~     $sTxt &= _IEPropertyGet($oFrame, "innertext") & @CRLF
;~ Next
;~ MsgBox($MB_SYSTEMMODAL, "Frames Info", $sTxt)

;#### Get all tags and IDs in page. Found ID = dijit_TreeNode_10, innertext: *Forwarding)
;~ Local $oElements = _IETagNameAllGetCollection($oIE)
;~ For $oElement In $oElements
;~     If $oElement.id Then MsgBox($MB_SYSTEMMODAL, "Element Info", "Tagname: " & $oElement.tagname & @CRLF & "id: " & $oElement.id & @CRLF & "innerText: " & $oElement.innerText)
;~ Next

;#### Click by ID = dijit__TreeNode_10 (double underscore)
;~ Local $oForward = _IEGetObjById($oIE, 'forward')
;~ MsgBox($MB_SYSTEMMODAL, "Status", @error)
;~ _IEAction($oForward, "focus");
;~ _IEAction($oForward, "click");
; Get coordinates and dimensions of the dijit__TreeNode_10
;~ Local $iScreenX = _IEPropertyGet($oForward, "screenx")
;~ Local $iScreenY = _IEPropertyGet($oForward, "screeny")
;~ Local $iBrowserX = _IEPropertyGet($oForward, "browserx")
;~ Local $iBrowserY = _IEPropertyGet($oForward, "browserY")
;~ Local $iWidth = _IEPropertyGet($oForward, "width")
;~ Local $iHeight = _IEPropertyGet($oForward, "height")
;~ Local $iMousespeed = 50
;~ MouseMove($iScreenX + $iWidth / 2, $iScreenY + $iHeight / 2, $iMousespeed)



;#### Click by text = *Forwarding and * Forwarding (with space)
;~ _IELinkClickByText($oIE, "*Forwarding")

;#### Get all links in page = 0 links found
;~ $oLinks = _IELinkGetCollection($oIE)
;~ Local $iNumLinks = @extended

;~ Local $sTxt = $iNumLinks & " links found" & @CRLF & @CRLF
;~ For $oLink In $oLinks
;~     $sTxt &= $oLink.href & @CRLF
;~ Next
;~ MsgBox($MB_SYSTEMMODAL, "Link Info", $sTxt)

;#### Click by objectname = forward, * Forward, *Forward
;~ Local $oForward = _IEGetObjByName($oIE, "*Forward")
;~ _IEAction($oForward, "click");click Forward link from frame object from its text

;#### Using IENavigate to the url
;~ _IENavigate($oIE, "https://webmail.sg.yusen-logistics.com/wm/mail/cgi-bin/euadmin.cgi/eup/forward.html")

#cs------------------
;click on Yes radio button and key in forwarding email address
Sleep(1000)
Send("{TAB 4}")
Send("{SPACE}")
Send("{TAB}")
Send($FwdAddr)
Send("+{TAB 3}")
Send("{SPACE}")
Sleep(1500)
Send("{TAB 2}")
Send("{ENTER}")
#ce------------------
;~ ;Click on the "Apply Button"
;~ $oFrame = _IEFrameGetCollection ($oIE, 1)
;~ _IEImgClick($oFrame, "Apply", "alt")
;~ Sleep(2000)
;~ ;Click on Close
;~ ;_IEImgClick($oFrame, "Close", "alt")
;~ _IEQuit($oIE)
$oIE = _IEAttach("WebMail - Corporate Edition")
;~ _IEQuit($oIE)

 

Options_Page.png

Share this post


Link to post
Share on other sites



; example of tag and innerhtml <span class="buttonText">start</span>
    $spans = $ie.document.getElementsByTagName('span')
    for $s in $spans
    If $s.innerHTML = "start" Then
        $s.click()
    EndIf
    Next

if to right click view sourcecode on the page find the tag and the innerHTML this will work

i use w3schools for this as they give you examples

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

How many "!DOCTYPE" tag you see in your HTML source in your webpage ?

 

Edited by mLipok

Signature beginning:   Wondering who uses AutoIT and what it can be used for ?
* GHAPI UDF - modest begining - comunication with GitHub REST API *
ADO.au3 UDF     POP3.au3 UDF     XML.au3 UDF    How to use IE.au3  UDF with  AutoIt v3.3.14.x  for other useful stuff click the following button

Spoiler

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. 

My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST API *

My contribution to others projects or UDF based on  others projects: * _sql.au3 UDF  * POP3.au3 UDF *  RTF Printer - UDF * XML.au3 - BETA * ADO.au3 UDF SMTP Mailer UDF *

Useful links: * Forum Rules * Forum etiquette *  Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * 

Wiki: Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Best coding practices * 

IE Related:  * How to use IE.au3  UDF with  AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * 

I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions *  EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *

"Homo sum; humani nil a me alienum puto" - Publius Terentius Afer
"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming"
:naughty:  :ranting:, be  :) and       \\//_.

Anticipating Errors :  "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty."

Signature last update: 2017-06-04

Share this post


Link to post
Share on other sites
On 1/6/2016 at 4:16 AM, mLipok said:

How many "!DOCTYPE" tag you see in your HTML source in your webpage ?

 

hi mLipok, i only see 1 x <!Doctype> tag when i use the View Source function in IE. 

Share this post


Link to post
Share on other sites
On 1/4/2016 at 2:41 AM, bikerbrooks said:
; example of tag and innerhtml <span class="buttonText">start</span>
    $spans = $ie.document.getElementsByTagName('span')
    for $s in $spans
    If $s.innerHTML = "start" Then
        $s.click()
    EndIf
    Next

if to right click view sourcecode on the page find the tag and the innerHTML this will work

i use w3schools for this as they give you examples

hi bikerbrooks, based on the View Source page, i am not able to get any clues on which Tag. 

options_items.push({
    'id'    :   'forward',
    'label' :   localevar.get('Forwarding'), 
    'url'   :   '/cgi-bin/euadmin.cgi/eup/forward.html',
    'pName' :   'mail'
});

 

Share this post


Link to post
Share on other sites
On 4.01.2016 at 9:11 AM, dnnytn said:

3a. On the pop-up box,  (???? What a PopUp ??? )
3b. click on "Mail",
3c. then "Forwarding"

......

I am stuck on step 3.  Please be more precisely: What you mean: 3a ? 3b ? 3c ?

btw.
Inpsect "Mail" and give here Outer HTML snippet for this part of "Tree" .


Signature beginning:   Wondering who uses AutoIT and what it can be used for ?
* GHAPI UDF - modest begining - comunication with GitHub REST API *
ADO.au3 UDF     POP3.au3 UDF     XML.au3 UDF    How to use IE.au3  UDF with  AutoIt v3.3.14.x  for other useful stuff click the following button

Spoiler

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. 

My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST API *

My contribution to others projects or UDF based on  others projects: * _sql.au3 UDF  * POP3.au3 UDF *  RTF Printer - UDF * XML.au3 - BETA * ADO.au3 UDF SMTP Mailer UDF *

Useful links: * Forum Rules * Forum etiquette *  Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * 

Wiki: Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Best coding practices * 

IE Related:  * How to use IE.au3  UDF with  AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * 

I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions *  EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *

"Homo sum; humani nil a me alienum puto" - Publius Terentius Afer
"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming"
:naughty:  :ranting:, be  :) and       \\//_.

Anticipating Errors :  "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty."

Signature last update: 2017-06-04

Share this post


Link to post
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

  • Similar Content

    • milos83
      By milos83
      How can I check if element is focused in Firefox using FF.au3 UDF?
      This is my try:
      I have prepared a function that checks if the object is focused:
       
      _FFCmd('FFau3.isfocused=function isfocused(a){try{return (a === document.activeElement)}catch(e){return}}') $oElm = _FFXPath("//*[@id='someId']") ConsoleWrite(_FFIsFocused($oElm)) Func _FFIsFocused($sElement = "") Local $isFoc = _FFCmd("FFau3.isfocused(" & $sElement & ")") Return $isFoc EndFunc ;==>_FFIsFocused Now, the javascript part is tested and it does return successfully.
      After a lot of try/fails I inserted an alert box in order to display the object being compared.
      Here is what I got
       
      The focused object is: [object XULElement]
      The object that I send for comparing is [object HTMLInputElement]
      Why is that?
       
       
    • Ubermensch
      By Ubermensch
      Hello guys,
      I am trying to create autoit codes in order to determine if IE button was clicked or pressed.
      I am not sure if it is possible for IE button.
      Here is my initial code.
      #include <IE.au3> #include <MsgBoxConstantsau #include <WinAPI.au3> AutoIt $searchTab = "Untitled 1 - Internet Explorer" WinActivate("Untitled 1 - Internet Explorer") Local $oIE = _IEAttach("", "instance", 1) For $i = 0 To 100 Send("^" & $i) Sleep(250) If Not(StringInStr(WinGetTitle("[ACTIVATE]", $searchTab) = 0) Then While 1 If $oGetItem = 1 Then MsgBox($MB_SYSTEMMODAL, "Attention!", "It's working!") EndIf WEnd ExitLoop EndIf Next  
    • Chimp
      By Chimp
      Hi all.
      I'm playing a bit with the ScriptControl object using as base this example by @genius257.
      here is a very simple try, ... but it fails. what I'm doing wrong?
      Local $oSC = ObjCreate("ScriptControl") $oSC.Language = "JScript" $oSC.ExecuteStatement('alert("I am a javascript alert box!");') MsgBox(0,'AutoIt','Pause') Thanks
    • Ubermensch
      By Ubermensch
      Hello guys,
      I am new here in our forum. I do have a little knowledge about AutoIt. I hope you could assist me. 
      I am currently working on a project. I want to try to create an automated time tracking tool.
      This is how I want to function our time tracking tool.
      Start time when the IE "get" button  is clicked. End time when either "Next Step", "Save" or "Cancel" button is clicked. All the values in the available fields will be stored in an Excel I already have codes for the time tracking part, unfortunately, I cannot proceed since I am encountering an error for detecting the buttons in IE.
      Here is my initial code for detecting the IE button.
      #include <IE.au3> #include <MsgBoxConstants.au3> Local $oIE = _IECreate("C:\Users\april\Documents\Logo\JRB\AutoIt\AutoBOT\AWD10\sampleAWD10.html") Local $oLastName = _IEFormElementGetObjByName($oIE, "Text4") Local $oGetItem = _IEFormElementGetObjByName($oIE, "getitem") _IELoadWait($oIE) _IEAction($oGetItem, "click") MsgBox($MB_SYSTEMMODAL, "Form Element Value", _IEFormElementGetValue($oGetItem)) Here is the console output.
      >"C:\Program Files (x86)\AutoIt3\SciTE\..\AutoIt3.exe" "C:\Program Files (x86)\AutoIt3\SciTE\AutoIt3Wrapper\AutoIt3Wrapper.au3" /run /prod /ErrorStdOut /in "C:\Users\april\Documents\Logo\JRB\AutoIt\AutoBOT\AWD10\AWD10.au3" /UserParams +>23:22:20 Starting AutoIt3Wrapper v.17.224.935.0 SciTE v.3.7.3.0 Keyboard:00000409 OS:WIN_10/ CPU:X64 OS:X64 Environment(Language:0409) CodePage:0 utf8.auto.check:4 +> SciTEDir => C:\Program Files (x86)\AutoIt3\SciTE UserDir => C:\Users\april\AppData\Local\AutoIt v3\SciTE\AutoIt3Wrapper SCITE_USERHOME => C:\Users\april\AppData\Local\AutoIt v3\SciTE >Running AU3Check (3.3.14.2) from:C:\Program Files (x86)\AutoIt3 input:C:\Users\april\Documents\Logo\JRB\AutoIt\AutoBOT\AWD10\AWD10.au3 +>23:22:20 AU3Check ended.rc:0 >Running:(3.3.14.2):C:\Program Files (x86)\AutoIt3\autoit3.exe "C:\Users\april\Documents\Logo\JRB\AutoIt\AutoBOT\AWD10\AWD10.au3" --> Press Ctrl+Alt+Break to Restart or Ctrl+Break to Stop --> IE.au3 T3.0-2 Error from function _IELoadWait, $_IESTATUS_ClientDisconnected (-2147417848, Browser has been deleted prior to operation.) --> IE.au3 T3.0-2 Error from function _IEFormElementGetObjByName, $_IESTATUS_InvalidObjectType --> IE.au3 T3.0-2 Error from function _IEFormElementGetObjByName, $_IESTATUS_InvalidObjectType --> IE.au3 T3.0-2 Error from function _IELoadWait, $_IESTATUS_InvalidObjectType () --> IE.au3 T3.0-2 Error from function _IEAction(click), $_IESTATUS_InvalidDataType --> IE.au3 T3.0-2 Error from function _IEFormElementGetValue, $_IESTATUS_InvalidDataType +>23:22:23 AutoIt3.exe ended.rc:0 +>23:22:23 AutoIt3Wrapper Finished. >Exit code: 0 Time: 3.105 Here are the errors.
      --> IE.au3 T3.0-2 Error from function _IELoadWait, $_IESTATUS_ClientDisconnected (-2147417848, Browser has been deleted prior to operation.)
      --> IE.au3 T3.0-2 Error from function _IEFormElementGetObjByName, $_IESTATUS_InvalidObjectType
      --> IE.au3 T3.0-2 Error from function _IEFormElementGetObjByName, $_IESTATUS_InvalidObjectType
      --> IE.au3 T3.0-2 Error from function _IELoadWait, $_IESTATUS_InvalidObjectType ()
      --> IE.au3 T3.0-2 Error from function _IEAction(click), $_IESTATUS_InvalidDataType
      --> IE.au3 T3.0-2 Error from function _IEFormElementGetValue, $_IESTATUS_InvalidDataType
      And here is my HTML code.
      <!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-Language" content="en-us" /> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Untitled 1</title> <style type="text/css"> .style1 { text-align: left; } .style3 { font-family: Arial; font-size: 9pt; color: #CC00FF; margin: 0; padding: 0; } .style4 { font-family: Arial; } .style5 { font-size: 9pt; } .style6 { color: #CC00FF; } .style7 { background-color: #FF9999; } .style8 { font-family: Arial; font-size: 7pt; color: #CC00FF; } .style9 { font-size: 7pt; } .style10 { border: 2px solid #CC00FF; } .style11 { text-align: center; } .style12 { border: 1px solid #CC00FF; } .style13{ clear: both; width: 525px; height: 45px; background: url(file:///C:/Users/april/Documents/JRB/AutoIt/AutoBOT/AWD10/lockedby.png) no-repeat; margin: 0; padding: 0; list-style: none; } .style14{ float: right; margin: 0px 0px 0 0; width: 290px; height: 25px; } .style15{ float: left; margin: 0px 0px 0 0; width: 290px; height: 25px; } .style16 { font-family: Arial; font-size: 2.5pt; color: #CC00FF; margin: 0; padding: 0; } .style17 { font-family: Arial; font-size: 7pt; color: #CC00FF; margin: 0; padding: 0; } .style18 { border-color: transparent; border: none; background-color:transparent; font-family: Arial; font-size: 8pt; } </style> </head> <body> <input type="button" name="getitem" value="get" onclick=" document.getElementById('filename').value = 'Life - ' + Random() + ' INVESTTAUTH - Process - Updateable - Assigned To: Jejeje - Create Date/Time: 2017-05-26-11.12.45.109044 - POL: 046054173 - TYPE: POLICY - SLA: 06/05/2017 ADMIN SYS: VP -PLC: 14' document.getElementById('businessarea').value = 'BusinessArea' + Random() document.getElementById('worktype').value = 'Worktype' + Random() "/><br/> <table style="width: 25%" align="center" class="style10"> <tr> <td style="width: 525px"> <img src="C:\Users\april\Documents\Logo\JRB\AutoIt\AutoBOT\AWD10\openitems.png" width="525px" height="28" /><br /> <div class="style13" style="height: 28px; width: 514px;"> <div class="style14" style="height: 11px; width: 110px;"> <label id="username"><span class="style16">&nbsp;</span><span class="style3"><br /> </span><span class="style17"> <script type="text/javascript"> var WinNetwork = new ActiveXObject("WScript.Network"); document.write(WinNetwork.UserName); </script> </span> </label> </div> <div class="style14" style="height: 11px; width: 52px;"> <label id="Label4"><span class="style16">&nbsp;</span><span class="style3"><br /> </span><span class="style17">Locked by </span> </label> </div> <div class="style15" style="height: 11px; width: 351px;"> <form method="post" id="openfile" class="style15" style="width: 341px"> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <input name="file" id="filename" class="style18" type="text" style="width: 200px; height: 10px" /></div> </form> </div> <label id="Label3"><span class="style3"><br/> &nbsp; </span><span class="style8"><strong>&nbsp;LTC Claims Indexing Form</strong></span><span class="style3"><br /> <br/> </span></label> <form method="post" id="formawddata" style="width: 495px"> <fieldset name="Group1" style="width: 495px" class="style12"> <legend class="style8"><strong>AWD Data</strong></legend> <table style="width: 100%"> <tr> <td style="width: 86px" class="style3">&nbsp;&nbsp;&nbsp;&nbsp; <span class="style9">Business Area:</span></td> <td style="width: 144px" class="style8"><input name="Text4" id="businessarea" class="style18" type="text" /></td> <td style="width: 45px" class="style8">Worktype:</td> <td class="style8"><input name="Text5" id="worktype" class="style18" type="text" /></td> </tr> </table> </fieldset><br /> </form> <form method="post" id="doc" style="width: 495px"> <fieldset name="Group1" style="width: 495px; height : 55px;" class="style12"> <legend class="style8"><strong>Document Data</strong></legend> &nbsp;&nbsp;&nbsp; <span class="style8">Document Type</span><br /> &nbsp;&nbsp;&nbsp; <span class="style4"><span class="style9"> <select name="Select1" id="documenttype" style="width: 363px"> <option></option> <option value="Doc1">Doc1</option> <option value="Doc2">Doc2</option> <option value="Doc3">Doc3</option> <option value="Doc4">Doc4</option> <option value="Doc5">Doc5</option> <option value="Doc6">Doc6</option> <option value="Doc7">Doc7</option> <option value="Doc8">Doc8</option> <option value="Doc9">Doc9</option> <option value="Doc10">Doc10</option> <option value="Doc11">Doc11</option> <option value="Doc12">Doc12</option> <option value="Doc13">Doc13</option> <option value="Doc14">Doc14</option> <option value="Doc15">Doc15</option> <option value="Doc16">Doc16</option> <option value="Doc17">Doc17</option> <option value="Doc18">Doc18</option> <option value="Doc19">Doc19</option> <option value="Doc20">Doc20</option> </select></span></span></fieldset><br /> </form> <form method="post" id="myForm"style="width: 495px; height: 103px;"> <fieldset name="Group1" style="width: 495px; height: 95px;" class="style12"> <legend class="style8"><strong>Policy Data</strong></legend> &nbsp;&nbsp;&nbsp; <span class="style8">Claim Number&nbsp;</span><span class="style3">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="style8">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Policy Number/LTC ID</span><br /> &nbsp;&nbsp;&nbsp; <input name="Text1" id="claimnumber" type="text" style="width: 153px" class="style7" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <input name="Text2" id="policynumber"type="text" style="width: 152px" class="style7" /><br /> &nbsp;&nbsp;&nbsp; <span class="style8">Company Code</span><br /> &nbsp;&nbsp;&nbsp; <span class="style7"> <span class="style4"><span class="style9"> <select name="Select2" id="companycode" style="width: 157px"> <option></option> <option value="CC00001">CC00001</option> <option value="CC00002">CC00002</option> <option value="CC00003">CC00003</option> <option value="CC00004">CC00004</option> <option value="CC00005">CC00005</option> <option value="CC00006">CC00006</option> <option value="CC00007">CC00007</option> <option value="CC00008">CC00008</option> <option value="CC00009">CC00009</option> <option value="CC000010">CC000011</option> <option value="CC000011">CC000011</option> <option value="CC000012">CC000012</option> <option value="CC000013">CC000013</option> <option value="CC000014">CC000014</option> <option value="CC000015">CC000015</option> <option value="CC000016">CC000016</option> <option value="CC000017">CC000017</option> <option value="CC000018">CC000018</option> <option value="CC000019">CC000019</option> <option value="CC000020">Doc20</option> </select></span></span></span></fieldset></form><table style="width: 95%; height: 114px;"> <tr> <td style="height: 23px; width: 212px;" class="style1"> <form method="post" style="width: 173px" > <fieldset name="Group1" style="width: 175px; height: 64px;" class="style12"> <legend class="style8"><strong>Routing</strong></legend> &nbsp;&nbsp;&nbsp; <span class="style4"><span class="style6"> <span class="style5"><span class="style9"> <input name="Radio1" type="radio" checked="checked" value="1" /></span></span><span class="style9">Indexed<br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span class="style5"><span class="style9"> <input name="Radio1" type="radio" value="2" /> Reroute</span></span></span></span></fieldset></form></td> <td style="height: 23px"> <span class="style8">AWD Comments</span> <form method="post" id="awdcomments" style="width: 278px; height: 47px"> <textarea name="TextArea1" style="width: 273px; height: 59px" cols="20" class="style7"></textarea></form><br /> </td> </tr> </table> <br /> <div class="style11"> <input name="button1" type="button" onclick="myFunction()" value="Next Step"/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; <input name="button2" type="button" onclick="myFunction()" value="Save" style="width: 91px"/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <input name="button3" type="button" onclick="myFunction()" value="Cancel" style="width: 94px"/> <script> function myFunction() { document.getElementById("doc").reset(); document.getElementById("myForm").reset(); document.getElementById("awdcomments").reset(); document.getElementById("formawddata").reset(); document.getElementById("openfile").reset(); document.getElementById("businessarea").reset(); document.getElementById("worktype").reset(); document.getElementById("documenttype").reset(); document.getElementById("policynumber").reset(); document.getElementById("companycode").reset(); document.getElementById("claimnumber").reset(); document.getElementById("Label4").reset(); } </script> <script type="text/javascript"> function Random() { return Math.floor(Math.random() * 10000000); } </script> <br /> <br /> </div> </td> </tr> </table> <p> &nbsp;</p> &nbsp; </body> </html> I hope you could assist me. Thank you in advance!
    • Ubermensch
      By Ubermensch
      Hello,
      I am currently trying to automatically click the "Yes" button in the ActiveX prompt/popup message after opening the IE (html).
      At 1st, I encounter the "Allow Blocked Content". I already resolve it just by changing settings in the IE Options. But after resolving the "Allow Blocked Content", there's a popup message appear.
      I have attached the ActiveX Prompt.
      Here is the 1st code that I try to use.
      #include <IE.au3> #include <MsgBoxConstants.au3> #include <WinAPI.au3> _IECreate("C:\Users\april\Documents\Logo\JRB\AutoIt\AutoBOT\AWD10\sampleAWD10.html",0,1,0) Local $oIE = _IEAttach("", "instance", 1) _IELoadWait($oIE) AdlibRegister("_ActiveXRun",250) Local $oLastName = _IEGetObjByName($oIE, "Text4") Local $oGetItem = _IEGetObjByName($oIE, "getitem") _IEAction($oGetItem, "click") MsgBox($MB_SYSTEMMODAL, "Form Element Value", _IEFormElementGetValue($oGetItem)) Func _ActiveXRun() $retWin = WinGetHandle("[Class:Button]","") $winTitle = "[HANDLE:" & $retWin &"]" $ctrlHandle = ControlGetHandle($winTitle,"", "[CLASS:Button; INSTANCE:2]") $ctrlTitle = "HANDLE:" & $ctrlHandle &"]" WinWaitActive($ctrlTitle,"[CLASS:Button; INSTANCE:2]",10) $k = ControlGetPos($winTitle, "","[CLASS:Button; INSTANCE:2]") $x = $k[0] $y = $k[1] WinActivate ($winTitle,"An ActiveX control on this page might be unsafe to interact with other parts of the page. Do you want to allow this interaction?") ControlFocus($winTitle,"An ActiveX control on this page might be unsafe to interact with other parts of the page. Do you want to allow this interaction?","[CLASS:Button; INSTANCE:2]") ControlClick($winTitle, "","[CLASS:Button; INSTANCE:2]","primary",1,$x,$y) ControlSend($winTitle, "", "[CLASS:Button; INSTANCE:2]", "{ENTER}", 0) EndFunc Here is the console output.
      >"C:\Program Files (x86)\AutoIt3\SciTE\..\AutoIt3.exe" "C:\Program Files (x86)\AutoIt3\SciTE\AutoIt3Wrapper\AutoIt3Wrapper.au3" /run /prod /ErrorStdOut /in "C:\Users\april\Documents\Logo\JRB\AutoIt\AutoBOT\AWD10\AWD10.1.au3" /UserParams +>12:44:11 Starting AutoIt3Wrapper v.17.224.935.0 SciTE v.3.7.3.0 Keyboard:00000409 OS:WIN_10/ CPU:X64 OS:X64 Environment(Language:0409) CodePage:0 utf8.auto.check:4 +> SciTEDir => C:\Program Files (x86)\AutoIt3\SciTE UserDir => C:\Users\april\AppData\Local\AutoIt v3\SciTE\AutoIt3Wrapper SCITE_USERHOME => C:\Users\april\AppData\Local\AutoIt v3\SciTE >Running AU3Check (3.3.14.2) from:C:\Program Files (x86)\AutoIt3 input:C:\Users\april\Documents\Logo\JRB\AutoIt\AutoBOT\AWD10\AWD10.1.au3 +>12:44:11 AU3Check ended.rc:0 >Running:(3.3.14.2):C:\Program Files (x86)\AutoIt3\autoit3.exe "C:\Users\april\Documents\Logo\JRB\AutoIt\AutoBOT\AWD10\AWD10.1.au3" --> Press Ctrl+Alt+Break to Restart or Ctrl+Break to Stop "C:\Users\april\Documents\Logo\JRB\AutoIt\AutoBOT\AWD10\AWD10.1.au3" (31) : ==> Subscript used on non-accessible variable.: $x = $k[0] $x = $k^ ERROR ->12:44:24 AutoIt3.exe ended.rc:1 +>12:44:24 AutoIt3Wrapper Finished. >Exit code: 1 Time: 13.76 I also tried a simpler code.
      include <IE.au3> #include <MsgBoxConstants.au3> #include <WinAPI.au3> _IECreate("C:\Users\april\Documents\Logo\JRB\AutoIt\AutoBOT\AWD10\sampleAWD10.html",0,1,0) Local $oIE = _IEAttach("", "instance", 1) _IELoadWait($oIE) $k = ControlGetPos("[CLASS:#32770]", "","[CLASS:Button; INSTANCE:2]") $x = $k[0] $y = $k[1] ControlClick("[CLASS:#32770]", "","[CLASS:Button; INSTANCE:2]","primary",1,$x,$y) Local $oLastName = _IEGetObjByName($oIE, "Text4") Local $oGetItem = _IEGetObjByName($oIE, "getitem") _IEAction($oGetItem, "click") MsgBox($MB_SYSTEMMODAL, "Form Element Value", _IEFormElementGetValue($oGetItem)) There's no error in the console output for the 2nd code I have tried.
      And here is the Window Info for the ActiveX prompt.
      >>>> Window <<<< Title: Internet Explorer Class: #32770 Position: 580, 338 Size: 376, 146 Style: 0x94C808C4 ExStyle: 0x00010101 Handle: 0x00000000001516FA >>>> Control <<<< Class: Button Instance: 2 ClassnameNN: Button2 Name: Advanced (Class): [CLASS:Button; INSTANCE:2] ID: 1 Text: &Yes Position: 184, 77 Size: 80, 22 ControlClick Coords: 37, 12 Style: 0x50010000 ExStyle: 0x00000004 Handle: 0x00000000001215DE >>>> Mouse <<<< Position: 228, 120 Cursor ID: 0 Color: 0xFFFFFF >>>> StatusBar <<<< >>>> ToolsBar <<<< >>>> Visible Text <<<< &No An ActiveX control on this page might be unsafe to interact with other parts of the page. Do you want to allow this interaction? &Yes >>>> Hidden Text <<<<