18 January 2026:


This forum is now archived and is in read-only mode. Please continue discussions on our improved new Sahi Pro Community forum.



Sahi Pro is an enterprise grade test automation platform which can automate web, mobile, API, windows and java based applications and SAP.

using title property to find an element

mg26mg26 Members
edited May 2012 in Sahi - Open Source
Dear All,
i have a table with columns (name,age).There is an edit button in the last cell for each row(so total 3 cols).I need to click the "edit" button against a name , unfortunately since the name is too long , A wrapped name is displayed , but a tool tip will be displayed with full name.

My task is to use this "title" to correctly click the edit button.I wrote a statement like

_imageSubmitButton("Edit",_near(_span({title:"My Name 123 abc"})));


i got a result as
[Exception] TypeError: Object doesn't support this property or method



i edited concat.js as


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


since the html is like


<td align="left">
<span id="MY Name_111_222_45341212_xyz_ddffggffdfdf_2323232323" title="My Name 123 abc">This is my ong titl...</span>
</td>


next i tried


_imageSubmitButton("Edit",_near(_span("My Name 123 abc")));



i get a result as
[Exception] TypeError: 'parentNode' is null or not an object


how to proceed..

regards
mg

Comments

  • globalwormingglobalworming Moderators
    Hi

    when the title is too long, try regular expressions like _span("/My Name 123 abc/")

    Regards
    Wormi
  • mg26mg26 Members
    Dear Wormi,
    using regular expression is a possibility.....But the pattern of data populated in name field is very complex...More over if i use regular expression there will be more names that matches my regular expression...Is there a way to use tooltip/title data.

    My issue is i can easily get te tool tip from the web page...the actual name is displayed in the tool tip (and this data never changes)..., if the data in the table is sorted then using id for getting values from cell becomes unreliable.

    regards
    mg
  • globalwormingglobalworming Moderators
    Wel.. I don't know how to access by title but you could use the _collect() API and loop through element[$index].title until you match MY Name_.....

    Would this help?
Sign In or Register to comment.