Jump to content

How to automate “Open” button(Button/Icon? Not sure) which has no ControlID ?


Recommended Posts

Hi,

Below is the issue that I’m facing now.

PFA snapshot with this post for reference.

The task is to automate the click of “Open” button(Button/Icon? Not sure) (Refer snapshot). I don’t want to capture the (x,y)’s of the button and then automate the click process since it may/may not work with other screen resolutions as well. Secondly, except the ‘ControlClick Coords’ (under ‘Control’ tab in ‘AutoIt v3 Window Info’) nothing gets changed. Likewise, ‘Position’ and ‘Color’ (under ‘Mouse’ tab in ‘AutoIt v3 Window Info’).

Is there any way/procedure to automate the click of “Open” button? Kindly help me with sample code if you have. If you need more details please feel free to contact at shreeks@ymail.com

Thanks. For further reference below is the HTML code of the page in which the “Open” button(Button/Icon? Not sure) is present.

<html>
    <head>
        <title>Pentaho User Console</title>
        <meta name="gwt:property" content="locale=en_US">
        <link rel="shortcut icon" href="/pentaho-style/favicon.ico" />
        <link rel='stylesheet' href='mantle/MantleStyle.css'/>
        <link rel="stylesheet" href="content/data-access/resources/gwt/datasourceEditorDialog.css">
    <script type="text/javascript" src="mantle/nativeScripts.js"></script>
    <script type="text/javascript">
      if(window.opener && window.opener.reportWindowOpened != undefined){
        window.opener.reportWindowOpened();
      }
    var dataAccessAvailable = false; //Used by child iframes to tell if data access is available.
    /* this function is called by the gwt code when initing, if the user has permission */
    function initDataAccess(hasAccess) {
      dataAccessAvailable = hasAccess;
      if(!hasAccess){
        return;
      }
      if(typeof(addMenuItem) == "undefined"){
        setTimeout("initDataAccess("+hasAccess+")", 1000);
        return;
      } else {
        addMenuItem("manageDatasourcesEllipsis","manage_content_menu", "ManageDatasourcesCommand");
        addMenuItem("newDatasource","new_menu", "AddDatasourceCommand");
      }
    }
    var datasourceEditorCallback = {
      onfinish : function(val, transport) {
      },
      onerror : function(val) {
        alert('error:' + val);
      },
      onCancel : function() {
      },
      onReady : function() {
      }
    }
    // This allows content panels to have PUC create new datasources. The iframe requesting
    // the new datasource must have a function "openDatasourceEditorCallback" on it's window scope
    // to be notified of the successful creation of the datasource.
    function openDatasourceEditorIFrameProxy(windowReference){
        var callbackHelper = function(bool, transport){
            windowReference.openDatasourceEditorCallback(bool, transport);
        }
        openDatasourceEditor(new function(){
        this.onerror = function(err){
          alert(err);
        }
        this.onCancel = function(){
        }
        this.onReady = function(){
        }
        this.onfinish = function(bool, transport){
          callbackHelper(bool, transport);
        }
      });
    }
    </script>
    </head>
    <body oncontextmenu="return false;">
    <div id="loading">
            <div class="loading-indicator">
                <img src="mantle/large-loading.gif" width="32" height="32"/>Pentaho User Console is Loading...<a href="http://www.pentaho.com"></a><br/>
                <span id="loading-msg">Please Wait</span>
            </div>
    </div>
    <!-- OPTIONAL: include this if you want history support -->
    <iframe id="__gwt_historyFrame" style="width:0px;height:0px;border:0;display:none"></iframe>
    </body>
    <script language='javascript' src='mantle/mantle.nocache.js'></script>
    <script language='javascript' src='content/data-access/resources/gwt/DatasourceEditor.nocache.js'></script>
</html>

Learning is Lifelong!
Link to comment
Share on other sites

AutoIt window info won't help since you're inside a web browser. Hopefully you're using IE. If so, this worked for me on the demo page:

#include <IE.au3>
$oIE = _IEAttach("Pentaho User Console")
_IEImgClick($oIE, "http://demo.pentaho.com/pentaho/mantle/images/open_32.png")

It might work for you if you adjust the URL of the image to the same page you're using (replace demo.pentaho.com). Otherwise you'd need to install something like DebugBar to help you easily gets the source of that IMG you want to click. There are other ways to do it, this is just one. Check the help file for "IE Management" to read all about IE functions and get examples for them.

Link to comment
Share on other sites

AutoIt window info won't help since you're inside a web browser. Hopefully you're using IE. If so, this worked for me on the demo page:

