Sahi Pro is an enterprise grade test automation platform which can automate web, mobile, windows and java based applications. Get your 30 day free trial.

Discuss your Sahi Pro usage patterns, best practices, problems and solutions. Help others solve their problems and seek help from the community when needed. If you need specific support on your application, please email support @ sahipro.com

Identifying image buttons uniquely

ssikdarssikdar Members
edited November -1 in Sahi - Open Source
Hi,

Our application has been built using GWT and one of the problems we are hitting with GUi automation is the lack of ids or dynamaic id generations for GUI objects.

I am not able to clearly understand how I can identify certain image icons on a Tools table and then click on them using SAHI APIs. Can some one give me a suggestion?


Sahi Pro-v 4.2

OS- Windows

IE-9

Use case:- I want to be able to click on Landmark Manager or any of the image icons.

Here is the HTML table details


<TR>
<TD>
<DIV class="wtw-ToolbarButton wtw-ToolbarButton-up" title="Zoom in" role=button tabIndex=0 aria-pressed=false __eventBits="7165" __uiObjectID="0"><IMG style="WIDTH: 28px; BACKGROUND: url(cache.png) no-repeat -140px 0px; HEIGHT: 28px" class=gwt-Image border=0 src="clear.cache.gif"></DIV></TD>
<TD>
<DIV class="wtw-ToolbarButton wtw-ToolbarButton-up" title="Zoom out" role=button tabIndex=0 aria-pressed=false __eventBits="7165" __uiObjectID="1"><IMG style="WIDTH: 28px; BACKGROUND: url(cache.png) no-repeat -56px 0px; HEIGHT: 28px" class=gwt-Image border=0 src="/clear.cache.gif"></DIV></TD></TR>
<TR>
<TD>
<DIV class="wtw-ToolbarButton wtw-ToolbarButton-up" title=Refresh role=button tabIndex=0 aria-pressed=false __eventBits="7165" __uiObjectID="2"><IMG style="WIDTH: 28px; BACKGROUND: url(cache.png) no-repeat -392px 0px; HEIGHT: 28px" class=gwt-Image border=0 src="/clear.cache.gif"></DIV></TD>
<TD>
<DIV class="wtw-ToolbarButton wtw-ToolbarButton-up" title="Poll vehicle" role=button tabIndex=0 aria-pressed=false __eventBits="7165" __uiObjectID="3"><IMG style="WIDTH: 28px; BACKGROUND: url(cache.png) no-repeat -476px 0px; HEIGHT: 28px" class=gwt-Image border=0 src="/clear.cache.gif"></DIV></TD></TR>
<TR>
<TD>
<DIV class="wtw-ToolbarButton wtw-ToolbarButton-up" title="Landmark Manager" role=button tabIndex=0 aria-pressed=false __eventBits="7165" __uiObjectID="4"><IMG style="WIDTH: 28px; BACKGROUND: url(cache.png) no-repeat -644px 0px; HEIGHT: 28px" class=gwt-Image border=0 src="/clear.cache.gif"></DIV></TD>
<TD>
<DIV class="wtw-ToolbarButton wtw-ToolbarButton-up" title="Find nearest vehicle" role=button tabIndex=0 aria-pressed=false __eventBits="7165" __uiObjectID="5"><IMG style="WIDTH: 28px; BACKGROUND: url(cache.png) no-repeat -952px 0px; HEIGHT: 28px" class=gwt-Image border=0 src="/clear.cache.gif"></DIV></TD></TR>
<TR>


problem- all the images are identified by the same source file and the same class. when i use the Sahi controller, it identifies the images as clear.cache[x].gif where x is an array position for this table. It is likely, that this array value will keep changing in builds.


Can I identify the image icons and click on them using the sahi postional APIs? Can Sahi identify image icons by Title? because Title will be pretty stable over builds.

Comments

  • narayannarayan Administrators
    Hi SSikdar,

    Try with:

    _image("clear.cache.gif", _in(_div({title:"Poll vehicle"})))

    Regards,
    Narayan
  • Thanks Narayan, this worked. I will use this methodology for identifying rest of the gui elements as well.

    -Sohini
Sign In or Register to comment.