Hello All,
i ran into a trouble. i am trying to pick a non business day (saturday) from the calendar(in snapshot). given that the calendar tr and td tags change every month. how to uniquely define xpath for this?.
i am trying to do in a user code method in a recording:
string dateday = System.DateTime.Today.Day.ToString();
tdtag todaydate = "/dom[@domain='6012-sbx.btbanking.com']/body/div[7]//table/tbody/tr[4]/td[@innertext='25']//following-sibling/td[@childindex = '6']";
todaydate.click();
since child index of saturday column is always 6.
obviously this will not work tomorrow.. is there any way to insert the dateday variable in the xpath of todaydate something like "td[@innertext=dateday]". i tried "td[@innertext=$dateday]" and it didnot work.
could anyone help me with this.
Thank you.
Pick a Saturday from a calendar
Pick a Saturday from a calendar
You do not have the required permissions to view the files attached to this post.
Re: Pick a Saturday from a calendar
Hi,
To pass the variable to xpath (in code), you must do it like this:
BTW, you should also remove all indexes, otherwise, it will fail with day in another row. I would suggest xpath like this:
Additionally, using xpath directly in code is a big mistake people often do. You should rather pass the repo element to code via method parameter. So then if the xpath of repo element changes, you don't have to change it at many places in code. Just change it once in repo
To pass the variable to xpath (in code), you must do it like this:
Code: Select all
tdtag todaydate = "/dom[@domain='6012-sbx.btbanking.com']/body/div[7]//table/tbody/tr[4]/td[@innertext='" + dateday + "']//following-sibling/td[@childindex = '6']";
Code: Select all
tdtag todaydate = "/dom[@domain='6012-sbx.btbanking.com']/body//table/tbody/tr/td[@innertext='" + dateday + "']//following-sibling/td[@childindex = '6']";
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: Pick a Saturday from a calendar
Thank you sir, This is awesome.