18 January 2026:
Sahi Pro is an enterprise grade test automation platform which can automate web, mobile, API, windows and java based applications and SAP.
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.
Need help to resolve SAHI-SmartGWT problems
Hi,
We have a SmartGWT based Client for which I'm trying SAHI to automate its testing.
Currently I'm facing many issues where SAHI controller is unable to detect GUI portions.
OS Name: MS XP Professional Version 2002 SP 3
Browser Name & Version: Firefox 12.0
Sahi Build: Sahi Open Source ( sahi-v35 2011-07-19 )
I would require your help to resolve them. I've listed 4 problems and would like you to analyze them & if possible help me to resolve them.
I've provided html code (as seen by firebug) for portions which SAHI is not able to detect.
Let me know if you require anything else.
1. Checkbox Problem: SAHI is not able to detect any checkboxes of our SmartGWT Client
Below is the code example of one such checkbox as captured by firebug.
2. Dynamic DOM IDs Problem:
This problem needs some explanation.
There are some portions (radio button, images, divs) in our Client which is being recognized by SAHI controller by certain name.
For eg: We have a radio button in our client. We record it using SAHI controller (in java mode) & it gives us below code
Now when we logout from our client & re-login & browse to same radio button, this time SAHI controller recognizes it with different ID....let say
This might be happening this way due to the fact that our SmartGWT Client does not have any Static IDs for that particular radio button, hence the Client probably generates random dynamic IDs.
One way of dealing with this problem is to contact our DEV team & ask them to use Static IDs (which does not change upon re-logins/close) for such GUI portions so that SAHI always recognizes them with unique ID.
Other way is that if SAHI has any mechanism to handle these dynamic kind of scenario automatically? Can SAHI handle such things?
3. Drop Down Problem
We have a drop down portion with below HTML code as seen by firebug:
Now, the drop down shows "All Directories" initially and our goal is to click this drop down and choose below option from this drop down (in this case its "personal").
When we record this portion using SAHI controller, it sees it as
So, I formulated below script where it clicks initial DIV & tries to choose another option...But when we run below code, it throws an exception:
EXCEPTION
=========
Kindly NOTE: We get similar exception & problem is observed for all drop down portions in our application.
4. GUI which loads upon Clicking
We have a GUI which is recognized by SAHI controller (in java mode) as
HTML code for this portion as seen by firebug is
Now when we click this portion, new GUI portion gets added under it at runtime. Its html code is very big, thus not highlighting it here.
The problem is that SAHI controller does not record any thing for this newly added GUI portion. Hence we are not able to test its functionality.
Regards,
Nitesh
We have a SmartGWT based Client for which I'm trying SAHI to automate its testing.
Currently I'm facing many issues where SAHI controller is unable to detect GUI portions.
OS Name: MS XP Professional Version 2002 SP 3
Browser Name & Version: Firefox 12.0
Sahi Build: Sahi Open Source ( sahi-v35 2011-07-19 )
I would require your help to resolve them. I've listed 4 problems and would like you to analyze them & if possible help me to resolve them.
I've provided html code (as seen by firebug) for portions which SAHI is not able to detect.
Let me know if you require anything else.
1. Checkbox Problem: SAHI is not able to detect any checkboxes of our SmartGWT Client
Below is the code example of one such checkbox as captured by firebug.
<div tabindex="2612" style="min-width:1px;white-space:nowrap;" class="labelAnchor" $9a="$9d" $89="isc_CheckboxItem_13" id="isc_EH"><img width="13" height="13" border="0" align="TEXTTOP" suppress="TRUE" style="vertical-align:middle;margin-left:4px;margin-right:3px;" eventpart="valueicon" id="isc_EI" src="http://172.16.25.52/callcenter/callcenter/sc/skins/BroadWorks/images/DynamicForm/checked.png">Synchronize language with service profile</div>
2. Dynamic DOM IDs Problem:
This problem needs some explanation.
There are some portions (radio button, images, divs) in our Client which is being recognized by SAHI controller by certain name.
For eg: We have a radio button in our client. We record it using SAHI controller (in java mode) & it gives us below code
browser.radio("isc_I8").click();
Now when we logout from our client & re-login & browse to same radio button, this time SAHI controller recognizes it with different ID....let say
browser.radio("isc_K1").click();
This might be happening this way due to the fact that our SmartGWT Client does not have any Static IDs for that particular radio button, hence the Client probably generates random dynamic IDs.
One way of dealing with this problem is to contact our DEV team & ask them to use Static IDs (which does not change upon re-logins/close) for such GUI portions so that SAHI always recognizes them with unique ID.
Other way is that if SAHI has any mechanism to handle these dynamic kind of scenario automatically? Can SAHI handle such things?
3. Drop Down Problem
We have a drop down portion with below HTML code as seen by firebug:
<td align="left" $89="isc_SelectItem_3" id="isc_BO" style="" class="formCell"><table cellspacing="0" cellpadding="0" class="selectItemControl" style="cursor:default;width:96px;" $9a="$9f" $89="isc_SelectItem_3" id="isc_BP" role="presentation"><tbody><tr><td style="margin:0px;border:0px;padding:0px;background-image:none;background-color:transparent;"><div tabindex="2496" style="width:73px;height:16px;overflow:hidden;white-space:nowrap;" class="selectItemText" $9a="$9d" $89="isc_SelectItem_3" id="isc_BQ">All Directories</div></td><td style="" class="selectItemPickerIcon" id="isc_BR"><a handlenativeevents="false" $9a="picker" $89="isc_SelectItem_3" tabindex="-1" style="margin-left:0px;-moz-user-focus:ignore;" id="isc_BS" role="button" href="#"><img width="18" height="22" border="0" align="TEXTTOP" suppress="TRUE" style=";margin-top:0px;margin-bottom:0px;" id="isc_BT" src="http://172.16.25.52/callcenter/callcenter/sc/skins/BroadWorks/images/pickers/comboBoxPicker.png"></a></td></tr></tbody></table></td>
Now, the drop down shows "All Directories" initially and our goal is to click this drop down and choose below option from this drop down (in this case its "personal").
When we record this portion using SAHI controller, it sees it as
browser.div("All Directories")
So, I formulated below script where it clicks initial DIV & tries to choose another option...But when we run below code, it throws an exception:
browser.cell("SEARCH").click();
browser.div("All Directories").click();
browser.div("Personal[1]").click(); ==> This is inside Drop down, what we are trying to choose
EXCEPTION
=========
Exception in thread "main" error:_click(_div("All Directories"))
Error: The parameter passed to _click was not found on the browser
at net.sf.sahi.client.Browser.executeStep(Browser.java:205)
at net.sf.sahi.client.Browser.execute(Browser.java:172)
at net.sf.sahi.client.Browser.click(Browser.java:308)
at net.sf.sahi.client.ElementStub.click(ElementStub.java:66)
at SahiDriverDemo.main(SahiDriverDemo.java:59)
Kindly NOTE: We get similar exception & problem is observed for all drop down portions in our application.
4. GUI which loads upon Clicking
We have a GUI which is recognized by SAHI controller (in java mode) as
browser.cell("DIRECTORIES").click();
HTML code for this portion as seen by firebug is
<div onscroll="return isc_SectionHeader_25.$lh()" style="position: absolute; left: 0px; top: 224px; width: 435px; height: 28px; z-index: 202448; -moz-box-sizing: border-box; overflow: hidden; cursor: pointer;" role="heading" eventproxy="isc_SectionHeader_25" id="isc_9C"><div style="POSITION:relative;VISIBILITY:inherit;Z-INDEX:202448;CURSOR:pointer;" eventproxy="isc_SectionHeader_25" id="isc_9B"><table width="100%" height="100%" cellspacing="0" cellpadding="0" style="table-layout:fixed;overflow:hidden;"><tbody><tr><td valign="center" nowrap="true" align="left" style="padding-top:0px;padding-bottom:0px;" class="sectionHeaderopened"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="margin:0px;border:0px;padding:0px;background-image:none;background-color:transparent;font-size:1px;padding-right:6px" class="sectionHeaderclosed"><img width="11" height="7" border="0" align="absmiddle" suppress="TRUE" eventpart="icon" style="vertical-align:middle" name="isc_9Bisc_SectionHeader_25$4u" src="http://172.16.25.52/callcenter/callcenter/sc/skins/BroadWorks/images/SectionHeader/green_opener_opened.png"></td><td nowrap="true" style="margin:0px;border:0px;padding:0px;background-image:none;background-color:transparent;" class="sectionHeaderopened">DIRECTORIES</td></tr></tbody></table></td></tr></tbody></table><div onscroll="return isc_SectionHeader_25_controlsLayout.$lh()" style="position: absolute; left: 259px; top: 0px; width: 176px; height: 28px; z-index: 202466; padding: 0px; -moz-box-sizing: border-box; overflow: hidden; cursor: default;" class="normal" eventproxy="isc_SectionHeader_25_controlsLayout" id="isc_9D"><div style="POSITION:relative;VISIBILITY:inherit;Z-INDEX:202466;CURSOR:default;" eventproxy="isc_SectionHeader_25_controlsLayout" id="isc_9E"> <div onscroll="return isc_DynamicForm_11.$lh()" style="position: absolute; left: 0px; top: 3px; width: 150px; height: 22px; z-index: 202484; border: 0px none; -moz-box-sizing: border-box; overflow: hidden;" class="normal" eventproxy="isc_DynamicForm_11" id="isc_9F"><div style="POSITION:relative;VISIBILITY:inherit;Z-INDEX:202484;CURSOR:default;" eventproxy="isc_DynamicForm_11" id="isc_9G"><form style="margin-bottom:0px;" onreset="isc_DynamicForm_11.resetValues(); return false;" onsubmit="return isc_DynamicForm_11.$10d()" enctype="application/x-www-form-urlencoded" action="#" method="POST" id="isc_9H"><table width="1" cellspacing="0" cellpadding="0" border="0" id="isc_9I" role="presentation"><tbody></tbody><colgroup><col width="20"></colgroup><tbody><tr><td class="" style="margin:0px;border:0px;padding:0px;background-image:none;background-color:transparent;height:0px;overflow:hidden;padding:0px;"></td></tr><tr><td align="left" $89="isc_SelectItem_5" id="isc_9J" style="" class="formCell"><table cellspacing="0" cellpadding="0" class="selectItemControl" style="cursor:default;width:150px;" $9a="$9f" $89="isc_SelectItem_5" id="isc_9K" role="presentation"><tbody><tr><td style="margin:0px;border:0px;padding:0px;background-image:none;background-color:transparent;"><div tabindex="2035" style="width:127px;height:16px;overflow:hidden;white-space:nowrap;" class="selectItemText" $9a="$9d" $89="isc_SelectItem_5" id="isc_9L">Enterprise</div></td><td style="" class="selectItemPickerIcon" id="isc_9M"><a handlenativeevents="false" $9a="picker" $89="isc_SelectItem_5" tabindex="-1" style="margin-left:0px;-moz-user-focus:ignore;" id="isc_9N" role="button" href="#"><img width="18" height="22" border="0" align="TEXTTOP" suppress="TRUE" style=";margin-top:0px;margin-bottom:0px;" id="isc_9O" src="http://172.16.25.52/callcenter/callcenter/sc/skins/BroadWorks/images/pickers/comboBoxPicker.png"></a></td></tr></tbody></table></td></tr></tbody></table></form></div></div><div onscroll="return isc_ImgButton_18.$lh()" style="position: absolute; left: 155px; top: 6px; width: 16px; height: 16px; z-index: 202502; -moz-box-sizing: border-box; overflow: hidden;" onblur="if(window.isc)isc.EH.blurFocusCanvas(isc_ImgButton_18,true);" onfocus="if(event.target!=this)return;isc.EH.focusInCanvas(isc_ImgButton_18,true);" class="imgButtonDisabled" role="button" eventproxy="isc_ImgButton_18" id="isc_9Q"><div style="POSITION:relative;VISIBILITY:inherit;Z-INDEX:202502;CURSOR:default;" eventproxy="isc_ImgButton_18" id="isc_9P"><img width="16" height="16" border="0" align="TEXTTOP" suppress="TRUE" name="isc_9Pmain" src="http://172.16.25.52/callcenter/images/bw_FeatureClose_16_Disabled.png"></div></div></div></div></div></div>
Now when we click this portion, new GUI portion gets added under it at runtime. Its html code is very big, thus not highlighting it here.
The problem is that SAHI controller does not record any thing for this newly added GUI portion. Hence we are not able to test its functionality.
Regards,
Nitesh
Comments
2) When you have element("ics_I8") and element("ics_KI") you can use regular expressions like element("/ics/") to handle these dynamic ids. Just look which part won't change. Alternatively, use _in, _under and _near in relation to a static object to access your changing element
I will also try _in, _under for it.
Any suggestions for other problems?
In this case SmartGWT uses the isc_.* pattern for most IDs. We need to tell Sahi to ignore those ids, and then use something else to identify the elements. Use of visible text, _in, _near and _under (and _leftOf, _rightOf from Sahi Pro V4.2) are recommended.
To ignore isc_.* open sahi/userdata/config/userdata.properties and add
Nitesh, I would also advise you to first use the Sahi script version and see if things work for you and then work on the java version of it. The Sahi script version is easier to use, and the Controller is more powerful.
Regards,
Narayan
We are also using SmartGWT in our app (h t t p : / / w w w . jboss.org/rhq ) SAHI is working good for us.
JAVA DOC: h t t p://sahi.co.in/java/javadocs/
The following may resolve your issues.
# 1. Checkbox Problem: SAHI is not able to detect any checkboxes of our SmartGWT Client
---
for radio box, browser.radio("RadioButtonName").check();
for check box, browser.checkbox("checkBoxName").check();
# 2. Dynamic DOM IDs Problem:
---
Yes, It's dynamic and do not use ID as a reference.
Just launch you app on sahi proxy, then launch Sahi Controller, Press CTRL+place the mouse pointer on the element that you want to control. Release the CTRL key. Now you can see 'Alternatives' on your Sahi Controller, something with your radio button name. You can use this name and you can select.
#3. Drop Down Problem
---
You may select like,
browser.xy(browser.div("All Directories"), 3, 3).click();
browser.xy(browser.row("Personal"), 3, 3).click();
You might have more than one objects on the same name, if you have so, pass it like "Personal[1]"