0

I want to click on a link "Reports" after logging in to a website through Macro. The source code is defined as :

<script language="Javascript" type="text/javascript">
var swmenubg1 = "menudefbg";
var swmenubg2 = "remenusectiondefault";
var swtabmenutype = "onClick";
var swtabmenu = []; var swtabmenucolspan = '9'; var swtabselmenu = '1'; var             swtabselmenuclass = '1';
swtabmenu = [['1', '80', '1', 'Home'],['2', '100', '2', 'Tickets'],['3', '120', '3',  'Live Support'],['4', '140', '4', 'Knowledgebase'],['6', '140', '1', 'Troubleshooter'],['8', '90', '2', 'Users'],['9', '90', '3', 'Reports'],];
buildTopTabMenu();
</script>

HTML code:

div class="remenusectiondefault" id="tb_menusection9" onclick="javascript:switchTab(9,      3);" alt="Reports"
div class="menutext"
Text - Reports

I have tried: IE.document.getElementById("tb_menusection9").Click

But I get an error: Object required. Please tell me where am I going wrong.

Niet the Dark Absol
  • 320,036
  • 81
  • 464
  • 592

1 Answers1

0

If you use jquery, the selector for what you need is $("#tb_menusection9"), leading you to $("#tb_menusection9").click() (with uncapitalized "c").

If you use vanilla, you can take a look here to learn how to implement that: Vanilla JavaScript version of jQuery .click

As a side note, if things are thought through right, you should never need to simulate clicks. On the required events, you should be able to directly call the functions defined on that click event.

Community
  • 1
  • 1
zozo
  • 8,230
  • 19
  • 79
  • 134