Navigation

    OpenIAP

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups

    Handling Enabled/Disabled Element

    General Discussion
    3
    8
    47
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • V
      Victor Andres Pelaez Guzman last edited by

      Hi everyone! Has anybody dealed with handling disabled buttons in a website? I am trying to do multiple transactions in a website, but they have applied a loading control where the Buy Button appears greyed out (in the inspect element in chrome appears as disabled). How can I wait until it is enabled again? I have tried setting True in Wait for Ready in Get Element, but it doesn't help.

      buy button.png

      buy button greyed.png

      Thanks for the help!!

      Allan Zimmermann 1 Reply Last reply Reply Quote 0
      • Allan Zimmermann
        Allan Zimmermann @Victor Andres Pelaez Guzman last edited by

        @victor-andres-pelaez-guzman you can check if they disable using disabled property or a class. And then check for that. Either by creating a xpath that check for the property and set a high timeout onget element. Or create a while loop getting the element multiple times and check the propery. First option is proberly best,but harder to do.

        V 1 Reply Last reply Reply Quote 1
        • V
          Victor Andres Pelaez Guzman @Allan Zimmermann last edited by

          @allan-zimmermann said in Handling Enabled/Disabled Element:

          xpath

          Thank you so much for the reply! Yeh in fact I have noticed that they do use the "disabled" property. How would that xpath work? Would I need to use the Get Element and set the xpath for the button and wait or would I need to set the xpath to look for the specific property? Sorry for the foolish question!

          Allan Zimmermann 1 Reply Last reply Reply Quote 0
          • Allan Zimmermann
            Allan Zimmermann @Victor Andres Pelaez Guzman last edited by Allan Zimmermann

            it's not foolish ... So if you get an element with Get Element in chrome, you can check the value of each attribute using item.Attributes, something like
            ec5e8019-c37e-4b99-8fed-dcb4fcae48b0-image.png
            But that means you have to keep calling get element and check the value of item.Attributes
            You can do the same using an xpath, so if the xpath is

            "xpath": "//button[@id='buyatm']"
            

            you can add a check for a specific value on one more attribute, using

            "xpath": "//button[@id='buyatm'][@disabled='false']"
            

            thou I don't think they are setting it to false, I guess they are removing it, so we could check for "it not true" with

            "xpath": "//button[@id='buyatm'][not(@disabled='true')]"
            

            or check that the attribute does not exists at all, with

            "xpath": "//button[@id='buyatm'][not(@disabled)]"
            

            You need to play around with what works for you ...
            So the idea is "get element" will not find anything while the button is disabled, so if you set a long timeout, get element will keep trying until the button is no longer disabled, and then you flow continues. ( and therefor you do not need to make the whole loop logic )

            A V 2 Replies Last reply Reply Quote 1
            • A
              axel.rp @Allan Zimmermann last edited by

              I currently have to deal with a possibly disabled button on a window (not the Browser) and there seems to be no disabled property. The Selector looks like this:

              ...
                {
                  "ClassName": "UpdatePublicationShellView",
                  "ControlType": "Custom",
                  "FrameworkId": "WPF"
                },
                {
                  "ClassName": "Button",
                  "Name": "Next",
                  "ControlType": "Button",
                  "FrameworkId": "WPF"
                }
              ]
              

              How can I check if the button is disabled if it has no such property? Can I prevent OpenRPA (used offline) from giving an error message and click some other button instead?

              Allan Zimmermann 1 Reply Last reply Reply Quote 0
              • Allan Zimmermann
                Allan Zimmermann @axel.rp last edited by

                @axel-rp It does not click another button after throwing an error. If it clicks the wrong button, your selector is to broad. If it clicks a button after a workflow has failed, that is a bug. Then please create a sample workflow and upload, so i can see why that is happening.
                The windows selectors does not have access to disabled, so you need to create your own loop to check the status of the item.RawElement.IsEnabled property

                A 1 Reply Last reply Reply Quote 0
                • V
                  Victor Andres Pelaez Guzman @Allan Zimmermann last edited by

                  @allan-zimmermann thanks a lot for the reply!

                  I did exactly what you mentioned and it is working perfectly. Also I was playing around with the Get Element - item.disabled and it also does return a boolean when the button is disabled or not, both seem to be working pretty well!! I hope this helps other people!! Thanks again Allan!

                  1 Reply Last reply Reply Quote 0
                  • A
                    axel.rp @Allan Zimmermann last edited by axel.rp

                    @allan-zimmermann
                    I think there was a small misunderstanding here with respect to my question but you basically answered it: I need to check the item.RawElement.IsEnabled property if it is a windows button. This will hopefully enable me to establish the behaviour which I want.

                    1 Reply Last reply Reply Quote 1
                    • Locked by  A az 
                    • First post
                      Last post