Jump to content

Help with clicking button on website


Recommended Posts

Hello all. I just decided to give AutoIt a try instead of Newbie Web Automation which I was using. So far I have been really impressed with AutoIt and even more this forum! Some very smart people really go out of their way to help here and that is rarely seen for me! I am sorry if its been covered somewhere but I can't find a solution in the manuals, examples or past posts.

I use it to auto-upload product inventory to my ecommerce website that runs on Oscommerce(Zencart-EZpopulate). I have everything working except this one form. I just want to either fill in the "localfile" textfield ("Import from Temp Dir") and click the "Insert into DB" button, or simply click the "Import" button near the bottom: Full-EP2009Jul17-1806.csv.

If you view this in a HTML editor you will understand what I want to do. Here is the page HTML source:

<!DOCTYPE html public "-//W3C//DTD HTML 4.01 Transitional//EN">
<html dir="ltr" lang="en">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <title>Zen Cart!</title>
    <link rel="stylesheet" type="text/css" href="includes/stylesheet.css">
    <link rel="stylesheet" type="text/css" href="includes/cssjsmenuhover.css" media="all" id="hoverJS">
    <script language="javascript" src="includes/menu.js"></script>
    <script language="javascript" src="includes/general.js"></script>
    <script type="text/javascript">
        <!--
        function init()
        {
        cssjsmenu('navbar');
        if (document.getElementById)
        {
        var kill = document.getElementById('hoverJS');
        kill.disabled = true;
        }
        }
        // -->
    </script>
</head>
<body onload="init()">
<!-- header //-->
<!-- All HEADER_ definitions in the columns below are defined in includes/languages/english.php //-->
<table border="0" width="100%" cellspacing="0" cellpadding="0" class="header">
  <tr>
    <td align="left" valign="top" height="70px" width="200px"><a href="http://localhost/stofresh/admin/index.php"><img src="images/logo.gif" border="0" alt="Admin Powered by Zen Cart :: The Art of E-Commerce" title=" Admin Powered by Zen Cart :: The Art of E-Commerce "></a></td>
    <td colspan="2" align="left"><table width="100%"><tr>
    <td align="left" class="main" valign="top"></td>
    <td align="right" class="main" valign="top"><a href="/stofresh/admin/easypopulate.php?vcheck=yes"><img src="includes/languages/english/images/buttons/button_check_new_version.gif" border="0" alt="Check for Updates to Zen Cart" title=" Check for Updates to Zen Cart "></a></td>
    </tr></table></td>
  </tr>
</table>
<table border="0" cellspacing="0" cellpadding="0" width="100%">
  <tr class="headerBar" height="20" width="100%">
 
    <td class="headerBarContent" align="left">
      &nbsp;    </td>
    <td class="headerBarContent" align="center"><b>Fri, 17 Jul 2009 23:02:23 -0500GMT&nbsp;[127.0.0.1 ]&nbsp;</b></td>
    <td class="headerBarContent" align="right"><a href="http://localhost/stofresh/admin/index.php" class="headerLink">Admin Home</a>&nbsp;|&nbsp;<a href="http://localhost/stofresh/index.php?main_page=" class="headerLink" target="_blank">Online Catalog</a>&nbsp;|&nbsp;<a href="http://www.zen-cart.com/" class="headerLink" target="_blank">Support Site</a>&nbsp;|&nbsp;<a href="http://localhost/stofresh/admin/server_info.php" class="headerLink">Version</a>&nbsp;|&nbsp;<a href="http://localhost/stofresh/admin/logoff.php" class="headerLink">Logoff</a>&nbsp;</td>
  </tr>
