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;
Re: Getting error Invalid character at character position for select dropdown with innertext
If you are using excel as a datasource in some part of your Ranorex project. It is higly likely that you will get an "Invalid character at character position XXX" error. The reason behing is in older excel version or office runtime distributable binaries like "Microsoft Access Database Engine 2016" the excel cell values after 256th character is truncated. The runtime reads only the first 256 characters of each cell of excel file.
The workaround is simple. You just need a dummy excel cell IN YOUR FIRST DATAROW (i.e. the 2nd excel row) with a celldata that has more than 256 characters inside it.
Here is another forum post about the same issue: https://www.mrexcel.com/board/threads/c ... ed.972147/
Here is the actual description of problem from microsoft: https://docs.microsoft.com/en-us/office ... -truncated
The workaround is simple. You just need a dummy excel cell IN YOUR FIRST DATAROW (i.e. the 2nd excel row) with a celldata that has more than 256 characters inside it.
Here is another forum post about the same issue: https://www.mrexcel.com/board/threads/c ... ed.972147/
Here is the actual description of problem from microsoft: https://docs.microsoft.com/en-us/office ... -truncated