Hi Team,
We are using Ranorax latest licensed version 8.3.0.
We are getting issue while selecting dropdown incase of special character ' in innerText.
Error Message:-
Invalid RxPath './/option[@innertext='Renorex's Forum']'.
Invalid character at character position 71.
In the above example my innerText value is dynamic that can be pass from external file.
Most of the cases it's working cool(Data doen't have any special characters) but in some cases it's failing may be because of special characters in innerText i.e Renorex's Forum.
So could you help me out.
Getting error Invalid character at character position for select dropdown with innertext
Re: Getting error Invalid character at character position for select dropdown with innertext
Hi,
At first, there is a new Ranorex version 8.3.1, with a lot of bugfixes. Please install this version and try to repeat your problem.
At next, could you please show us how exactly do you select dropdown items in your recording/code module? I'm not aware of any problem caused by apostrophe character? So if the apostrophe is indeed a cause of your problem, you will have to check and modify the ref data. Eventually, use regex expression in the xpath (~) instead of simple equality and remove problematic characters from the ref data.
At first, there is a new Ranorex version 8.3.1, with a lot of bugfixes. Please install this version and try to repeat your problem.
At next, could you please show us how exactly do you select dropdown items in your recording/code module? I'm not aware of any problem caused by apostrophe character? So if the apostrophe is indeed a cause of your problem, you will have to check and modify the ref data. Eventually, use regex expression in the xpath (~) instead of simple equality and remove problematic characters from the ref data.
Pavel Kudrys
Ranorex explorer at Descartes Systems
Please add these details to your questions:
Ranorex explorer at Descartes Systems
Please add these details to your questions:
- Ranorex Snapshot. Learn how to create one >here<
- Ranorex xPath of problematic element(s)
- Ranorex version
- OS version
- HW configuration
Re: Getting error Invalid character at character position for select dropdown with innertext
The error signals a syntax problem with your RanoreXPath.
If you have a tick ' in a value in RanoreXPath, you have to escape the tick by preceding it with another tick, e.g.:
element[name='Alex'' element'] will match an element with name set to "Alex' element".
Regards,
Alex
Ranorex Team
If you have a tick ' in a value in RanoreXPath, you have to escape the tick by preceding it with another tick, e.g.:
element[name='Alex'' element'] will match an element with name set to "Alex' element".
Regards,
Alex
Ranorex Team
Re: Getting error Invalid character at character position for select dropdown with innertext
Tried with RegEx then problem solved.
Below is the code used to select dropdown which has text with specialchar
OptionTag option = item.FindSingle(".//option[@innertext~'^textName']");
option.Selected = true;
Below is the code used to select dropdown which has text with specialchar
OptionTag option = item.FindSingle(".//option[@innertext~'^textName']");
option.Selected = true;