</table>
<!-- Menu bar #2. -->
<div id="navbar">
<ul class="nde-menu-system" onmouseover="hide_dropdowns('in')" onmouseout="hide_dropdowns('out')">
<!-- configuration //-->
<li class="submenu"> 
<a target="_top" href="http://localhost/stofresh/admin/alt_nav.php">Configuration</a><ul>
<li><a href="http://localhost/stofresh/admin/configuration.php?gID=1">My Store</a></li>
<li><a href="http://localhost/stofresh/admin/configuration.php?gID=2">Minimum Values</a></li>
<li><a href="http://localhost/stofresh/admin/configuration.php?gID=3">Maximum Values</a></li>
<li><a href="http://localhost/stofresh/admin/configuration.php?gID=4">Images</a></li>
<li><a href="http://localhost/stofresh/admin/configuration.php?gID=5">Customer Details</a></li>
<li><a href="http://localhost/stofresh/admin/configuration.php?gID=7">Shipping/Packaging</a></li>
<li><a href="http://localhost/stofresh/admin/configuration.php?gID=8">Product Listing</a></li>
<li><a href="http://localhost/stofresh/admin/configuration.php?gID=9">Stock</a></li>
<li><a href="http://localhost/stofresh/admin/configuration.php?gID=10">Logging</a></li>
<li><a href="http://localhost/stofresh/admin/configuration.php?gID=12">E-Mail Options</a></li>
<li><a href="http://localhost/stofresh/admin/configuration.php?gID=13">Attribute Settings</a></li>
<li><a href="http://localhost/stofresh/admin/configuration.php?gID=14">GZip Compression</a></li>
<li><a href="http://localhost/stofresh/admin/configuration.php?gID=15">Sessions</a></li>
<li><a href="http://localhost/stofresh/admin/configuration.php?gID=11">Regulations</a></li>
<li><a href="http://localhost/stofresh/admin/configuration.php?gID=16">GV Coupons</a></li>
<li><a href="http://localhost/stofresh/admin/configuration.php?gID=17">Credit Cards</a></li>
<li><a href="http://localhost/stofresh/admin/configuration.php?gID=18">Product Info</a></li>
<li><a href="http://localhost/stofresh/admin/configuration.php?gID=19">Layout Settings</a></li>
<li><a href="http://localhost/stofresh/admin/configuration.php?gID=20">Website Maintenance</a></li>
<li><a href="http://localhost/stofresh/admin/configuration.php?gID=21">New Listing</a></li>
<li><a href="http://localhost/stofresh/admin/configuration.php?gID=22">Featured Listing</a></li>
<li><a href="http://localhost/stofresh/admin/configuration.php?gID=23">All Listing</a></li>
<li><a href="http://localhost/stofresh/admin/configuration.php?gID=24">Index Listing</a></li>
<li><a href="http://localhost/stofresh/admin/configuration.php?gID=25">Define Page Status</a></li>
<li><a href="http://localhost/stofresh/admin/configuration.php?gID=30">EZ-Pages Settings</a></li>
<li><a href="http://localhost/stofresh/admin/configuration.php?gID=31">Easy Populate</a></li>
</ul>
</li>
<!-- configuration_eof //--><!-- catalog //-->
<li class="submenu"><a target="_top" href="http://localhost/stofresh/admin/alt_nav.php">Catalog</a><UL>
<li><a href="http://localhost/stofresh/admin/categories.php">Categories/Products</a></li>
<li><a href="http://localhost/stofresh/admin/product_types.php">Product Types</a></li>
<li><a href="http://localhost/stofresh/admin/products_price_manager.php">Products Price Manager</a></li>
<li><a href="http://localhost/stofresh/admin/options_name_manager.php">Option Name Manager</a></li>
<li><a href="http://localhost/stofresh/admin/options_values_manager.php">Option Value Manager</a></li>
<li><a href="http://localhost/stofresh/admin/attributes_controller.php">Attributes Controller</a></li>
<li><a href="http://localhost/stofresh/admin/downloads_manager.php">Downloads Manager</a></li>
<li><a href="http://localhost/stofresh/admin/option_name.php">Option Name Sorter</a></li>
<li><a href="http://localhost/stofresh/admin/option_values.php">Option Value Sorter </a></li>
<li><a href="http://localhost/stofresh/admin/manufacturers.php">Manufacturers</a></li>
<li><a href="http://localhost/stofresh/admin/reviews.php">Reviews</a></li>
<li><a href="http://localhost/stofresh/admin/specials.php">Specials</a></li>
<li><a href="http://localhost/stofresh/admin/featured.php">Featured Products</a></li>
<li><a href="http://localhost/stofresh/admin/salemaker.php">SaleMaker</a></li>
<li><a href="http://localhost/stofresh/admin/products_expected.php">Products Expected</a></li>
</UL>
</li>
<!-- catalog_eof //-->
<!-- modules //-->
<li class="submenu"><a target="_top" href="http://localhost/stofresh/admin/alt_nav.php">Modules</a><UL>
<li><a href="http://localhost/stofresh/admin/modules.php?set=payment">Payment</a></li>
<li><a href="http://localhost/stofresh/admin/modules.php?set=shipping">Shipping</a></li>
<li><a href="http://localhost/stofresh/admin/modules.php?set=ordertotal">Order Total</a></li>
</UL>
</li>
<!-- modules_eof //-->
<!-- customers //-->
<li class="submenu"><a target="_top" href="http://localhost/stofresh/admin/alt_nav.php">Customers</a><UL>
<li><a href="http://localhost/stofresh/admin/customers.php">Customers</a></li>
<li><a href="http://localhost/stofresh/admin/orders.php">Orders</a></li>
<li><a href="http://localhost/stofresh/admin/group_pricing.php">Group Pricing</a></li>
<li><a href="http://localhost/stofresh/admin/paypal.php">PayPal IPN</a></li>
</UL>
</li>
<!-- customers_eof //-->
<!-- taxes //-->
<li class="submenu"><a target="_top" href="http://localhost/stofresh/admin/alt_nav.php">Locations / Taxes</a><UL>
<li><a href="http://localhost/stofresh/admin/countries.php">Countries</a></li>
<li><a href="http://localhost/stofresh/admin/zones.php">Zones</a></li>
<li><a href="http://localhost/stofresh/admin/geo_zones.php">Zones Definitions</a></li>
<li><a href="http://localhost/stofresh/admin/tax_classes.php">Tax Classes</a></li>
<li><a href="http://localhost/stofresh/admin/tax_rates.php">Tax Rates</a></li>
</UL>
</li>
<!-- taxes_eof //-->
<!-- localization //-->
<li class="submenu"><a target="_top" href="http://localhost/stofresh/admin/alt_nav.php">Localization</a><UL>
<li><a href="http://localhost/stofresh/admin/currencies.php">Currencies</a></li>
<li><a href="http://localhost/stofresh/admin/languages.php">Languages</a></li>
<li><a href="http://localhost/stofresh/admin/orders_status.php">Orders Status</a></li>
</UL>
</li>
<!-- localization_eof //-->
<!-- reports //-->
<li class="submenu"><a target="_top" href="http://localhost/stofresh/admin/alt_nav.php">Reports</a><UL>
<li><a href="http://localhost/stofresh/admin/stats_products_viewed.php">Products Viewed</a></li>
<li><a href="http://localhost/stofresh/admin/stats_products_purchased.php">Products Purchased</a></li>
<li><a href="http://localhost/stofresh/admin/stats_customers.php">Customer Orders-Total</a></li>
<li><a href="http://localhost/stofresh/admin/stats_products_lowstock.php">Products Low Stock</a></li>
<li><a href="http://localhost/stofresh/admin/stats_customers_referrals.php">Customers Referral</a></li>
</UL>
</li>
<!-- reports_eof //-->
<!-- tools //-->
<li class="submenu"><a target="_top" href="http://localhost/stofresh/admin/alt_nav.php">Tools</a><UL>
<li><a href="http://localhost/stofresh/admin/template_select.php">Template Selection</a></li>
<li><a href="http://localhost/stofresh/admin/layout_controller.php">Layout Boxes Controller</a></li>
<li><a href="http://localhost/stofresh/admin/banner_manager.php">Banner Manager</a></li>
<li><a href="http://localhost/stofresh/admin/mail.php">Send Email</a></li>
<li><a href="http://localhost/stofresh/admin/newsletters.php">Newsletter and Product Notifications Manager</a></li>
<li><a href="http://localhost/stofresh/admin/server_info.php">Server/Version Info</a></li>
<li><a href="http://localhost/stofresh/admin/whos_online.php">Who's Online</a></li>
<li><a href="http://localhost/stofresh/admin/admin.php">Admin Settings</a></li>
<li><a href="http://localhost/stofresh/admin/email_welcome.php">Email Welcome</a></li>
<li><a href="http://localhost/stofresh/admin/store_manager.php">Store Manager</a></li>
<li><a href="http://localhost/stofresh/admin/developers_tool_kit.php">Developers Tool Kit</a></li>
<li><a href="http://localhost/stofresh/admin/ezpages.php">EZ-Pages</a></li>
<li><a href="http://localhost/stofresh/admin/define_pages_editor.php">Define Pages Editor</a></li>
<li><a href="http://localhost/stofresh/admin/sqlpatch.php">Install SQL Patches</a></li>
<li><a href="http://localhost/stofresh/admin/easypopulate.php">Easy Populate</a></li>
</UL>
</li>
<!-- tools_eof //-->
<!-- gv_admin //-->
<li class="submenu"><a target="_top" href="http://localhost/stofresh/admin/alt_nav.php">Gift Certificate/Coupons</a><UL>
<li><a href="http://localhost/stofresh/admin/coupon_admin.php">Coupon Admin</a></li>
<li><a href="http://localhost/stofresh/admin/gv_queue.php">Gift Certificates Queue</a></li>
<li><a href="http://localhost/stofresh/admin/gv_mail.php">Mail Gift Certificate</a></li>
<li><a href="http://localhost/stofresh/admin/gv_sent.php">Gift Certificates sent</a></li>
</UL>
</li>
<!-- gv_admin_eof //-->
<!-- extras_dhtml //-->
<li class="submenu"><a target="_top" href="http://localhost/stofresh/admin/alt_nav.php">Extras</a><UL>
<li><a href="http://localhost/stofresh/admin/record_artists.php">Record Artists</a></li>
<li><a href="http://localhost/stofresh/admin/record_company.php">Record Companies</a></li>
<li><a href="http://localhost/stofresh/admin/music_genre.php">Music Genre</a></li>
<li><a href="http://localhost/stofresh/admin/media_manager.php">Media Manager</a></li>
<li><a href="http://localhost/stofresh/admin/media_types.php">Media Types</a></li>
</UL>
</li>
<!-- extras_dhtml_eof //-->
</ul>
</div>
<!-- header_eof //-->
 
