Hi,
Been trying to get the 'Widht'-property from a object inheriting from a System.Windows.Forms.Control using the GetValue action in the recorder, but it just returns null?
Can this be achieved or do we need to write user methods for retrieving such properties? Examples?
/Best reards
Jari
Get property values from controls
- Support Team
- Site Admin
- Posts: 12145
- Joined: Fri Jul 07, 2006 4:30 pm
- Location: Houston, Texas, USA
- Contact:
Re: Get property values from controls
Hi Japise,
Normally it should not be a problem to access this property. From which object to you retrieve the “Width”-property? Please check your object. Maybe the value of the property is zero?
If have created a small sample where I retrieve the width of a “CheckBox”. Stored the value in a variable and logged it to the Report.
Regards,
Robert
Normally it should not be a problem to access this property. From which object to you retrieve the “Width”-property? Please check your object. Maybe the value of the property is zero?
If have created a small sample where I retrieve the width of a “CheckBox”. Stored the value in a variable and logged it to the Report.
Regards,
Robert
You do not have the required permissions to view the files attached to this post.
Re: Get property values from controls
I'm trying to fetch the value from a column header (Thirdparty grid called flexgrid). The value I'm interested in is the Size property found in the detail tab. Getting null when trying to reference it in the GetValue method Assumed it was a control based on the properties in the detail section.
/J
/J
You do not have the required permissions to view the files attached to this post.
Re: Get property values from controls
I think you are getting null because "Size" as you have highlighted in your screen print is just redisplaying the width and height properties. If you switch to the Overview tab, you will probably see the Size property is blank.
You need to get the Width and Height directly as Robert shows in his screen print. You can also modify your code with something like:or
You need to get the Width and Height directly as Robert shows in his screen print. You can also modify your code with something like:
Code: Select all
Cell.Element.GetAttributeValue("width")
Code: Select all
Cell.Element.Size.Width
Re: Get property values from controls
Thanks for the quick response! I tried the code and it seems that there's only the size property available in the class, since running:
returns null, while
returns the value.
I would guess that there is no support for accessing sub-properties by using the GetValue action (like "Size.Width")?. So this needs to be made a user method in this case.
/J
Code: Select all
Cell.Element.GetAttributeValue("width")
Code: Select all
Cell.Element.Size.Width
I would guess that there is no support for accessing sub-properties by using the GetValue action (like "Size.Width")?. So this needs to be made a user method in this case.
/J
-
- Posts: 30
- Joined: Mon Jan 21, 2013 1:31 pm
Re: Get property values from controls
Hai Japise,
You should use instead of Cell.Element.GetAttributeValue("width") to get the width.
GetAttributeValueText will retrieve the value of the attribute specified in the quotes.
Regards,
Amiruddin, Indium software - Automation COE
You should use
Code: Select all
Cell.Element.GetAttributeValueText("width")
GetAttributeValueText will retrieve the value of the attribute specified in the quotes.
Regards,
Amiruddin, Indium software - Automation COE