get element path with simple mode return unambiguous path
Posted: Wed Sep 15, 2010 3:21 am
Hi, Ranorex staff,
I tried use the following code to compare the Rxpath returned for 2 link elements in a html file:
I found that the path returned with 'simple' mode can not uniquely identify the link element.
reduced mode path: "/dom[@page='simpleMode.html']/body/a[1]"
simple mode path: "/dom[@page='simpleMode.html' and @path='C:/Documents%20and%20Settings/rndgrp/Desktop/simpleMode.html' and @browsername='Mozilla']/body[pos()='1']/a[@innertext='aa' and @href='a.html']
Pls use the following html code to reproduce:
I tried use the following code to compare the Rxpath returned for 2 link elements in a html file:
Code: Select all
Dim a As ATag = "/dom[@page='simpleMode.html']/body/a[1]"
a.EnsureVisible()
Dim pathReduce As RxPath = a.GetPath(PathBuildMode.Reduce)
Dim pathSimple as RxPath = a.GetPath(pathbuildmode.Simple)
reduced mode path: "/dom[@page='simpleMode.html']/body/a[1]"
simple mode path: "/dom[@page='simpleMode.html' and @path='C:/Documents%20and%20Settings/rndgrp/Desktop/simpleMode.html' and @browsername='Mozilla']/body[pos()='1']/a[@innertext='aa' and @href='a.html']
Pls use the following html code to reproduce:
Code: Select all
<html>
<head>
</head>
<body>
<a href="a.html">aa</a>
<a href="a.html">aa</a>
</body>
</html>