Jump to content
Sign in to follow this  
CrewXp

Can you use autoit to click a button inside of div element inside of 5 cascading iframes?

Recommended Posts

CrewXp

I'm not sure how to go about this. I'm trying to use Autoit to (in the background), click a button on a webpage. The webpage is coded poorly and uses tons of frames within frames. If I right click and view source, I can't find the section or button I am looking for. Even if I do that (right click, view source) on the actual content I want.

I used Google's element inspector to try and find it and I found it.... But I do not know how to use (or if it is even possible) to use Autoit's automation to let me click the actual button. I can do it with simple IE items, but frames within frames within javascript within div tags, etc, is kind of hard. I got logging in working.

Does anyone mind helping me out?

A screenshot of Chrome's inspector over the element is attached.

Code of the page, but dont think it will help (Because it doesnt show whats needed)

<!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>
        <!--begin S2-->
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <title></title>
        <script type="text/javascript" src="/js/jquery/jquery-1.3.2.js"></script>
        <script type="text/javascript" src="/js/jquery/ui.core.js"></script>
        <script type="text/javascrupt" src="/js/jquery/jquery.mousewheel.js"></script>
        <script type="text/javascript" src="/js/jquery/ui.dialog.js"></script>
        <script type="text/javascript" src="/js/jquery/ui.datepicker.js"></script>
        <script type="text/javascript" src="/js/jquery/jquery.text-overflow.js"></script>
        <script type="text/javascript" src="/js/jquery/DD_roundies.uicornerfix.js"></script>
        <script type="text/javascript" src="/script/en/bootstrap.js"></script>
        <script type="text/javascript" src="/script/en/dialog.js"></script>
        <script type="text/javascript" src="/script/en/dateformat.js"></script>
        <script type="text/javascript" src="/script/en/s2.js"></script>
        <script type="text/javascript" src="/js/jquery/jQuery.bubbletip-1.0.5.js"></script>
        <script type="text/javascript" src="/js/jquery/jquery.ba-untils.js"></script>
        <script type="text/javascript" src="/js/jquery/jquery.simpleplaceholder.js"></script>
        <script type="text/javascript" src="/script/en/activityLog.js"></script>

        <link href="/js/jquery/bubbletip/bubbletip.css" rel="stylesheet" type="text/css" />
        <!--[if IE]>
            <link href="/js/jquery/bubbletip/bubbletip-IE.css" rel="stylesheet" type="text/css" />
        <![endif]--> 
        <link rel="stylesheet" type="text/css" href="/themes/s2/ui.all.css" />
        <script type="text/javascript">
            if(top.eventManager)
            {
                var isTearoff   = false;
                var boss        = top;
            }
            else
            {
                var isTearoff   = true;
                boss            = opener.top;   
                
            }
            
            windowManager   = boss.windowManager;
            myInfo          = boss.myInfo;
            
            if(isTearoff)
            {
                windowManager.loadTearoff(self);
                bootstrap.halt
                (   function()
                    {
                        windowManager.unloadTearoff(self);
                    }
                )
            }
            else
            {
                windowManager.load(self);
                bootstrap.halt
                (   function()
                    {
                        //windowManager.unload(self);
                    }
                )
            }
                
            function kill()
            {
                bootstrap.haltCallback = [];
                window.close();
            }
        </script>
        <!--end S2-->
        
    <!--begin s2frame-->
    <script type="text/javascript" src="/script/en/s2frame.js"></script>
    <!--end s2frame-->
    
    <!--begin s2monitor-->
    <script type="text/javascript" src="/js/jquery/ui.draggable.js"></script>
    <script type="text/javascript" src="/js/jquery/ui.droppable.js"></script>
    <script type="text/javascript" src="/js/jquery/ui.resizable.js"></script>
    <script type="text/javascript" src="/js/jquery/effects.core.js"></script>
    <script type="text/javascript" src="/js/jquery/effects.clip.js"></script>
    <script type="text/javascript" src="/js/jquery/farbtastic.js"></script>
    
    <script type="text/javascript" src="/js/jquery/jqGrid/i18n/grid.locale-en.js"></script>
    <script type="text/javascript" src="/js/jquery/jqGrid/grid.base.js"></script>
    <script type="text/javascript" src="/js/jquery/jqGrid/grid.common.js"></script>
    <script type="text/javascript" src="/js/jquery/jqGrid/grid.formedit.js"></script>
    <script type="text/javascript" src="/js/jquery/jqGrid/grid.inlinedit.js"></script>
    <script type="text/javascript" src="/js/jquery/jqGrid/grid.celledit.js"></script>
    <script type="text/javascript" src="/js/jquery/jqGrid/grid.subgrid.js"></script>
    <script type="text/javascript" src="/js/jquery/jqGrid/grid.treegrid.js"></script>
    <script type="text/javascript" src="/js/jquery/jqGrid/grid.custom.js"></script> 
    <script type="text/javascript" src="/js/jquery/jqGrid/grid.postext.js"></script>
    <script type="text/javascript" src="/js/jquery/jqGrid/grid.tbltogrid.js"></script> 
    <script type="text/javascript" src="/js/jquery/jqGrid/grid.setcolumns.js"></script>
    <script type="text/javascript" src="/js/jquery/jqGrid/grid.import.js"></script>
    <script type="text/javascript" src="/js/jquery/jqGrid/jquery.fmatter.js"></script>
    <script type="text/javascript" src="/js/jquery/jqGrid/JsonXml.js"></script>
    <script type="text/javascript" src="/js/jquery/jqGrid/jquery.searchFilter.js"></script>     
    <script type="text/javascript" src="/js/jquery/jqGrid/grid.jqueryui.js"></script>   
    <script type="text/javascript" src="/js/jquery/jquery.dropshadow.js"></script>
    <script type="text/javascript" src="/js/jquery/jquery.rightClick.js"></script>
    <script type="text/javascript" src="/js/jquery/jquery.treeview.js"></script>
    <script type="text/javascript" src="/js/jquery/jquery.text-overflow.js"></script>
    <script type="text/javascript" src="/script/en/desktop/desktop.js"></script>
    <script type="text/javascript" src="/script/en/desktop/widgetPrototype.js"></script>
    <script type="text/javascript" src="/script/en/desktop/widgetDimensions.js"></script>
    <script type="text/javascript" src="/script/en/dialog.js"></script>
    <script type="text/javascript" src="/script/en/editForm.js"></script>
    <script type="text/javascript" src="/script/en/validator.js"></script>
    <script type="text/javascript" src="/script/en/controlPrototype.js"></script>
    <script type="text/javascript" src="/script/en/edit.js"></script>
    <script type="text/javascript" src="/script/en/desktop/colorPicker.js"></script>
    <script type="text/javascript" src="/script/en/desktop/sounds.js"></script>
    <script type="text/javascript" src="/script/en/dateformat.js"></script>
    <script type="text/javascript" src="/script/en/linkedList.js"></script>     
    
    <script type="text/javascript" src="/js/jquery/jqDnR.js"></script>
    <script type="text/javascript" src="/js/jquery/jqModal.js"></script>
    
    <link rel="stylesheet" type="text/css" href="/style/farbtastic.css" />
    <link rel="stylesheet" type="text/css" href="/style/jquery.treeview.css" />
    <link rel="stylesheet" type="text/css" href="/style/s2edit.css" />
    <link rel="stylesheet" type="text/css" href="/style/desktop.css" />
    
    <script type="text/javascript">
        bootstrap.boot
        (   function(index)
            {
                page = {}
                page.title      =   'Portal Unlock'
page.header     =   {   breadcrumbs:    [   {   text: 'Main',           url: '/menu/en/main/'       },
                                            {   text: 'Monitor',        url: '/menu/en/monitor/'    },
                                            {   text: 'Portal Status'                           }
                                        ]
                    }
page.footer     =   {   makeStartPage:  true
                    }
page.desktop    =   {   widget:         {   className:   'portalStatus'  }
                    }



            
                var dw = $(document).width();
                var dh = $(document).height();
                $('#desktopLoading').css( { top: ((dh - 48)/2) + "px", left: ((dw - 48)/2) + "px" } );
                
                eventManager    = boss.eventManager;
                activityLog     = boss.activityLog;
                permissions     = boss.permissions;
                license         = boss.license;
                LOG             = boss.LOG;
                dutyLogResponse = boss.dutyLogResponse;
                personSections  = boss.personSections;
                regions         = boss.regions;
                accessLevels    = boss.accessLevels;
                stateValues     = boss.stateValues;
    
                desktop.configuration   = { taskBar: false, threatMonitor: false, background: false, fitToScreen: true };
                desktop.preview         = false;
                desktop.autoLoad        = 'widget';
                desktop.admin           = false;
                desktop.defaultWidget   = page.desktop.widget.className;
                desktop.defaultOptions  = page.desktop.widget.options;
                bootstrap.done(index);
            }
        )
    </script>
    <!--end s2monitor-->

    <!--begin s2frame-->
    <link rel="stylesheet" type="text/css" href="/styleSheet/s2frame.css" />
    <script type="text/javascript">
        bootstrap.ready
        (   function()
            {
                    s2Frame.render(page.header, page.footer);
            }
        )
    </script>
    <!--end s2frame-->

        <!--begin S2-->
        <link rel="stylesheet" type="text/css" href="/styleSheet/s2.css" /> 
        <script type="text/javascript">
            var datepickerOptions   = getJSON('/utility/datepickerOptions',         cacheAlways())
            var page = {};
            
            bootstrap.ready
            (   function()
                {
                    if(typeof(page) != 'undefined' && page.title)
                        document.title = page.title;
                }
            )
            
            //$.uicornerfix('4px');
        </script>
        <!--end S2-->
    </head>
    <body class="ui-widget" id="s2body">
        




