Page 1 of 1

problem in parameterizing the element definition(x-path)

Posted: Mon Oct 08, 2012 11:16 am
by Shruti
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

Re: problem in parameterizing the element definition(x-path)

Posted: Mon Oct 08, 2012 1:09 pm
by sham526
=

Re: problem in parameterizing the element definition(x-path)

Posted: Mon Oct 08, 2012 1:10 pm
by sham526
Instead u can Try

.//ul[#'CurrentTags']/li/span['$var_tagnumber$']

Re: problem in parameterizing the element definition(x-path)

Posted: Mon Oct 08, 2012 1:12 pm
by sham526
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

Re: problem in parameterizing the element definition(x-path)

Posted: Mon Oct 08, 2012 1:52 pm
by Support Team
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

Re: problem in parameterizing the element definition(x-path)

Posted: Mon Oct 08, 2012 9:46 pm
by Shruti
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

Re: problem in parameterizing the element definition(x-path)

Posted: Tue Oct 09, 2012 3:52 pm
by Support Team
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:
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)

Posted: Thu Oct 11, 2012 10:31 am
by Shruti
yes..it's working now..
I guess I wasn't using it correctly.

Thanks
Shruti

Re: problem in parameterizing the element definition(x-path)

Posted: Sat Aug 31, 2013 1:39 pm
by Shruti
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

Re: problem in parameterizing the element definition(x-path)

Posted: Mon Sep 02, 2013 4:21 pm
by Support Team
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