Clicking a button when in a Table on a website

Hints, tips and tricks for newbies

Moderators: Dorian (MJT support), JRL

Post Reply
davsap
Newbie
Posts: 2
Joined: Mon Jun 30, 2014 8:52 pm

Clicking a button when in a Table on a website

Post by davsap » Tue Jul 01, 2014 12:24 am

Hello

I am testing macro Scheduler out, I am only on the trial version and love what it has to offer and am a novice with HTML.

I was able to navigate through a website i'm working with but when it comes to what appears to be a table on the site I cant get anything to work, I've tried the following:

Key Commands - never signals I've focused on the page. Tried; WaitWindowOpen, Wait, Enter, tabs. in all different variations. Web Recorder Wizard
Mouse Commands
Image recognition

If any one could supply me with any advise or tutorials on what might work that would be much appreciated.

Thank you for you Help.

Dave

Below is the HTML from the site for reference.

Also the Web Recorder Wizard mentioned the following.

"The Wizard is unable to know whether the attribute chosen is unique to this tag for its tag type. If you choose an attribute that is not unique then for actions (click, focus, set value) Macro Scheduler will stop at the first match found which may not be this tag. If retrieving values and more than one match exists you will get an array of values returned."

"If the elements has no attributes this wizard will not help you and you'll need to resort to getting an array of all tags for the given tag type and looping through and identifying some other way (such as RegEx)."


<tr>
<td colspan="2">
<table id="EnglishTB" width="100%" border="1" bordercolor="#FFFFFF" cellpadding="0" cellspacing="0">
<tbody>
<tr height="33">
<td align="center" valign="middle" bordercolor="#000066" nowrap="" bgcolor="#FFFFFF" onmouseout="if(this.style) this.style.backgroundColor='#FFFFFF';" onmouseover="if (this.style) this.style.backgroundColor='#CCCC99'" onclick="window.location ='Default.aspx?authkey=e99813c7-ac35-4641-8f6c-d53bb10a2717&tab=ps'" style="background-color: rgb(255, 255, 255);">
<nobr>
<a href="Default.aspx?authkey=e99813c7-ac35-4641-8f6c-d53bb10a2717&tab=ps">
<b>
<font id="EnglishFont" style="font-size: 10pt" face="Arial, Helvetica, sans-serif" class="noUL" color="#000066">Property Reports</font>
</b>
</a>
</nobr>
</td>
</tr>
</tbody>
</table>
</td>
</tr>

User avatar
Marcus Tettmar
Site Admin
Posts: 7395
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Re: Clicking a button when in a Table on a website

Post by Marcus Tettmar » Wed Jul 02, 2014 11:30 am

Looking at the code:

Code: Select all

<td align="center" valign="middle" bordercolor="#000066" nowrap="" bgcolor="#FFFFFF" onmouseout="if(this.style) this.style.backgroundColor='#FFFFFF';" onmouseover="if (this.style) this.style.backgroundColor='#CCCC99'" onclick="window.location ='Default.aspx?authkey=e99813c7-ac35-4641-8f6c-d53bb10a2717&tab=ps'" style="background-color: rgb(255, 255, 255);">
<nobr>
<a href="Default.aspx?authkey=e99813c7-ac35-4641-8f6c-d53bb10a2717&tab=ps">
There's an OnClick handler on the TD element. But within that there's also a simple A element (anchor). The onclick of the TD simply navigates to the same href as the anchor.

The A has no identifier other than the href itself. The TD has some other attributes but I'm guessing they are not unique.

But why don't we just perform the navigate ourselves. That's all the click does - perform a navigate.

Code: Select all

IENavigate>IE_Instance,http://www.domain.com/Default.aspx?authkey=e99813c7-ac35-4641-8f6c-d53bb10a2717&tab=ps,ie_res
I've made up the domain part. You can change it to suit.

Now, for this to work I'm assuming that href is always the same.

If that authKey is dynamic - that is you don't know what it is when you visit the page, then we could extract the html using one of the tag extraction funtions, parse it with RegEx to pull out the href part and then we can perform our navigate.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

davsap
Newbie
Posts: 2
Joined: Mon Jun 30, 2014 8:52 pm

Re: Clicking a button when in a Table on a website

Post by davsap » Thu Jul 03, 2014 11:48 pm

Thanks Marcus

Will give it a go!

Dave

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts