Hi,
I have a function which checks for all lookup values in combo box fields in the application.
It works for most of the lookups for fails for few items .
For example- Below mentioned are the lookups which is not selected while excuting. Cursor moves to the left most corner of the window and the lookup value is not selected in the combo box. It does not through any exception but continues with the next value in the list.
Any idea what is missing here.
Lookups
-----------
3 Payments (Equal) - 33.3% per payment
4 Payments (Equal) - 25% per payment
3 Payments (50% 1st Payment, 25% for the next 2 Payments)
3 Payments (40% 1st Payment, 30% for the next 2 Payments)
Thanks,
Saha
Certain lookup values are not selected
Re: Certain lookup values are not selected
Which ones (or a sample of) does it select properly?
What's different between the ones that work and the ones that don't?
Can you share you code that does the work?
What's different between the ones that work and the ones that don't?
Can you share you code that does the work?
If this or any response has helped you, please reply to the thread stating that it worked so other people with a similar issue will know how you fixed your issue!
Ciege...
Ciege...
Re: Certain lookup values are not selected
Fails for all these
3 Payments (Equal) - 33.3% per payment
4 Payments (Equal) - 25% per payment
3 Payments (50% 1st Payment, 25% for the next 2 Payments)
3 Payments (40% 1st Payment, 30% for the next 2 Payments)
Works fine for all other list items in the same combo box. some example of values which works fine.
Public vehicle infraction
At the Same Time Each Day
Job by Job Basis
Code -
3 Payments (Equal) - 33.3% per payment
4 Payments (Equal) - 25% per payment
3 Payments (50% 1st Payment, 25% for the next 2 Payments)
3 Payments (40% 1st Payment, 30% for the next 2 Payments)
Works fine for all other list items in the same combo box. some example of values which works fine.
Public vehicle infraction
At the Same Time Each Day
Job by Job Basis
Code -
Public Sub CheckLookupInUI(lookupItem As String, fieldName As String) Dim elementName As String = Nothing Dim isElementFound As Boolean = False Dim isLookupFound As Boolean = False Dim item As ListItem = Nothing Dim element As WebElement = Nothing 'MsgBox("fieldName:"&fieldName) elementName = GetElementName(fieldName) 'MsgBox("Element Name :" &elementName) Report.Info("lookup-"&lookupItem) isElementFound = webDoc.TryFindSingle(".//select[@id~'.*" & elementName & "$']", Adapter.DefaultSearchTimeout, element) If (isElementFound and element.EnsureVisible) Then element.focus() element.Click(Location.Center, 100) 'msgBox(lookupItem) isLookupFound = Host.Local.TryFindSingle(".//listitem[@accessiblename='" &lookupItem & "']", Adapter.DefaultSearchTimeout, item) If (isLookupFound) Then item.Click(Location.Center, 100) Else Report.Failure("Combo value not found-" &lookupItem) End If Else Report.Failure("Element not found :" &fieldName) End If End Sub
Re: Certain lookup values are not selected
Forgot to answer your seond question
Only difference i see in the list values which does not work in it has '%' , '-' in it.
Only difference i see in the list values which does not work in it has '%' , '-' in it.
Re: Certain lookup values are not selected
I agree... It sure looks like it is failing due to the special characters in the LookupItem.
Try spying on the values in question and see how RanorexSpy resolves the special characters. Since you are using a regular expression in your XPath you may need to put in some extra formatting code if your LookupItem contains special characters then you may need to add in some escape characters.
Try spying on the values in question and see how RanorexSpy resolves the special characters. Since you are using a regular expression in your XPath you may need to put in some extra formatting code if your LookupItem contains special characters then you may need to add in some escape characters.
If this or any response has helped you, please reply to the thread stating that it worked so other people with a similar issue will know how you fixed your issue!
Ciege...
Ciege...
Re: Certain lookup values are not selected
I have tried with spy and I am able to see the lookup values properly without any special formatting.
I have attached the snapshot for this lookup field.
Thanks,
Saha
I have attached the snapshot for this lookup field.
Thanks,
Saha
You do not have the required permissions to view the files attached to this post.
Re: Certain lookup values are not selected
Well, I may have misspoke... Since Spy is not representing the elements using a regular expression, it probably won't show escaped characters. But, since you are using a regular expression in your code you will need to escape the special characters properly according to RegEx standards.
If this or any response has helped you, please reply to the thread stating that it worked so other people with a similar issue will know how you fixed your issue!
Ciege...
Ciege...
- Support Team
- Site Admin
- Posts: 12145
- Joined: Fri Jul 07, 2006 4:30 pm
- Location: Houston, Texas, USA
- Contact:
Re: Certain lookup values are not selected
Hi,
I have tried your code and it is working like a charm. I had to replace your GetElementName method, but I think this method shouldn't be the problem. But could you please post this piece of code too?
I think it's not the RegEx. You don't use this for the list items, only for the ComboBox the RegEx is used and this shouldn't be a problem, because there are no special characters inside the ID attribute.
Have you tried to put a short delay after you click the combobox?
Regards,
Peter
Ranorex Team
I have tried your code and it is working like a charm. I had to replace your GetElementName method, but I think this method shouldn't be the problem. But could you please post this piece of code too?
I think it's not the RegEx. You don't use this for the list items, only for the ComboBox the RegEx is used and this shouldn't be a problem, because there are no special characters inside the ID attribute.
Do you get any warning in your report if Ranorex clicks to "0;0"?Saha wrote:cursor moves to the left most corner of the window and the lookup value is not selected in the combo box.
Have you tried to put a short delay after you click the combobox?
Regards,
Peter
Ranorex Team
Re: Certain lookup values are not selected
Hi Peter,
No I have not got any warning in report.
No I have not added any delay, as my lookup search work for most of the lookups.
Did this work for you with the specific lookup values which I have mentioned in the previous thread?
For example -
3 Payments (Equal) - 33.3% per payment
4 Payments (Equal) - 25% per payment
3 Payments (50% 1st Payment, 25% for the next 2 Payments)
3 Payments (40% 1st Payment, 30% for the next 2 Payments)
GetElementName method just look for the element in an access db and give the element ID back.
No I have not got any warning in report.
No I have not added any delay, as my lookup search work for most of the lookups.
Did this work for you with the specific lookup values which I have mentioned in the previous thread?
For example -
3 Payments (Equal) - 33.3% per payment
4 Payments (Equal) - 25% per payment
3 Payments (50% 1st Payment, 25% for the next 2 Payments)
3 Payments (40% 1st Payment, 30% for the next 2 Payments)
GetElementName method just look for the element in an access db and give the element ID back.
- Support Team
- Site Admin
- Posts: 12145
- Joined: Fri Jul 07, 2006 4:30 pm
- Location: Houston, Texas, USA
- Contact:
Re: Certain lookup values are not selected
Hi,
Please take a look to the attached project. I've used your code and also the HTML page I have used is inside the zip file.
Regards,
Peter
Ranorex Team
Please take a look to the attached project. I've used your code and also the HTML page I have used is inside the zip file.
Regards,
Peter
Ranorex Team
You do not have the required permissions to view the files attached to this post.