AutoBot_1
15 years agoOccasional Contributor
Problems using XPATH in TC 8.50
Dear TC Support,
Its really a helpful feature to use Xpath using TC 8.5 in identifying web objects.
However, I am facing some issues while identifying the Xpath for a few web objects that dont have an ID assigned to it.
Consider the scenario:
I want to click on the select flight button on Delta.com
To reach this step, you should goto www.delta.com; search for any flight; the next page goes to a URL as
http://www.delta.com/booking/findFlights.do#top
Check the attached snapshot of the webpage. I am trying to find the Xpath of the highlighted element using a Firefox plugin (Xpath Checker).
The Xpath given by this plugin works accurately in most cases when used with TestCompletes "EvaluateXpath" function.
(Note: I am using Firefox 3.6.x on Windows XP machine.)
However, in this case it is not working and gives and error when I give this as the Xpath-
id('td_selectFlightsSegment_0_0_0')/x:div/x:input
My code looks like -
objWebObject = objPage.EvaluateXPath("id('td_selectFlightsSegment_0_0_0')/x:div/x:input")
Can you please suggest a way to use Xpath in this case. (Am i missing any syntax or escape characters while giving this Xpath inside the function).
Please note I do not want to use the Find method to locate the object, that works for me and I am aware of that approach. I want to specifically use Xpath in this scenario.
Its really a helpful feature to use Xpath using TC 8.5 in identifying web objects.
However, I am facing some issues while identifying the Xpath for a few web objects that dont have an ID assigned to it.
Consider the scenario:
I want to click on the select flight button on Delta.com
To reach this step, you should goto www.delta.com; search for any flight; the next page goes to a URL as
http://www.delta.com/booking/findFlights.do#top
Check the attached snapshot of the webpage. I am trying to find the Xpath of the highlighted element using a Firefox plugin (Xpath Checker).
The Xpath given by this plugin works accurately in most cases when used with TestCompletes "EvaluateXpath" function.
(Note: I am using Firefox 3.6.x on Windows XP machine.)
However, in this case it is not working and gives and error when I give this as the Xpath-
id('td_selectFlightsSegment_0_0_0')/x:div/x:input
My code looks like -
objWebObject = objPage.EvaluateXPath("id('td_selectFlightsSegment_0_0_0')/x:div/x:input")
Can you please suggest a way to use Xpath in this case. (Am i missing any syntax or escape characters while giving this Xpath inside the function).
Please note I do not want to use the Find method to locate the object, that works for me and I am aware of that approach. I want to specifically use Xpath in this scenario.