Hello.
I was wondering if anyone has wrapped the Find methods to have something similar to the By class in selenium. e.g.
Form.Find<Ranorex.Text>(By.Id("105"))
Form.Find<Ranorex.Button>(By.Text("OK"))
where say:
By.Id("105") expands to xpath string descendant::element[@id="105"]
Cheers.
By class for element location
- Support Team
- Site Admin
- Posts: 12145
- Joined: Fri Jul 07, 2006 4:30 pm
- Location: Houston, Texas, USA
- Contact:
Re: By class for element location
Hello,
You can do this using Ranorex, you just need to use the appropriate RxPath and search method.
Here is a sample how this can work:
Regards,
Markus
You can do this using Ranorex, you just need to use the appropriate RxPath and search method.
Here is a sample how this can work:
Ranorex.Text text = Form.FindSingle<Ranorex.Text>(".//text[@?'105']");If you know which attribute contains the Id you can also add it to the RxPath:
Ranorex.Text text = Form.FindSingle<Ranorex.Text>(".//text[@controlid='105']");It is also possible to use a variable instead of the hard coded id:
String Id = "105"; ATag tag = newsORFAt.FindSingle<Ranorex.ATag>(".//a[?'"+Id+"']");The same holds for finding an element by its text.
Regards,
Markus