BackColor Attribute?
BackColor Attribute?
Hi,
I am using Ranorex 3.0.5.
Is there a way to access the BackColor property of a text box?
B
I am using Ranorex 3.0.5.
Is there a way to access the BackColor property of a text box?
B
Re: BackColor Attribute?
Try the below code..
Dim input_text As InputTag = layer_table.FindSingle(Of InputTag)("./input[1]")
MsgBox(input_text.GetStyle("color").ToString)

Dim input_text As InputTag = layer_table.FindSingle(Of InputTag)("./input[1]")
MsgBox(input_text.GetStyle("color").ToString)
- Support Team
- Site Admin
- Posts: 12167
- Joined: Fri Jul 07, 2006 4:30 pm
- Location: Graz, Austria
Re: BackColor Attribute?
Hi,
Have look at the Ranorex API documentation of a textbox.
The property BackColor is also provided here, you can set/get the value of BackColor.
Regards,
Martin
Ranorex Support Team
Have look at the Ranorex API documentation of a textbox.
The property BackColor is also provided here, you can set/get the value of BackColor.
Regards,
Martin
Ranorex Support Team
Re: BackColor Attribute?
The documentation indicates that BackColor is only supported by RanorexPro.
- Support Team
- Site Admin
- Posts: 12167
- Joined: Fri Jul 07, 2006 4:30 pm
- Location: Graz, Austria
Re: BackColor Attribute?
Hi,
And here you have the sample code:
Peter
Ranorex Team
Sorry, but martin has posted you the wrong link. This is the right link http://www.ranorex.com/Documentation/Ra ... eValue.htmbsing wrote:The documentation indicates that BackColor is only supported by RanorexPro.
And here you have the sample code:
Text yourTextBox = "RxPath to your Textbox"; var color = yourTextBox.Element.GetAttributeValue("BackColor");Regards,
Peter
Ranorex Team
Re: BackColor Attribute?
I tried your code ... and the first line works (I can get a valid reference to Text) .. but the 2nd line doesn't work for me (get a null returned) when trying to get "BackColor"
Re: BackColor Attribute?
bsing have to tried my piece of code
Dim input_text As InputTag = layer_table.FindSingle(Of InputTag)("./input[1]")
Dim color as string = input_text.GetStyle("backcolor").ToString
Dim input_text As InputTag = layer_table.FindSingle(Of InputTag)("./input[1]")
Dim color as string = input_text.GetStyle("backcolor").ToString
Re: BackColor Attribute?
Are you able to translate your vb code to C#? .... don't want to go down the vb path ... sorry
- Support Team
- Site Admin
- Posts: 12167
- Joined: Fri Jul 07, 2006 4:30 pm
- Location: Graz, Austria
Re: BackColor Attribute?
Hi
The C# version of bsing's vb code would be
Regards,
Martin
Ranorex Support Team
The C# version of bsing's vb code would be
Code: Select all
InputTag input_text = someTableTag.FindSingle<InputTag>("./input[1]");
string color = input_text.GetStyle("backcolor").ToString();
Martin
Ranorex Support Team
Re: BackColor Attribute?
Is InputTag used for web pages/documents?
I am using a Windows Application.
I am using a Windows Application.
- Support Team
- Site Admin
- Posts: 12167
- Joined: Fri Jul 07, 2006 4:30 pm
- Location: Graz, Austria
Re: BackColor Attribute?
Hi,
Would it be possible to send us a Ranorex Snapshot file of the specific control?
Following link will show you how to generate a snapshot file:
http://www.ranorex.com/support/user-gui ... files.html
Regards,
Markus
Ranorex Support Team
Yes, it is used for web pages as it is a html tag.Is InputTag used for web pages/documents?
Would it be possible to send us a Ranorex Snapshot file of the specific control?
Following link will show you how to generate a snapshot file:
http://www.ranorex.com/support/user-gui ... files.html
Regards,
Markus
Ranorex Support Team
Re: BackColor Attribute?
Attached snapshot of mandatory field
- Attachments
-
- mandField.rxsnp
- (187.93 KiB) Downloaded 239 times
- Support Team
- Site Admin
- Posts: 12167
- Joined: Fri Jul 07, 2006 4:30 pm
- Location: Graz, Austria
Re: BackColor Attribute?
Hi,
to get your background color out of your control you can use following code snippet:
Tobias
Ranorex Support Team
to get your background color out of your control you can use following code snippet:
Text text = "/form[@controlname='frmMain']/container/container/element/container/container/text[@controlname='txtDetails']"; Color color = (Color) text.As<Control>().GetPropertyValue("BackColor");Regards,
Tobias
Ranorex Support Team
Re: BackColor Attribute?
I tried using this code, but the 'GetPropertyValue' method was not available.
I got the error after compiling 'System.Windows.Forms.Control' does not contain a definition for 'GetPropertyValue' .... etc.
I am using Ranorex v3.0.5 .... do I need to upgrade to say 3.2.1??
I got the error after compiling 'System.Windows.Forms.Control' does not contain a definition for 'GetPropertyValue' .... etc.
I am using Ranorex v3.0.5 .... do I need to upgrade to say 3.2.1??
Re: BackColor Attribute?
Try declaring your Text object as Ranorex.Text.
Code: Select all
Ranorex.Text text = "/form[@controlname='frmMain']/container/container/element/container/container/text[@controlname='txtDetails']";
Color color = (Color) text.As<Control>().GetPropertyValue("BackColor");
If this or any response has helped you, please reply to the thread stating that it worked so other people with a similar issue will know how you fixed your issue!
Ciege...
Ciege...