<!-- body //-->
    <table border="0" width="100%" cellspacing="2" cellpadding="2">
        <tr>
<!-- body_text //-->
            <td width="100%" valign="top">
<img src="images/pixel_trans.gif" border="0" alt="" width="1" height="10">              <table border="0" width="100%" cellspacing="0" cellpadding="0">
                    <tr>
                        <td class="pageHeading">Easy Populate 1.2.5.5.csv</td>
                    </tr>
                </table>
<img src="images/pixel_trans.gif" border="0" alt="" width="1" height="10">              <table border="0" width="100%" cellspacing="0" cellpadding="0">
                    <tr>
                        <td valign="top">
                
                            <table width="70%" border="0" cellpadding="8" valign="top">
                                <tr>
                                    <td width="100%">
                                        <p>
                                            <form ENCTYPE="multipart/form-data" ACTION="easypopulate.php" METHOD="POST">
                                                <div align = "left">
                                                    <b>Upload EP File</b><br />
                                                    <input TYPE="hidden" name="MAX_FILE_SIZE" value="100000000">
                                                    <input name="usrfl" type="file" size="50">
                                                    <input type="submit" name="buttoninsert" value="Insert into db">
                                                    <br />
                                                </div>
                                            </form>
                                            <br>
                                            <form ENCTYPE="multipart/form-data" ACTION="easypopulate.php" METHOD="POST">
                                                <div align = "left">
                                                    <b>Import from Temp Dir (tempEP/)</b><br />
                                                    <input TYPE="text" name="localfile" size="50">
                                                    <input type="submit" name="buttoninsert" value="Insert into db">
                                                    <br />
                                                </div>
                                            </form>
                                        </p>
                                        <b>Download EP and Froogle Files</b>
                                        <br /><br />
                                        <!-- Download file links -  Add your custom fields here -->
                                        <a href="easypopulate.php?download=stream&dltype=full">Download <b>Complete</b> .csv file to edit</a>
                                        <span class="fieldRequired"> (Attributes Not Included)</span>
                                        <br />
                                        <a href="easypopulate.php?download=stream&dltype=priceqty">Download <b>Model/Price/Qty</b> .csv file to edit</a><br />
                                        <a href="easypopulate.php?download=stream&dltype=category">Download <b>Model/Category</b> .csv file to edit</a><br />
                                        <a href="easypopulate.php?download=stream&dltype=froogle">Download <b>Froogle</b> tab-delimited .txt file</a><br />
                                        <a href="easypopulate.php?download=stream&dltype=attrib">Download <b>Model/Attributes</b> .csv file</a>
                                        <br /><br />
                                        <b>Create EP and Froogle Files in Temp Dir: <a href="../tempEP/">tempEP/</a></b>
                                        <br /><br />
                                        <a href="easypopulate.php?download=tempfile&dltype=full">Create <b>Complete</b> .csv file in temp dir</a>
                                        <span class="fieldRequired"> (Attributes Not Included)</span>
                                        <br />
                                        <a href="easypopulate.php?download=tempfile&dltype=priceqty">Create <b>Model/Price/Qty</b> .csv file in temp dir</a><br />
                                        <a href="easypopulate.php?download=tempfile&dltype=category">Create <b>Model/Category</b> .csv file in temp dir</a><br />
                                        <a href="easypopulate.php?download=tempfile&dltype=froogle">Create <b>Froogle</b> tab-delimited .txt file in temp dir</a><br />
                                        <a href="easypopulate.php?download=tempfile&dltype=attrib">Create <b>Model/Attributes</b> .csv file in temp dir</a><br />
                                    </td>
                                </tr>
                            </table>
