cancel
Showing results for 
Search instead for 
Did you mean: 

not able to assign value to ListView Object

SOLVED
meenakshiyadav1
Contributor

not able to assign value to ListView Object

I am working on xamarin form based ios app. I am using a keyword driven framework in which I am passing Alias Name, Keyword (Action to be performed) and test data from excel sheet. 

when I directly assign value to Alias name of the object in my script, it workes fine --

Aliases.Device.processQaA36020.ManageContactPopup.Frame.StackLayout.Grid.lvAccounts.TemplatedItems.Item(0).BindingContext.Role = "Test Role"   //It works fine and the value 'Test Role' is set in Role field

 

But when I pass the value through variable it does not work. e.g.

 

function InputListObj(TestObj,InData)  //Testobj  is Alias name of Object on screen  and InData has the string that needs to be set in the field.
{
var obj = eval(TestObj)

Obj = InData
Delay(1000)

}

 

Can anyone please let me how to get it work.

 

 

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
tristaanogre
Community Hero

Re: not able to assign value to ListView Object

You say it "doesn't work".  Are there error messages? warnings? More information is needed.

Generally, so long as the contents of your Excel sheet match the ACTUAL mapped full Alias path of the object, your code SHOULD work.  One possible suspicion is that if you're doing the eval on the PROPERTY (which is what you are showing in your first example) the "eval" is probably returning the value of the property and not the actual object property itself.

Suggested edit.

 

function InputListObj(TestObj,PropertyName, InData)  //Testobj  is Alias name of Object on screen, PropertyName is the desired property for which to set the value  and InData has the string that needs to be set in the field.
{
var obj = eval(TestObj)

Obj[PropertyName] = InData
Delay(1000)

}

Robert Martin
[Hall of Fame]
Please consider giving a Kudo if I write good stuff
----

Why automate?  I do automated testing because there's only so much a human being can do and remain healthy.  Sleep is a requirement.  So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.

Mysterious Gremlin Master
Vegas Thrill Rider
Extensions available

View solution in original post

3 REPLIES 3
tristaanogre
Community Hero

Re: not able to assign value to ListView Object

You say it "doesn't work".  Are there error messages? warnings? More information is needed.

Generally, so long as the contents of your Excel sheet match the ACTUAL mapped full Alias path of the object, your code SHOULD work.  One possible suspicion is that if you're doing the eval on the PROPERTY (which is what you are showing in your first example) the "eval" is probably returning the value of the property and not the actual object property itself.

Suggested edit.

 

function InputListObj(TestObj,PropertyName, InData)  //Testobj  is Alias name of Object on screen, PropertyName is the desired property for which to set the value  and InData has the string that needs to be set in the field.
{
var obj = eval(TestObj)

Obj[PropertyName] = InData
Delay(1000)

}

Robert Martin
[Hall of Fame]
Please consider giving a Kudo if I write good stuff
----

Why automate?  I do automated testing because there's only so much a human being can do and remain healthy.  Sleep is a requirement.  So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.

Mysterious Gremlin Master
Vegas Thrill Rider
Extensions available

View solution in original post

AlexKaras
Community Hero

Re: not able to assign value to ListView Object

Yes, I'm second to Robert's explanation and suggestion.

 

Regards,
  /Alex [Community Hero]
____
[Community Heroes] are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Posts made by [Community Heroes]
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
The [Community Hero] signature is used with permission by SmartBear Software.
https://community.smartbear.com/t5/custom/page/page-id/hall-of-fame
================================
meenakshiyadav1
Contributor

Re: not able to assign value to ListView Object

Thanks a lot @tristaanogre .This has resolved my issue.

New Here?
Join us and watch the welcome video:
Announcements
Top Kudoed Authors