I'm currently running automative tests against a web application. However, I'm struggling at selecting dynamic dates set via usercode. Below is a modifed snippet of my workings:
String searchDate = DateTime.now.AddDays(1).ToString();
//..
formating searchDate correctly
...//
string selector = "/dom[@caption~'^site title']//div[#'paginator']/ul/li/a[@innerText~'^searchDate']";
Element elementX = Ranorex.Core.Element.FromPath(selector);
When inspecting elementX its Null. The selector above being used is from Ranorex Spy also.
Any help is appreciated
Identifying Xpath via UserCode
Re: Identifying Xpath via UserCode
Hi,
To apply variable in code, you must use it like this:
BTW, please post a Ranorex snapshot (NOT screenshot) of UI you are trying to automate. This would help us to understand your UI and eventually suggest best approach.
To apply variable in code, you must use it like this:
Code: Select all
string selector = "/dom[@caption~'^site title']//div[#'paginator']/ul/li/a[@innerText~'^"+ searchDate+"']";
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