Hello,
I am trying to verify the color of a text object. When I right click on the object in Spy I can access GetStyle where I can specify the color property and it returns me the color code just like I want. However, in Studio, when I drag the object from the repo into the grid I don't get GetStyle as an option (see attached). I also tried doing it via a code module, but I get a compilation error that getStyle is not a member of Ranorex.Text. Why does it work via Spy, but not Studio and how can I get it to work so I can verify the color code is what I expect?
Thanks for your help!
Can access getStyle from Ranorex Spy, but not Studio
Can access getStyle from Ranorex Spy, but not Studio
- Attachments
-
- getStyle.PNG (218.09 KiB) Viewed 2295 times
- Support Team
- Site Admin
- Posts: 12167
- Joined: Fri Jul 07, 2006 4:30 pm
- Location: Graz, Austria
Re: Can access getStyle from Ranorex Spy, but not Studio
Hello,
Unfortunately it is not possible to get the value of the color property using the recorder actions, but you can try to use the GetStyle() in user code.
Please try to use the following code:
Thank you!
Regards,
Bernhard
Unfortunately it is not possible to get the value of the color property using the recorder actions, but you can try to use the GetStyle() in user code.
Please try to use the following code:
var myFlexElement = repo.YourElement; var color = myFlexElement.As<FlexElement>().GetStyle("color"); Report.Info(color);Please let me know if this doesn't work.
Thank you!
Regards,
Bernhard
Re: Can access getStyle from Ranorex Spy, but not Studio
Hello,
I've tried that already, but I get an error that Value of type 'Ranorex.Text' cannot be converted to 'Ranorex.FlexElement'.
I've tried that already, but I get an error that Value of type 'Ranorex.Text' cannot be converted to 'Ranorex.FlexElement'.
- Support Team
- Site Admin
- Posts: 12167
- Joined: Fri Jul 07, 2006 4:30 pm
- Location: Graz, Austria
Re: Can access getStyle from Ranorex Spy, but not Studio
Hello,
In order to analyze the issue in more detail I would need more information about the application under test and your script.
Could you please post a Ranorex snapshot file from your application and the code snippet?
If you don't want to post the snapshot file in the forum you can also send it to [email protected].
Thank you!
Regards,
Bernhard
In order to analyze the issue in more detail I would need more information about the application under test and your script.
Could you please post a Ranorex snapshot file from your application and the code snippet?
If you don't want to post the snapshot file in the forum you can also send it to [email protected].
Thank you!
Regards,
Bernhard
Re: Can access getStyle from Ranorex Spy, but not Studio
Hi Bernhard,
These are the couple things I have tried so far and the results I get. I have also attached the Ranorex snapshot.
getStyle' is not a member of 'Ranorex.Text'. (BC30456) -
'Dim color As String = repo.POModule.crownPOAmtGrid_byPoType.getStyle("color")
'Report.Info(color)
Outputs null
'Dim myText As Text = repo.POModule.crownPOAmtGrid_byPoType
'Dim color As String = myText.Element.GetAttributeValue("color").ToString
'Report.Info(color)
Get a compiliation error - Value of type 'Ranorex.Text' cannot be converted to 'Ranorex.FlexElement'. (BC30311) - C:\development\workspaces\qa\trunk\Ranorex\CCIsites\ScriptLibrary\POModule\POModule\ValidateDataChanges.UserCode.vb:47,52
'Dim myFlexElement As FlexElement = repo.POModule.crownPOAmtGrid_byPoType
‘Dim color As String = myFlexElement.As<FlexElement>().GetStyle("color")
'Report.Info(color)
These are the couple things I have tried so far and the results I get. I have also attached the Ranorex snapshot.
getStyle' is not a member of 'Ranorex.Text'. (BC30456) -
'Dim color As String = repo.POModule.crownPOAmtGrid_byPoType.getStyle("color")
'Report.Info(color)
Outputs null
'Dim myText As Text = repo.POModule.crownPOAmtGrid_byPoType
'Dim color As String = myText.Element.GetAttributeValue("color").ToString
'Report.Info(color)
Get a compiliation error - Value of type 'Ranorex.Text' cannot be converted to 'Ranorex.FlexElement'. (BC30311) - C:\development\workspaces\qa\trunk\Ranorex\CCIsites\ScriptLibrary\POModule\POModule\ValidateDataChanges.UserCode.vb:47,52
'Dim myFlexElement As FlexElement = repo.POModule.crownPOAmtGrid_byPoType
‘Dim color As String = myFlexElement.As<FlexElement>().GetStyle("color")
'Report.Info(color)
- Attachments
-
- POModule.rxsnp
- (295.58 KiB) Downloaded 191 times
- Support Team
- Site Admin
- Posts: 12167
- Joined: Fri Jul 07, 2006 4:30 pm
- Location: Graz, Austria
Re: Can access getStyle from Ranorex Spy, but not Studio
Hello,
Has the element "repo.POModule.crownPOAmtGrid_byPoType" the following path?
Bernhard
Has the element "repo.POModule.crownPOAmtGrid_byPoType" the following path?
/dom[@domain='www.test.ccisites.com']//td[#'myTD']/flexobject/container/container/container/container/container/container/container/table/row/cell/element/text[@automationname='lblData']If yes, could you please try the following code?
Dim myFlexElement as Text = repo.POModule.crownPOAmtGrid_byPoType Dim color as String = myFlexElement.[As](Of FlexElement)().GetStyle("color") Report.Info(color)Regards,
Bernhard
Re: Can access getStyle from Ranorex Spy, but not Studio
That worked for me, thanks so much!