Help with Submenu Button


#1

I am trying to automate some tedious tasks. This lead me to trying both Kantu and imacros. Kantu is far superior however some of the tutorials are a bit…advanced.

I have been able to login to systems and troubleshoot my way to the proper page. Then I click a button (id=reportbutt). Easy. Then it opens a dialog box (in browser not windows) and asks me “OK” or "cancel. I need to hit “OK” which will start a download. I have enabled automatic downloads so it will download the file I need. When I hit “record” to record macro and click on “OK” it registers a click, but no target or value. When I inspect the element I get this.

The dialogue box itself has this element:
<form id="frm" action="#" onsubmit="return generateReport()">

<div>

Please choose the device type for the inventory report:<br>

<select id="reportDevice" style="width: 200px">

<option value="1">All</option>

<option value="2">HCM</option>

<option value="3">ACM</option>

<option value="4">RIM</option>

<option value="5">OIM</option>

<option value="6">RAU</option>

<option value="7">RXU</option>

</select>

<br>

<br>

<br>

</div>

<img src="…/sitePics/H-separated-line.png" class="ma-smallDailog-img">

<input class="ma-button ma-smallDailog-submit" type="submit" value="OK">

<input class=“ma-button” type=“button” value=“Cancel” onclick="$(’#reportDialog’).dialog(‘close’);">

</form>

So my question is what can I type into Kantu? There is no id for the button in question itself, and I dont get the syntax of the example. Any help would be greatly appreciated, I am a noob at this stuff and gaining good basic tutorials has been difficult.

Command: click
Target:???
Value:???


#2

So i’m not exactly sure if you’re talking about a dropdown here and that’s what all those option values represent, but typically if you can’t find a unique ID it’s best to use xpath. So click on the button and hit inspect and then right click on the html and click copy, then choose xpath. And that Xpath would then go into the target


#3

Ok, that makes sense, the tutorials never specify what the //* sort of syntax was xpath. They never mentioned. So far that seems to be working. Thank you so much. I will post in about 20 min to let ya know if it worked.


#4

So xpath worked on one dialog box, then i go to another page on the web site and an almost exaclty the same dialog box opens. Tried to use the xpath of the button same as the other and it didn’t work.

//*[@id=“getAlarmsDailog”]/form/input[1]

//*[@id=“frm”]/input[1]

The top xpath worked and the file downloaded. The bottom one completes the macro without downloading the file or hanging at all. two different files to be downloaded out the the same system from almost identical dialog boxes.


#5

Hmmm okay. Often times it helps if you’re able to post the site and let people dig around, but obviously that can’t always be done if there’s sensitive information. There’s this small section on their site about file downloads, not sure if using the ondownload command and then telling it to wait for the download to complete before it finishes the macro would do anything?

Automating File Download

If you all need is a simple download, there is nothing special to do. If a click command triggers a download, Kantu handles it automatically. By default, Kantu does not stop and wait for the download to complete, the macro continues with the next command(s).

OnDownload | new file name | (wait for download to complete:) true/false

For more control over the download there is the OnDownload command. It allows you to overwrite the default file name with a custom name. And with “true” in the 3rd column you tell Kantu to wait for a download to complete before continuing with the next command. Kantu waits for max. timeout_download seconds. This option is great for checking the performance (download speed) of a file download. If you need to measure the exact download time, you can do that with the value of the !RUNTIME internal variable. The max. wait time between a mouse click on the link and the actual download start is limited by timeout_wait. OnDownload can be at any place in the macro as long as it is reached before the download is triggered.


#6

2 min I will give ya screenshots.


#7

So the top two are of the submenu that are not working. The bottom one is a picture of the one that worked like a charm. As you can see the menus are identical. Clicking on the xpath of the third picture generated the file. Clicking on the xpath of the first two pictures DOES NOT generate a file like it should. clicking OK SHOULD generate a download which auto downloads. So one works perfectly and the other doesnt, for no reason I can discern. Ideas?


#8

Hmmm, i noticed in the one that works it’s an input box where you’ve given it a specific csv value, while the two that don’t work are a drop down with “all” selected. I wonder if it’s something to do with the drop down.

What if you try downloading a different option from the list? So do a click event on the drop down bar and then do a select event on it with “label=HCM” (minus the quotes) in the value field.