<div id="frameHeader" 
>
</div>
<div id="frame">


<div id="desktopLoading" style="position: absolute; width: 48px; height: 48px;">
    <img src="/graphics/ajax/layout.gif" />
</div>
<div id="desktop" class="desktop" style="display: none; z-order: -9999;">
</div>

</div>
<div id="frameFooter">
</div>

    </body>
    <script type="text/javascript">
        $(window).bind("unload", function () {windowManager.unload(self);});
    </script>
</html>

post-4499-0-74558700-1380077847_thumb.jp

Share this post


Link to post
Share on other sites
ozmike

 the tag you found dosen't have a onclick event which you can fire - so it could be hard , Search for the 'unlock0_17' or 'unlock' text in the js files , then you may be able to 

use $oIE.document.parentwindow.execscript() to execute that js function or similar - if you can find it!  looks like button is executed in jquery so probably #unlock.click() something like that i'm not an expert in jquery..

oh try putting a break point - you can do this in chrome ..might indentify what being executed..this is not simple page..!

Note,  autoit automates through IE not chrome (there is a chrome UDF but its early days) so -use  IE it has some developer tools (F12) and an inspector..as thats what you will be automating

hope that helps - 

Edited by ozmike

Share this post


Link to post
Share on other sites
Chimp

Take a look >here

bye


small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt....

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
Sign in to follow this  

×