1

I am using Sahi to record my actions in IE8. My page contains this markup:

<td id="ButtonText" class="myClass">
    <font title="unique title" onclick="CallThis()">ButtonText</font>
</td>

When I click the button defined above, Sahi records:

_click(_cell("Button Text"));

But when I play this back, the button is not clicked. However,

_assertExists(_cell("Button Text"));

returns true.

I have added the following line into the concat.js file to try to make it detect font nodes:

this.addAD({tag: "FONT", type: "null", event:"click", name: "_font", attributes: ["sahiText", "title|alt", "id", "index", "href", "className"], action: "_click", value: "sahiText"});

but this doesn't seem to have had any effect (I have restarted Sahi). I don't have any control over the page being tested and I am not sure whether the td node or the font node is being selected.

How do I fire the onclick event of the font node?

EDIT: I have added _font to sahi/config/normal_functions.txt

Manually tweaking the page using IE tools to have the onclick even on the td results in the same steps being recorded, but it will now play it back.

<td id="ButtonText" class="myClass" onclick="CallThis()">
    <font title="unique title">ButtonText</font>
</td>

Unfortunately I am unable to make any changes to the page and I still need to playback the onclick event which exists on the font node.

Both

_font("ButtonText");
_font("unique title");

give

[Exception] [object Error]

infojolt
  • 5,244
  • 3
  • 40
  • 82

2 Answers2

1

The solution to the problem was to remove the quotes around "null":

this.addAD({tag: "FONT", type: null, event:"click", name: "_font", attributes: ["sahiText", "title|alt", "id", "index", "href", "className"], action: "_click", value: "sahiText"});
infojolt
  • 5,244
  • 3
  • 40
  • 82
0

Add _font to sahi/config/normal_functions.txt, restart Sahi and check.

Regards, Narayan

Narayan Raman
  • 891
  • 6
  • 9
  • Thanks Narayan - I really appreciate the expert advice :) Unfortunately I am still unable to get this to work. I have the 'this.addAD...' line in my question and have added _font to the other file as your recommended. Should I be able to get a handle on the tag as _font("Button Text")? I just get [Exception] [object Error] when I try anything using the _font prefix. – infojolt Sep 06 '12 at 10:40
  • I have posted the solution to the problem as a separate answer. However, this answer did partially help me so I am going to assign the bounty to Narayan. – infojolt Sep 10 '12 at 10:46