GetPath taking very long time to return the path
Posted: Fri Sep 03, 2010 11:10 am
Hi Team,
I have a typical problem with getpath() taking very long time. Below is the detailed case:
I have a combobox which has more than 2000 listitems. Items are identified as below by Ranorex:
.....combobox/listitems[<index>]/text[@name='<name>']
So, in order to select the required item from the dropdown, I used the following:
Dim cmbBox As Combobox = repo.cmbCedent
Dim strXPath As String = "./listitem/text[@name='"& strName &"']"
Dim xPath As RxPath = new RxPath(strXPath)
Dim lstText As Text = cmbBox.FindSingle(Of Text)(xPath)
lstText.MoveTo
lstText.Click
The above worked fine and it used to scroll down till the Item (as I remember, not sure though) to select it. But now, it does not scroll down till the listitem, instead move to the items position below, and perform a click operation there. Since this click is not on the item and is outside the dropdown list, the item is not selected.
So, I left the above approach and tried a different approach below in which I find the item in the dropdown, get the path of the element, read the index of the listitem, then create a reference to the listitem[@index] and then select & click the listitem[@index].
Dim cmbBox As Combobox = repo.cmbCedent
Dim strXPath As String = "./listitem/text[@name='"& strName &"']"
Dim xPath As RxPath = new RxPath(strXPath)
Dim lstText As Text
Dim found As Boolean = cmbBox.TryFindSingle(Of Text)(xPath, lstText)
' ---- If found Then
Dim strPath As String = lstText.getPath().tostring()
' --------------- THIS TAKES A LOT OF TIME TO RETURN THE VALUE ---------------
' Read the index value for listitem from the above Path and then
Dim str1 As String = "./listitem[" & indexValue & "]
Dim lstRxPath As New RxPath(str1)
Dim lstItm As ListItem
Dim flag As Boolean = cmbBox.TryFindSingle(lstRxPath, lstItm)
lstItm.Select
This works perfectly, the only concern I have here is that the GetPath() it taking toooooo long. On average it about 25 minutes to the return the path of the item. I have tried it multiple times and that was never less than 20 minutes.
Other similar objects return the path quickly. The only difference this object have with others is the number of items in the dropdown. Most of the objects have around 30-40 items. One have around 250 items, for which the getpath() takes about 15-20 seconds to return the path. And this object (combobox) in question has more than 2000 listitems. I still dont see any reason why it should take this long time to return me the path, so that I can perform some calculations and then select the item.
Please help me understand why it (getpath())takes so long here, and if there is a better way of addressing the situation.
Thanks and Regards.
Aakash
I have a typical problem with getpath() taking very long time. Below is the detailed case:
I have a combobox which has more than 2000 listitems. Items are identified as below by Ranorex:
.....combobox/listitems[<index>]/text[@name='<name>']
So, in order to select the required item from the dropdown, I used the following:
Dim cmbBox As Combobox = repo.cmbCedent
Dim strXPath As String = "./listitem/text[@name='"& strName &"']"
Dim xPath As RxPath = new RxPath(strXPath)
Dim lstText As Text = cmbBox.FindSingle(Of Text)(xPath)
lstText.MoveTo
lstText.Click
The above worked fine and it used to scroll down till the Item (as I remember, not sure though) to select it. But now, it does not scroll down till the listitem, instead move to the items position below, and perform a click operation there. Since this click is not on the item and is outside the dropdown list, the item is not selected.
So, I left the above approach and tried a different approach below in which I find the item in the dropdown, get the path of the element, read the index of the listitem, then create a reference to the listitem[@index] and then select & click the listitem[@index].
Dim cmbBox As Combobox = repo.cmbCedent
Dim strXPath As String = "./listitem/text[@name='"& strName &"']"
Dim xPath As RxPath = new RxPath(strXPath)
Dim lstText As Text
Dim found As Boolean = cmbBox.TryFindSingle(Of Text)(xPath, lstText)
' ---- If found Then
Dim strPath As String = lstText.getPath().tostring()
' --------------- THIS TAKES A LOT OF TIME TO RETURN THE VALUE ---------------
' Read the index value for listitem from the above Path and then
Dim str1 As String = "./listitem[" & indexValue & "]
Dim lstRxPath As New RxPath(str1)
Dim lstItm As ListItem
Dim flag As Boolean = cmbBox.TryFindSingle(lstRxPath, lstItm)
lstItm.Select
This works perfectly, the only concern I have here is that the GetPath() it taking toooooo long. On average it about 25 minutes to the return the path of the item. I have tried it multiple times and that was never less than 20 minutes.
Other similar objects return the path quickly. The only difference this object have with others is the number of items in the dropdown. Most of the objects have around 30-40 items. One have around 250 items, for which the getpath() takes about 15-20 seconds to return the path. And this object (combobox) in question has more than 2000 listitems. I still dont see any reason why it should take this long time to return me the path, so that I can perform some calculations and then select the item.
Please help me understand why it (getpath())takes so long here, and if there is a better way of addressing the situation.
Thanks and Regards.
Aakash