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

    • Chimp
      By Chimp
      An example on how to inject jQuery into a web page
      It can be useful to manage the page from AutoIt using jQuery.
      Idea from here: http://www.learningjquery.com/2009/04/better-stronger-safer-jquerify-bookmarklet
      Suggestions and improvements are welcome
      #include <ie.au3> Example() Func Example() Local $oIE = _IECreate("www.google.com") Local $jQuery = _jQuerify($oIE) MsgBox(0, "Version", "jQuery version: " & $jQuery.fn.jquery) MsgBox(0, "Example", "click ok to exit." & @CRLF & "Google logo will fade out by jQuery...") $jQuery('#hplogo').fadeOut(3000) ; jQuery will fade out the google logo EndFunc ;==>Example ; #FUNCTION# ==================================================================================================================== ; Name ..........: _jQuerify ; Description ...: ; Syntax ........: _jQuerify(Byref $oIE) ; Parameters ....: $oIE - Object variable of an InternetExplorer.Application. ; Return values .: an object variable pointing to the jQuery library ; Author ........: Chimp ; Modified ......: ; Remarks .......: ; Related .......: ; Link ..........: ; Example .......: ; =============================================================================================================================== Func _jQuerify(ByRef $oIE) Local $jsEval, $jQuery, $otherlib = False ; create a reference to the javascript eval() function $oIE.document.parentWindow.setTimeout('document.head.eval = eval', 0) Do Sleep(250) $jsEval = Execute('$oIE.Document.head.eval') Until IsObj($jsEval) ; if jQuery is not already loaded then load it If $jsEval("typeof jQuery=='undefined'") Then ; check if the '$' (dollar) name is already in use by other library If $jsEval("typeof $=='function'") Then $otherlib = True Local $oScript = $oIE.document.createElement('script'); $oScript.type = 'text/javascript' ; If you want to load jQuery from a disk file use the following statement ; where i.e. jquery-1.9.1.js is the file containing the jQuery source ; (or also use a string variable containing the whole jQuery listing) ;~ $oScript.TextContent = FileRead(@ScriptDir & "\jquery-1.9.1.js") ; <--- from a file ; If you want to download jQuery from the web use this statement $oScript.src = 'https://code.jquery.com/jquery-latest.min.js' ; <--- from an url $oIE.document.getElementsByTagName('head').item(0).appendChild($oScript) Do Sleep(250) Until $jsEval("typeof jQuery == 'function'") EndIf Do Sleep(250) $jQuery = $jsEval("jQuery") Until IsObj($jQuery) If $otherlib Then $jsEval('jQuery.noConflict();') Return $jQuery EndFunc ;==>_jQuerify  
    • Tippex
      By Tippex
      I have a problem trying to use _IEAttach to recover control after a Windows Explorer reset (e.g. on Windows 7), since all the 
      InternetExplorer.Application objects appear to be destroyed by this event. An example of this is when a PC has some kind of fault causing a pop-up error message "Windows Explorer has stopped working". I can simulate this event by using Windows Task Manager to end the Explorer.exe process then to file, new task (run...) Explorer.exe
      After this event, _IEAttach gives an @error of: 
      7 ($_IEStatus_NoMatch) - No Match
      However, using WinList() followed by WinGetText() I can recover the URL for an IE session that has lost its 
      InternetExplorer.Application object which could be used to _IECreate a new session (the $iTryAttach fails) and WinKill() the original session but the result is a if a refresh had been done (any form entries are lost) . Unfortunately form entries do not appear as text or hidden text to Windows so I'm looking for the best way to read the contents of an Internet Explorer screen (even if just text without structure). 
      When there is no InternetExplorer.Application object (because of some Windows fault) but still with an Internet Explorer session running, I tried to read its contents by a "Select All" & "Copy to Clipboard" but its form entries are blanked and combo boxes choices are all displayed with no way of finding out which ones were selected.
      Local $ClipBoardSave = _ClipBoard_GetData() ;not ClipGet() which is text only ClipPut("") ;Clear User's Clipboard Local $sText = "" Local $hWnd = WinActivate("Window Title", "") If IsHWnd($hWnd) Then Local $bStatusCtrlSend = ControlSend("Window Title", "", "", "^a^c") If $bStatusCtrlSend Then Local $bStatusCtrlClick = ControlClick("Window Title", "", "") If $bStatusCtrlClick Then $sText = ClipGet() _ClipBoard_SetData($ClipBoardSave) ;not ClipPut($ClipBoardSave) which is text only  
      Is  there a solution to this please?
    • XaelloNegative
      By XaelloNegative
      Hi there.
      Im having some kind of a coder block here, 
      <td class="treeview ctl00_CenterContent_objTreeView_2" style="white-space:nowrap;"> <input type="checkbox" name="ctl00_CenterContent_objTreeViewn1CheckBox" id="ctl00_CenterContent_objTreeViewn1CheckBox"> <span class="ctl00_CenterContent_objTreeView_0 treeview ctl00_CenterContent_objTreeView_1" id="ctl00_CenterContent_objTreeViewt1" style="border-style:none;font-size:1em;"> <i class="fa fa-file-code-o fa-fw"> </i> <span data-placement="bottom" data-toggle="tooltip" title="" data-original-title="Tool tip for said part">REFUNDS</span></span></td> this is a code directly from the website im working with. I was thinking of inserting a javascript that would get the "REFUNDS" part. Any ideas on how to do so?
      Any thoughts will be highly appreciated.
    • Patryk
      By Patryk
      Dear Colleagues,
      I have no idea how to refer to style.display in my loop. There is a button like: 
      <input name="ctl00$bodyPlaceholder$btnFecharProcessamento" class="button" id="bodyPlaceholder_btnFecharProcessamento" style="display: none;" onclick="FecharJanelaProcessamento();return false;" type="submit" value="Fechar"> I want it to be clicked as soon as button's style change from style="display: none;" to  style= ="display: inline-block;" 
      This is what I got, but it's not working...
      Func GetButtons() $oButtons = _IEGetObjByName($oForm,"ctl00$bodyPlaceholder$btnFecharProcessamento",-1) $i = 0 While $i <> 1 For $oBtn In $oButtons If _IEFormElementGetValue($oBtn) = "Fechar" And $oBtn.document.style.display = "display: inline-block;" Then $i = 1 _IEAction($oBtn, "focus") _IEAction($oBtn, "click") ExitLoop EndIf Next WEnd EndFunc  
      I will really appreciate if you could help me with these loop!
    • Omnitica
      By Omnitica
      Hello!
      I'm new to the forums! Couldn't find any threads covering this issue. Sorry if I'm wrong.

      I'm having problems changing the text/value of a input box. The particular box doesn't have a name or id, just: class="jq_hotkeys_enabled form-control".
      This class appears multiple times throughout the source, so I don't think It's right to reference that object. 
      See image 1.
      However, I've managed to find a object with the name "ctl00$content$ctrl$ucServiceTime$rpServicetimes$ctl00$edtHiddenResourceHelper" which contains the value of the input box, and the id for the person in the dropdown/combobox left of it. (with "dummy-1" selected).
      See image 2.
      As you can see the value is 3982,4545     ( name , time )
      But when I try to change the value of it by doing:
      #include <IE.au3> Local $oIE = _IEAttach(WinGetHandle("[CLASS:IEFrame]"),"embedded") Local $oForm = _IEFormGetObjByName($oIE, "aspnetForm") Local $oInput = _IEFormElementGetObjByName($oForm, "ctl00$content$ctrl$ucServiceTime$rpServicetimes$ctl00$edtHiddenResourceHelper") _IEFormElementSetValue($oInput, "3982,1337") The box doesn't get its new value. I  can see in the source that it's changed though.
      See image 3.
       
      However, if I do: 
      #include <IE.au3> Local $oIE = _IEAttach(WinGetHandle("[CLASS:IEFrame]"),"embedded") Local $oForm = _IEFormGetObjByName($oIE, "aspnetForm") Local $oInput = _IEFormElementGetObjByName($oForm, "ctl00$content$ctrl$ucServiceTime$rpServicetimes$ctl00$edtHiddenResourceHelper") _IEFormElementSetValue($oInput, "3982,1337") $oIE.document.parentwindow.execScript("theForm.submit()") ; But it needs to reload the page The box gets its new value after the page reloads by the theForm.submit() function. 
      This is a bit unfortunate as I want the changes to happen instantly like when I type in the box with the keyboard... or select in the combobox.
      Maybe someone knows how I can do this? Looking forward to an answer! 
      Thanks in advance.
       
      Note: Unfortunately I can't provide with the real URL as it is constricted to employees in the company I work for, but let me know If I should provide anything else.