Hi All,
I am facing a problem in parameterizing the element definition(x-path).
The X-path I am using is :
.//ul[#'CurrentTags']/li/span[$var_tagnumber]
Here, Variable var_tagnumber is bound to a CSV file.
And I am proving the span index(1,2,3, etc.) through this variable.
ie. the values in CSV are as:
TagIndex
1
2
3
4
5
6
The problem is: at runtime, the X-path is genertaed as:
.//ul[#'CurrentTags']/li/span['2']
(checking for Span tag with label 2)
while I am looking for
.//ul[#'CurrentTags']/li/span[2]
(span tag with index 2)
Could anybody please suggest me asap if there is some solution to this problem?
Thanks and Regards,
Shruti Singh
problem in parameterizing the element definition(x-path)
Re: problem in parameterizing the element definition(x-path)
=
Last edited by sham526 on Mon Oct 08, 2012 1:11 pm, edited 1 time in total.
Re: problem in parameterizing the element definition(x-path)
Instead u can Try
.//ul[#'CurrentTags']/li/span['$var_tagnumber$']
.//ul[#'CurrentTags']/li/span['$var_tagnumber$']
Re: problem in parameterizing the element definition(x-path)
Hi Shruthi try the below (in Vb.Net)
Dim li_each As LiTag = Nothing
Dim bool As Boolean = Host.Local.TryFindSingle(".//ul[#'CurrentTags']/li", li_each)
If bool Then
'Now search for the Span Tag with the index from CSV File
Dim span_each As SpanTag = li_each.FindSingle(Of SpanTag)("./span[@childindex='" & var_tagnumber. ToString & "']")
End If
Dim li_each As LiTag = Nothing
Dim bool As Boolean = Host.Local.TryFindSingle(".//ul[#'CurrentTags']/li", li_each)
If bool Then
'Now search for the Span Tag with the index from CSV File
Dim span_each As SpanTag = li_each.FindSingle(Of SpanTag)("./span[@childindex='" & var_tagnumber. ToString & "']")
End If
- Support Team
- Site Admin
- Posts: 12145
- Joined: Fri Jul 07, 2006 4:30 pm
- Location: Houston, Texas, USA
- Contact:
Re: problem in parameterizing the element definition(x-path)
Hi Shruti,
Is this the RxPath of a repo item or are you using this RxPath in UserCode?
By the way which Ranorex version are you using?
Regards,
Markus
Ranorex Support Team
Is this the RxPath of a repo item or are you using this RxPath in UserCode?
By the way which Ranorex version are you using?
Regards,
Markus
Ranorex Support Team
Re: problem in parameterizing the element definition(x-path)
Hi,
I am using Ranorex 3.3.2(extended trail version).
I am using RxPath of repo item not code(and I would like to avoid coding as much as possible)
Thanks and Regards,
Shruti
I am using Ranorex 3.3.2(extended trail version).
I am using RxPath of repo item not code(and I would like to avoid coding as much as possible)
Thanks and Regards,
Shruti
- Support Team
- Site Admin
- Posts: 12145
- Joined: Fri Jul 07, 2006 4:30 pm
- Location: Houston, Texas, USA
- Contact:
Re: problem in parameterizing the element definition(x-path)
Hi,
Then it should work, you can use one of the two RxPaths in order to identify the element with the specific index saved in the variable:
Regards,
Markus
Ranorex Support Team
Then it should work, you can use one of the two RxPaths in order to identify the element with the specific index saved in the variable:
YourRxPath/span[$indexvariable] //OR YourRxPath/span[index()=$indexvariable]as described in the following UserGuide section: RanoreXPath.
Regards,
Markus
Ranorex Support Team
Re: problem in parameterizing the element definition(x-path)
yes..it's working now..
I guess I wasn't using it correctly.
Thanks
Shruti
I guess I wasn't using it correctly.
Thanks
Shruti
Re: problem in parameterizing the element definition(x-path)
Hi All,
I am facing a problem in parameterizing the browser URL value based on testcase.
In an excel file i have the following fields
Testcasename URLvalue
Actitivity1.01 abc.com
Actitivity1.02 google.com
The problem is: how to bind this data with my testsuite so that for first testcase it launch abc.com, run checks mentioned in activity1.01.
Launch second testcase it should launch google.com
Thanks,
Shruti
I am facing a problem in parameterizing the browser URL value based on testcase.
In an excel file i have the following fields
Testcasename URLvalue
Actitivity1.01 abc.com
Actitivity1.02 google.com
The problem is: how to bind this data with my testsuite so that for first testcase it launch abc.com, run checks mentioned in activity1.01.
Launch second testcase it should launch google.com
Thanks,
Shruti
- Support Team
- Site Admin
- Posts: 12145
- Joined: Fri Jul 07, 2006 4:30 pm
- Location: Houston, Texas, USA
- Contact:
Re: problem in parameterizing the element definition(x-path)
Hello Shruti,
You can use the same file as data source in each test case and only set the data range in the specific data connector.
Please read the section "Data Connectors" in our user guide in order to get more information where to use this setting.
Regards,
Bernhard
You can use the same file as data source in each test case and only set the data range in the specific data connector.
Please read the section "Data Connectors" in our user guide in order to get more information where to use this setting.
Regards,
Bernhard