#include <IE.au3>
$oIE = _IEAttach("Pentaho User Console")
_IEImgClick($oIE, "http://demo.pentaho.com/pentaho/mantle/images/open_32.png")

It might work for you if you adjust the URL of the image to the same page you're using (replace demo.pentaho.com). Otherwise you'd need to install something like DebugBar to help you easily gets the source of that IMG you want to click. There are other ways to do it, this is just one. Check the help file for "IE Management" to read all about IE functions and get examples for them.

MrMitchell,

Thanks !!!

It works fine. All that I did is replaced

_IEImgClick($oIE,"http://demo.pentaho.com/pentaho/mantle/images/open_32.png")

by

_IEImgClick($oIE, "http://localhost:8080/pentaho/mantle/images/open_32.png")

Thank you once again.

Learning is Lifelong!
Link to comment
Share on other sites

Hi,

Please find attached snapshot(Open box.png) with this post before reading on. I need to automate the clicking of ‘Steel Wheels’ folder present in the Open dialog box(Refer the snap shot). To add few other details, the “AutoItv3 Window Info” doesn’t show ControlID when the finder tool is made run over ‘Steel Wheels’.I don’t want to capture the (x,y)’s of the button and then automate the click process since it may/may not work with other screen resolutions as well.

Secondly, except the ‘ControlClick Coords’ (under ‘Control’ tab in ‘AutoIt v3 Window Info’) nothing gets changed. Likewise, ‘Position’ and ‘Color’(under ‘Mouse’ tab in ‘AutoIt v3 Window Info’).Is there any way/procedure to automate the click of ‘Steel Wheels’? Kindly help me with sample code if you have. If you need more details please feel free to contact at shreeks@ymail.com.Thanks. For further refer the above HTML(very first post in this thread) code of the page in which the 'Open' button(Button/Icon? Not sure) is present.

Note : The 'Open dialog box' opens when I click the 'Open' button/icon(Refer Open box full.png).

Learning is Lifelong!
Link to comment
Share on other sites

MrMitchell,

Thanks !!!

It works fine. All that I did is replaced

_IEImgClick($oIE,"http://demo.pentaho.com/pentaho/mantle/images/open_32.png")

by

_IEImgClick($oIE, "http://localhost:8080/pentaho/mantle/images/open_32.png")

Thank you once again.

How did you find that Open_32.png is in that path? Can you elaborate a little on this?

Learning is Lifelong!
Link to comment
Share on other sites

Hi,

Please find attached snapshot(Open box.png) with this post before reading on. I need to automate the clicking of ‘Steel Wheels’ folder present in the Open dialog box(Refer the snap shot). To add few other details, the “AutoItv3 Window Info” doesn’t show ControlID when the finder tool is made run over ‘Steel Wheels’.I don’t want to capture the (x,y)’s of the button and then automate the click process since it may/may not work with other screen resolutions as well.

Secondly, except the ‘ControlClick Coords’ (under ‘Control’ tab in ‘AutoIt v3 Window Info’) nothing gets changed. Likewise, ‘Position’ and ‘Color’(under ‘Mouse’ tab in ‘AutoIt v3 Window Info’).Is there any way/procedure to automate the click of ‘Steel Wheels’? Kindly help me with sample code if you have. If you need more details please feel free to contact at shreeks@ymail.com.Thanks. For further refer the above HTML(very first post in this thread) code of the page in which the 'Open' button(Button/Icon? Not sure) is present.

Note : The 'Open dialog box' opens when I click the 'Open' button/icon(Refer Open box full.png).

You need to research the IE functions in the AutoIt help file.. Combine that with DebugBar and eventually you should be able to get all or at least most of that page automated.

Link to comment
Share on other sites

AutoIt window info won't help since you're inside a web browser. Hopefully you're using IE. If so, this worked for me on the demo page:

#include <IE.au3>
$oIE = _IEAttach("Pentaho User Console")
_IEImgClick($oIE, "http://demo.pentaho.com/pentaho/mantle/images/open_32.png")

It might work for you if you adjust the URL of the image to the same page you're using (replace demo.pentaho.com). Otherwise you'd need to install something like DebugBar to help you easily gets the source of that IMG you want to click. There are other ways to do it, this is just one. Check the help file for "IE Management" to read all about IE functions and get examples for them.

Hi MrMitchell,

Could you please tell me how you were able to find out the path("http://demo.pentaho.com/pentaho/mantle/images/open_32.png")?

Learning is Lifelong!
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...