[Webtest] Xpaths obtained from X-path explorer are not recognised by canoo
Denis N. Antonioli
webtest@lists.canoo.com
Mon, 14 Aug 2006 15:46:08 +0200
--Apple-Mail-1--985173792
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain;
charset=ISO-8859-1;
delsp=yes;
format=flowed
Hi
it's an FAQ: webtest, like most moder browsers, normalizes the html =20
pages before testing it.
Specifically, it inserts a <tbody> in each table, so your xpath =20
should be:
//form[@id=3D'Form1']/table[2]/tbody/tr[2]/td/table/tbody/tr/td[2]/table=20=
[4]/tbody/tr/td[1]/table/tbody/tr/td[2]/table/tbody/tr[4]/td/table/=20
tbody/tr/td/table/tbody/tr/td[2]/img
Note that this is indeed a very long xpath, you may consider =20
simplifying it. But that's a different question.
Happy testing
dna
On 14 ao=FBt 06, at 15:32, Prasanna wrote:
> Hi
> I am using xpath explorer to find xpath and from xpath explorerI =20
> get correct xpath as
> //form[@id=3D'Form1']/table[2]/tr[2]/td/table/tr/td[2]/table[4]/tr/td=20=
> [1]/table/tr/td[2]/table/tr[4]/td/table/tr/td/table/tr/td[2]/img
>
> But it seems if xpath is lengthy Canoo fails to recoginse it
> and gives error
> xpath not found
>
> But My xpath is correct as per xpath explorer anyone knows solution =20=
> for better xpath ??
> Help me please
>
it's an FAQ: webtest, like most moder browsers, normalizes the html =20
pages before testing it.
Specifically, it inserts a <tbody> in each table, so your xpath =20
should be:
//form[@id=3D'Form1']/table[2]/tbody/tr[2]/td/table/tbody/tr/td[2]/table=20=
[4]/tbody/tr/td[1]/table/tbody/tr/td[2]/table/tbody/tr[4]/td/table/=20
tbody/tr/td/table/tbody/tr/td[2]/img
Note that this is indeed a very long xpath, you may consider =20
simplifying it. But that's a different question.
Happy testing
dna
--=20
Accept without pride, relinquish without a struggle.
-- Marcus Aurelius Antonius, Meditations 8.33
--Apple-Mail-1--985173792
Content-Transfer-Encoding: quoted-printable
Content-Type: text/html;
charset=ISO-8859-1
<HTML><BODY style=3D"word-wrap: break-word; -khtml-nbsp-mode: space; =
-khtml-line-break: after-white-space; ">Hi<DIV><BR =
class=3D"khtml-block-placeholder"></DIV><DIV>it's an FAQ: webtest, like =
most moder browsers, normalizes the html pages before testing =
it.</DIV><DIV>Specifically, it inserts a <tbody> in each table, so =
your xpath should be:</DIV><DIV><BR =
class=3D"khtml-block-placeholder"></DIV><FONT class=3D"Apple-style-span" =
face=3D"Arial" size=3D"2"><SPAN class=3D"Apple-style-span" =
style=3D"font-size: 10px;">//form[@id=3D'Form1']/table[2]</SPAN><B><FONT =
class=3D"Apple-style-span" color=3D"#FF0000">/tbody/</FONT></B><SPAN =
class=3D"Apple-style-span" style=3D"font-size: =
10px;">tr[2]/td/table<FONT class=3D"Apple-style-span" =
color=3D"#FF0000"><B>/tbody/</B></FONT>tr/td[2]/table[4]<FONT =
class=3D"Apple-style-span" =
color=3D"#FF0000"><B>/tbody/</B></FONT>tr/td[1]/table<FONT =
class=3D"Apple-style-span" =
color=3D"#FF0000"><B>/tbody/</B></FONT>tr/td[2]/table<FONT =
class=3D"Apple-style-span" =
color=3D"#FF0000"><B>/tbody/</B></FONT>tr[4]/td/table<FONT =
class=3D"Apple-style-span" =
color=3D"#FF0000"><B>/tbody/</B></FONT>tr/td/table<FONT =
class=3D"Apple-style-span" =
color=3D"#FF0000"><B>/tbody/</B></FONT>tr/td[2]/img</SPAN></FONT><DIV><BR =
class=3D"khtml-block-placeholder"></DIV><DIV><BR =
class=3D"khtml-block-placeholder"></DIV><DIV>Note that this is indeed a =
very long xpath, you may consider simplifying it. But that's a different =
question.</DIV><DIV><BR class=3D"khtml-block-placeholder"></DIV><DIV>Happy=
testing</DIV><DIV><SPAN class=3D"Apple-tab-span" =
style=3D"white-space:pre"> </SPAN>dna</DIV><DIV><BR =
class=3D"khtml-block-placeholder"></DIV><DIV><DIV><DIV>On 14 ao=FBt 06, =
at 15:32, Prasanna wrote:</DIV><BR =
class=3D"Apple-interchange-newline"><BLOCKQUOTE type=3D"cite"><SPAN =
class=3D"Apple-style-span" style=3D"border-collapse: separate; =
border-spacing: 0px 0px; color: rgb(0, 0, 0); font-family: Helvetica; =
font-size: 12px; font-style: normal; font-variant: normal; font-weight: =
normal; letter-spacing: normal; line-height: normal; text-align: auto; =
-khtml-text-decorations-in-effect: none; text-indent: 0px; =
-apple-text-size-adjust: auto; text-transform: none; orphans: 2; =
white-space: normal; widows: 2; word-spacing: 0px; "><DIV><FONT =
face=3D"Arial" size=3D"2"><SPAN class=3D"Apple-style-span" =
style=3D"font-family: Arial; font-size: 10px; =
">Hi</SPAN></FONT></DIV><DIV><FONT face=3D"Arial" size=3D"2"><SPAN =
class=3D"Apple-style-span" style=3D"font-family: Arial; font-size: 10px; =
">I am using xpath explorer to find xpath and from xpath explorerI get =
correct xpath as</SPAN></FONT></DIV><DIV><FONT face=3D"Arial" =
size=3D"2"><SPAN class=3D"Apple-style-span" style=3D"font-family: Arial; =
font-size: 10px; =
">//form[@id=3D'Form1']/table[2]/tr[2]/td/table/tr/td[2]/table[4]/tr/td[1]=
/table/tr/td[2]/table/tr[4]/td/table/tr/td/table/tr/td[2]/img</SPAN></FONT=
></DIV><DIV><FONT face=3D"Arial" size=3D"2"></FONT>=A0</DIV><DIV><FONT =
face=3D"Arial" size=3D"2"><SPAN class=3D"Apple-style-span" =
style=3D"font-family: Arial; font-size: 10px; ">But it seems if xpath is =
lengthy Canoo fails to recoginse it</SPAN></FONT></DIV><DIV><FONT =
face=3D"Arial" size=3D"2"><SPAN class=3D"Apple-style-span" =
style=3D"font-family: Arial; font-size: 10px; ">and gives =
error</SPAN></FONT></DIV><DIV><FONT face=3D"Arial" size=3D"2"><SPAN =
class=3D"Apple-style-span" style=3D"font-family: Arial; font-size: 10px; =
">xpath not found</SPAN></FONT></DIV><DIV><FONT face=3D"Arial" =
size=3D"2"></FONT>=A0</DIV><DIV><FONT face=3D"Arial" size=3D"2"><SPAN =
class=3D"Apple-style-span" style=3D"font-family: Arial; font-size: 10px; =
">But My xpath is correct as per xpath explorer anyone knows solution =
for better xpath ??</SPAN></FONT></DIV><DIV><FONT face=3D"Arial" =
size=3D"2"><SPAN class=3D"Apple-style-span" style=3D"font-family: Arial; =
font-size: 10px; ">Help me please</SPAN></FONT></DIV><BR =
class=3D"Apple-interchange-newline"></SPAN></BLOCKQUOTE></DIV><DIV><BR =
class=3D"khtml-block-placeholder"></DIV><DIV>it's an FAQ: webtest, like =
most moder browsers, normalizes the html pages before testing =
it.</DIV><DIV>Specifically, it inserts a <tbody> in each table, so =
your xpath should be:</DIV><DIV><BR =
class=3D"khtml-block-placeholder"></DIV><FONT class=3D"Apple-style-span" =
face=3D"Arial" size=3D"2"><SPAN class=3D"Apple-style-span" =
style=3D"font-size: =
10px;">//form[@id=3D'Form1']/table[2]</SPAN></FONT><FONT =
class=3D"Apple-style-span" color=3D"#FF0000" face=3D"Arial" =
size=3D"2"><SPAN class=3D"Apple-style-span" style=3D"font-size: =
10px;"><B>/tbody/</B></SPAN></FONT><FONT class=3D"Apple-style-span" =
face=3D"Arial" size=3D"2"><SPAN class=3D"Apple-style-span" =
style=3D"font-size: 10px;">tr[2]/td/table</SPAN></FONT><FONT =
class=3D"Apple-style-span" color=3D"#FF0000" face=3D"Arial" =
size=3D"2"><SPAN class=3D"Apple-style-span" style=3D"font-size: =
10px;"><B>/tbody/</B></SPAN></FONT><FONT class=3D"Apple-style-span" =
face=3D"Arial" size=3D"2"><SPAN class=3D"Apple-style-span" =
style=3D"font-size: 10px;">tr/td[2]/table[4]</SPAN></FONT><FONT =
class=3D"Apple-style-span" color=3D"#FF0000" face=3D"Arial" =
size=3D"2"><SPAN class=3D"Apple-style-span" style=3D"font-size: =
10px;"><B>/tbody/</B></SPAN></FONT><FONT class=3D"Apple-style-span" =
face=3D"Arial" size=3D"2"><SPAN class=3D"Apple-style-span" =
style=3D"font-size: 10px;">tr/td[1]/table</SPAN></FONT><FONT =
class=3D"Apple-style-span" color=3D"#FF0000" face=3D"Arial" =
size=3D"2"><SPAN class=3D"Apple-style-span" style=3D"font-size: =
10px;"><B>/tbody/</B></SPAN></FONT><FONT class=3D"Apple-style-span" =
face=3D"Arial" size=3D"2"><SPAN class=3D"Apple-style-span" =
style=3D"font-size: 10px;">tr/td[2]/table</SPAN></FONT><FONT =
class=3D"Apple-style-span" color=3D"#FF0000" face=3D"Arial" =
size=3D"2"><SPAN class=3D"Apple-style-span" style=3D"font-size: =
10px;"><B>/tbody/</B></SPAN></FONT><FONT class=3D"Apple-style-span" =
face=3D"Arial" size=3D"2"><SPAN class=3D"Apple-style-span" =
style=3D"font-size: 10px;">tr[4]/td/table</SPAN></FONT><FONT =
class=3D"Apple-style-span" color=3D"#FF0000" face=3D"Arial" =
size=3D"2"><SPAN class=3D"Apple-style-span" style=3D"font-size: =
10px;"><B>/tbody/</B></SPAN></FONT><FONT class=3D"Apple-style-span" =
face=3D"Arial" size=3D"2"><SPAN class=3D"Apple-style-span" =
style=3D"font-size: 10px;">tr/td/table</SPAN></FONT><FONT =
class=3D"Apple-style-span" color=3D"#FF0000" face=3D"Arial" =
size=3D"2"><SPAN class=3D"Apple-style-span" style=3D"font-size: =
10px;"><B>/tbody/</B></SPAN></FONT><FONT class=3D"Apple-style-span" =
face=3D"Arial" size=3D"2"><SPAN class=3D"Apple-style-span" =
style=3D"font-size: 10px;">tr/td[2]/img</SPAN></FONT><DIV><BR =
class=3D"khtml-block-placeholder"></DIV><DIV><BR =
class=3D"khtml-block-placeholder"></DIV><DIV>Note that this is indeed a =
very long xpath, you may consider simplifying it. But that's a different =
question.</DIV><DIV><BR class=3D"khtml-block-placeholder"></DIV><DIV>Happy=
testing</DIV><DIV><SPAN class=3D"Apple-tab-span" =
style=3D"white-space:pre"> </SPAN>dna</DIV><BR><DIV> <P =
style=3D"margin: 0.0px 0.0px 0.0px 0.0px"><FONT face=3D"Helvetica" =
size=3D"3" style=3D"font: 12.0px Helvetica">--<SPAN =
class=3D"Apple-converted-space">=A0</SPAN></FONT></P> <P style=3D"margin: =
0.0px 0.0px 0.0px 0.0px"><FONT face=3D"Helvetica" size=3D"3" =
style=3D"font: 12.0px Helvetica">Accept without pride, relinquish =
without a struggle.</FONT></P> <P style=3D"margin: 0.0px 0.0px 0.0px =
0.0px"><FONT face=3D"Helvetica" size=3D"3" style=3D"font: 12.0px =
Helvetica"><SPAN class=3D"Apple-converted-space">=A0 </SPAN>-- Marcus =
Aurelius Antonius, Meditations 8.33</FONT></P> =
</DIV><BR></DIV></BODY></HTML>=
--Apple-Mail-1--985173792--