Hoe can I validate button within user code

Ask general questions here.
User avatar
felixk91
Posts: 34
Joined: Wed Feb 10, 2016 11:16 pm

Hoe can I validate button within user code

Post by felixk91 » Thu Mar 26, 2020 6:26 am

Hi everyone,

I am trying to validate button within menu ribbon in user code module.
The following code is to get attribute value:

Code: Select all

 
 var buttonChecked = repo.LayoutWindow.ButtonValidation.GetAttributeValue<string>("AccessibleState").Contains("Checked");
 
But this call return null.
In case I am running

Code: Select all

       
        public void Validate_ButtonValidation(RepoItemInfo buttonInfo)
        {
            Report.Log(ReportLevel.Info, "Validation", "Validating AttributeContains (AccessibleState>'Checked') on item 'buttonInfo'.", buttonInfo);
            Validate.AttributeContains(buttonInfo, "AccessibleState", "Checked");
        }
it passed.
Can someone help me to understand why GetAttrubuteValue function doesn't work for me?

I have to validate if button selected or not and then do some steps accordingly.
I added snapshot of the button.

Thanks,
Felix.
You do not have the required permissions to view the files attached to this post.

User avatar
odklizec
Ranorex Guru
Ranorex Guru
Posts: 7470
Joined: Mon Aug 13, 2012 9:54 am
Location: Zilina, Slovakia

Re: Hoe can I validate button within user code

Post by odklizec » Thu Mar 26, 2020 8:11 am

Hi,

Try to use GetAttributeValueText instead.
Pavel Kudrys
Ranorex explorer at Descartes Systems

Please add these details to your questions:
  • Ranorex Snapshot. Learn how to create one >here<
  • Ranorex xPath of problematic element(s)
  • Ranorex version
  • OS version
  • HW configuration

User avatar
felixk91
Posts: 34
Joined: Wed Feb 10, 2016 11:16 pm

Re: Hoe can I validate button within user code

Post by felixk91 » Thu Mar 26, 2020 8:32 am

Thank you odklizec for help.