<br /><link rel="stylesheet" type="text/css" href="../tempEP/dlf/styles.css" />
<script language="javascript" type="text/javascript"> 
<!--
function o(n, i) {
    document.images['thumb'+n].src = '../tempEP/dlf/i.php?f='+i;
 
}
 
function f(n) {
    document.images['thumb'+n].src = '../tempEP/dlf/trans.gif';
}
//-->
</script>
<div id="dlf_container">
    <form enctype="multipart/form-data" action="easypopulate.php" method="post">
        <input type='hidden' name='localfile' value=''>
    <div id="listingcontainer">
        <div id="listingheader"> 
        <div id="headerfile"><a href="/stofresh/admin/easypopulate.php?dir=&amp;sort=name&amp;order=desc">File</a></div>
        <div id="headersize"><a href="/stofresh/admin/easypopulate.php?dir=&amp;sort=size&amp;order=asc">Size</a></div>
        <div id="headermodified"><a href="/stofresh/admin/easypopulate.php?dir=&amp;sort=date&amp;order=asc">Last Modified</a></div>
        </div>
        <div id="listing">
         
            <div>
                <input type="submit" value="Import" onclick="this.form.localfile.value='Full-EP2009Jul17-1806.csv';" style="float:left; width:50px;">
                <a href="../tempEP/Full-EP2009Jul17-1806.csv" class="b" >
                    <img src="../tempEP/dlf/unknown.png" alt="Full-EP2009Jul17-1806.csv" />
                    <strong>Full-EP2009Jul17-1806.csv</strong> <em>2KB</em>
                    Jul&nbsp;17&nbsp;2009&nbsp;10:41:33&nbsp;PM             </a>
            </div>
             
            <div>
                <input type="submit" value="Import" onclick="this.form.localfile.value='note.txt';" style="float:left; width:50px;">
                <a href="../tempEP/note.txt" class="w" >
                    <img src="../tempEP/dlf/text.png" alt="note.txt" />
                    <strong>note.txt</strong> <em>0KB</em>
                    Jan&nbsp;08&nbsp;2009&nbsp;01:05:54&nbsp;PM             </a>
            </div>
            </div>
 
        </div>
    </div>
    </form>
