# Solutions to common Test Designer IDE Challenges

Most of the times click and record can solve your testing needs. But also it is not rare that due to the “scripting” oriented description of the use cases to implement, the tester is faced with the challenge to approach the automation from a scripting angle.

This document provides some examples of scenarios where a little coding like steps are needed to speed up some automation requirements implementation using IDE.

If you are facing AI automation challenges please take a look at [Useful smartags workbench custom actions and other js examples.  
  
**Solutions to Common Test Designer IDE Challenges**](https://docs.appvance.net/Content/AIQ/General_KB_Articles/Useful_smartags_workbench_custom_actions_and_other_js_examples.htm)

#### Numbers: convert parts of a string value to a floating number

<div id="bkmrk-%2F%2F-suppose-you-have-" style="border-width:1px;"><div>```
// Suppose you have a span with the value $19.99 but you need validate the number is greated than 15.
Store                |  $stringValue    |  getText(span("carttotal"))     // "$19.99"Store                |  $floatingValue  |  parseFloat($stringValue.substring(1))   // removes the $ then convertes "19.99" to a floating number 
Assert Greater Than  |  $floatingValue  |  15
```

 </div> </div>#### Numbers: convert a string value to an integer number

<div id="bkmrk-%2F%2F-when-needing-to-p" style="border-width:1px;"><div>```
// When needing to perform math operation so often you need to convert a number in string format to an actual integer 
Store   |   $integerValue   |   parseInt(span("item-quantity"))
```

 </div> </div>####    
Tables: getting the number of rows in a table using ds$

<div id="bkmrk-%2F%2F-assuming-the-tabl" style="border-width:1px;"><div>```
// Assuming the table has an id myTable you can get the number of rows in the IDE using: 
Store  |  $rowsQuantity  |  _eval("ds$('#myTable tbody > tr').length")
or
Store  |  $rowsQuantity  |  getLength("ds$('#myTable tbody > tr')")
```

 </div> </div>An alternate way is to use the getLength function:

<div id="bkmrk-%2F%2F-assuming-the-tabl-1" style="border-width:1px;"><div>```
// Assuming the table has an id myTable you can get the number of rows in the IDE using: 
Store  |  $rowsQuantity  |  getLength("#myTable tbody > tr")
```

 </div> </div>#### Tables: getting the column index with a given header using ds$

<div id="bkmrk-%2F%2F-you-can-use-the-j" style="border-width:1px;"><div>```
// You can use the jQuery index() function to find the column index of a table that contains certain text "MyHeader". REF: https://api.jquery.com/index/
Store  |  $columnIndex  |  _eval("ds$('thead th:contains(MyHeader)').index()")+1
```

 </div> </div>#### Tables: Iterate over a table to process all the cells values of a given column using ds$

<div id="bkmrk-%2F%2F-if-you-need-to-it" style="border-width:1px;"><div>```
// If you need to iterate over a table column to process the contents of a certain column you can use above functions to get the total number of 
// rows in the table and the column that has the appropiate heade and then:
Store   |  $rowIndex                  | 1
While   |  $rowIndex < $rowsQuantity
  Store |  $cellValue                 |  _eval("ds$('tbody tr:nth-child("+$rowIndex+") td:nth-child("+$columnIndex+")').text()")
  [ do something with $cellValue ]
  Store |  $rowIndex                  |  $rowIndex + 1
End While
```

 </div> </div>#### General: close browser window.

<div id="bkmrk-%2F%2F-if-the-applicatio" style="border-width:1px;"><div>```
// If the application does not provide a button to close the window, need to insert
// the link and click it with following lines. 
CustomJS  |  "ds$('body').append('<a id=\"aiq-close\" href=\"javascript:close_window();\">aiq-close</a>')"Click     |  link("aiq-close")
```

 </div> </div>#### General: get an attribute value of an element

<div id="bkmrk-store-%7C-%24url-%7C-getat" style="border-width:1px;"><div>```
Store     |   $url   |  getAttribute(link("id"),"href")
```

 </div> </div>#### General: confirm an element is disabled

<div id="bkmrk-set-findonlyenabled-" style="border-width:1px;"><div>```
Set FindOnlyEnabled  |  false      | 
Store                |  submitdis  |  getAttribute(button("cancellation-submit"),"disabled")
Set FindOnlyEnabled  |  true       | 
Assert Equal         |  submitdis  |  "disabled"
```

 </div> </div> ![](https://docs.appvance.net/uploads/images/gallery/2026-07/scaled-1680-/tIjvb0mqSgh0Ykgk-6c1cecbdaf8d.png)#### General: get a dynamic value and use it elsewhere

<div id="bkmrk-get-from-whiteboard-" style="border-width:1px;"><div>```
Get from Whiteboard |  $caseNum                 | "CaseNumber"Click               |  link("Case Search")      |
Set Value           |  textbox("form-control")  | $caseNum
Click               |  submit("Search")         |  
Store               |  caseName                 | getText(cell(1,_near(span(["caseNameLabel"]))))
Click               |  link($caseNum)           |
Select Window       |  caseName                 |
```

 </div> </div> ![](https://docs.appvance.net/uploads/images/gallery/2026-07/scaled-1680-/MGeNXmzEdM9yIzgB-04b598dd9b23.png)##    
Links to other common challenges:

- [How to automate the Scroll bar? ](/books/test-designer-20-test-designer-30/page/how-to-automate-the-scroll-bar)
- [Pagination - How to search items in a page with multiple paginations ](/books/test-designer-20-test-designer-30/page/pagination-how-to-search-items-in-a-page-with-multiple-paginations)
 
<div id="bkmrk-last-updated%3A-july-0">---

Last updated: <span class="mc-variable General.NewDateTimeVariable variable">July 03, 2023</span>

If you have any feedback on this topic, please contact us at <documentation@appvance.ai>

</div>