1

I'm automation a login to a web page and then exporting data by clicking in a exporting button in the web page.

The problem is that when I call the button:

ie.document.getelementsbytagname("DTTT btn-group").click

I get an error message telling that the method don't apply to the object.

The web code when I select the button is:

    <div class="DTTT btn-group">
    <a class="btn xls_icon_class downLoadIcon_dataTable"

id="ToolTables_documentos_0" data-original-title="">
    <span></span>
    <div style="left: 0px; top: 0px; width: 16px; height: 16px; position: 

absolute; z-index: 99;">
    <embed name="ZeroClipboard_TableToolsMovie_1" width="16" height="16" 

align="middle" id="ZeroClipboard_TableToolsMovie_1" pluginspage="http://www.macromedia.com/go/getflashplayer" 

src="/factemipf_static/swf/copy_csv_xls_pdf.swf" type="application/x-

shockwave-flash" wmode="transparent" flashvars="id=1&amp;width=16&

amp;height=16" allowfullscreen="false" allowscriptaccess="always" 

bgcolor="#ffffff" quality="best" menu="false" loop="false"></div></a></div>"

Help will be appreciated.

Zev Spitz
  • 13,950
  • 6
  • 64
  • 136
Rui Mota
  • 11
  • 3

2 Answers2

1

Chances are you need to click the <a>.

ie.document.getElementById("ToolTables_documentos_0").click

But more information, like event listeners, is required to know for sure.

dePatinkin
  • 2,239
  • 1
  • 16
  • 15
  • I've tried it too, but it won't work . Where can i find that event listeners information? – Rui Mota May 06 '15 at 11:06
  • You can inspect the elements with Developer Tools in the browser. It's not full proof but it's helpful. In Chrome when you inspect an element you have Event Listeners on the right. – dePatinkin May 06 '15 at 11:45
  • I cannot inspect the element in internet explorer because that option won't apear, only some version flash details. What does it mean? – Rui Mota May 06 '15 at 13:13
1

There is no URL and perhaps more HTML is required.

Your initial error is because you are trying to use the method of a single element on a collection.

This, ie.document.getElementsByTagName("DTTT btn-group"), returns a collection.

You would use an index to specify which element to click on:

ie.document.getElementsByTagName("DTTT btn-group")(0).Click
QHarr
  • 83,427
  • 12
  • 54
  • 101