<!-- div id="copy">Directory Listing Script &copy;2008 Evoluted, <a href="http://www.evoluted.net/">Web Design Sheffield</a>.</div -->
 
                        </td>
                    </tr>
                </table>
    
            </td>
<!-- body_text_eof //-->
        </tr>
    </table>
<!-- body_eof //-->
    <br />
<!-- footer //-->
<table border="0" width="100%" cellspacing="10" cellpadding="10">
  <tr>
    <td align="center" class="smallText" height="100" valign="bottom"><a href="http://www.zen-cart.com" target="_blank"><img src="images/small_zen_logo.gif" alt="Zen Cart:: the art of e-commerce" border="0"></a><br /><br />E-Commerce Engine Copyright &copy; 2003-2009 <a href="http://www.zen-cart.com" target="_blank">Zen Cart&trade;</a><br /><a href="http://localhost/stofresh/admin/server_info.php">Zen Cart v1.3.8a/v1.3.8</a></td>
  </tr>
</table>
<!-- footer_eof //-->
</body>
</html>

There is no name on the form so I cannot do it like the login page. Here is the code I am trying:

#include <IE.au3>

$URL = "http://localhost/stofresh/admin/index.php"

$oIE = _IECreate ($URL)
$oForm = _IEFormGetObjByName ($oIE, "login")
$oQuery = _IEFormElementGetObjByName ($oForm, "admin_name")
_IEFormElementSetValue ($oQuery, "USERNAME")
$oQuery = _IEFormElementGetObjByName ($oForm, "admin_pass")
_IEFormElementSetValue ($oQuery, "PASSWORD")
;_IEFormSubmit ($oForm)
Send("{ENTER}")

_IELoadWait ($oIE, 5000)

_IENavigate ($oIE, "http://localhost/stofresh/admin/easypopulate.php")

$oForm = _IEFormGetCollection ($oIE, 2) ;Tried many numbers, none work.
$oQuery = _IEFormElementGetObjByName ($oForm, "localfile")
_IEFormElementSetValue ($oQuery, "Full-EP2009Jul17-1806.csv") ;Nothing happens here. Any suggestions???

I am sure this is something simple but I have been stuck on it all day. Any and all help is GREATLY appreciated! Thanks!

Edited by toothpick
Link to comment
Share on other sites

Nevermind... I figured it out. It works with the bottom part like this:

$oForm = _IEFormGetCollection ($oIE, 1)
$oQuery = _IEFormElementGetObjByName ($oForm, "localfile")
_IEAction ($oQuery,"focus")
_IELoadWait ($oIE, 10000)
Send($lFile & "{ENTER}")
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...