The element does not support the required capability 'table'

Ask general questions here.
Posts: 38
Joined: Tue Jan 27, 2015 10:44 pm
Location: Charlotte, NC, USA

The element does not support the required capability 'table'

Post by zoework » Wed Apr 01, 2015 9:57 pm

I get this error in my custom code. I'm trying to search through a table in my application to determine in which row the data is that I want to change.
The table has several columns and multiple rows for the same product. I need to find the row where the product has a specific value. For instance, which product is sold out.
Here is the code I'm using:
public void SelectOrder()
//Table varTable = "/dom[@domain='']//div[#'content']/div[2]/div[2]/div[1]/div/div/div/div/div/table/tbody[2]/";
//Table varTable = "/dom[@caption=Shopping]//div[#'content']/div[2]/div[2]/div[1]/div/div/div/div/div/table/tbody[2]/";
Table varTable = "/dom[@caption=Shopping]//div[#'content']/div[2]/div[2]/div[1]/div/div/";
var varRows = varTable.Rows;
foreach (var row in varRows)
var varProduct = "tr["+row+"]/td[@innertext]";
if(varProduct == "Rice")
var varStatus = "tr["+row+"]/td[@innertext]";
if (varStatus == "Sold Out")
tableRowNum = row.ToString();
}//end SelectOrder function

I tried all three versions of the table item definitions above and they all throw the same error. How should I specify the table?
Zoë (aka zoework)

Certified Professional
Certified Professional
Posts: 74
Joined: Mon Aug 14, 2006 7:17 pm
Location: CH

Re: The element does not support the required capability 'table'

Post by CookieMonster » Thu Apr 02, 2015 7:37 am

Hi Zöe,

With Ranorex XPath examples you are using in the Method SelectOrder, you will never be able to instantiate a Table object. You have to use the TableTag Object to instantiate a web table and also your XPath with which you are trying to instantiate the table is wrong.

In this example you are using the wrong table object and body[2]/ is too much.

Code: Select all

//Table varTable = "/dom[@domain='']//div[#'content']/div[2]/div[2]/div[1]/div/div/div/div/div/table/tbody[2]/";
It should look like the line below.

Code: Select all

TableTag varTable = "/dom[@domain='']//div[#'content']/div[2]/div[2]/div[1]/div/div/div/div/div/table";
And please ask your web developer if he/she can add an unique id to the table tag. Then your XPaht can look like:

And also try to avoid using indexes in the XPath, if the developer is changing the table from div[2] to div[5] the table will never be found.