Hello there,
I am validating on logo of the website, but the index of the dom keeps changing which is causing my test case to fail. Can some one tell how to write a regular expression for a changing index. I browsed through the examples of regular expression in your website but could not find an appropriate solution for my problem.
Example Xpath: /dom[11]//div[#'headleft']?/?/img[@alt='Bio-Rad logo']
In the above example dom[11] might become dom[5] and so on. How can i avoid this problemt
How to write a regular expression for changing index
Re: How to write a regular expression for changing index
Hi,
I think that using regex for index number in DOM is useless. You can the same remove the index completely from the xpath:
What you should do is to add a meaningful attribute to the xpath, like @domain. Otherwise, the search for elements could take a lot of time, because there could be numerous DOMs and Ranorex will have to search them all, until it finds matching element. So in my opinion, it's critical to set a meaningful attribute for DOM element.
I think that using regex for index number in DOM is useless. You can the same remove the index completely from the xpath:
Code: Select all
/dom//div[#'headleft']?/?/img[@alt='Bio-Rad logo']
Last edited by odklizec on Thu Sep 28, 2017 7:04 pm, edited 1 time in total.
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: How to write a regular expression for changing index
Thank you so much odklizec!! After removing the index it worked fine