Wait for element off disable attribute


#1

Hi, i have one upload file and one disable button ( disabled = “disabled” ). if when i upload complete, button is enable .
How i can check upload is sucessfully by that button with Kantu selenium IDE .

Thank you


#2

Hi, you can use storeEval to check on the status of the button. Here is a test macro for a radiobutton:

{
  "CreationDate": "2018-5-13",
  "Commands": [
    {
      "Command": "open",
      "Target": "http://www.plus2net.com/jquery/msg-demo/radio5.php",
      "Value": ""
    },
    {
      "Command": "storeEval",
      "Target": "document.getElementById('opt1').disabled",
      "Value": "MyVarIsEnabled"
    }
  ]
}

If you want to wait for the status to change, you can put in in a while/endwhile loop and wait for the value of MyVarIsEnabled to change from true to false.


#3

Thanks you so much

Actually, I just wait for the change of button status. I used the while / endwhile loop but it did not work properly.
{
“Command”: “store”,
“Target”: “true”,
“Value”: “!errorignore”
},
{
“Command”: “while”,
“Target”: “${!statusOK}”,
“Value”: “”
},
{
“Command”: “waitForVisible”,
“Target”: “css=button#save-and-continue-upload-art-announce[disabled=‘disabled’]”,
“Value”: “”
},
{
“Command”: “endWhile”,
“Target”: “”,
“Value”: “”
},
{
“Command”: “click”,
“Target”: “id=save-and-continue-upload-art-announce”,
“Value”: “”
},
{
“Command”: “store”,
“Target”: “false”,
“Value”: “!errorignore”
}
:frowning: . I dont know why ?


#4

I don’t think waitForVisible is the right command. It waits for elements to become visible, not enabled/disabled.

Here is my test macro extended with while. It loops forever, until you click the “enable” button on the website. Then the radiobutton becomes enabled and the while loop breaks.

{
  "CreationDate": "2018-5-14",
  "Commands": [
    {
      "Command": "open",
      "Target": "http://www.plus2net.com/jquery/msg-demo/radio5.php",
      "Value": ""
    },
    {
      "Command": "comment",
      "Target": "disable for test!",
      "Value": ""
    },
    {
      "Command": "click",
      "Target": "id=b1",
      "Value": ""
    },
    {
      "Command": "comment",
      "Target": "first check",
      "Value": ""
    },
    {
      "Command": "storeEval",
      "Target": "document.getElementById('opt1').disabled",
      "Value": "MyVarIsDisabled"
    },
    {
      "Command": "while",
      "Target": "${MyVarIsDisabled}",
      "Value": ""
    },
    {
      "Command": "comment",
      "Target": "check again until enabled",
      "Value": ""
    },
    {
      "Command": "storeEval",
      "Target": "document.getElementById('opt1').disabled",
      "Value": "MyVarIsDisabled"
    },
    {
      "Command": "endWhile",
      "Target": "",
      "Value": ""
    },
    {
      "Command": "echo",
      "Target": "radio button enabled",
      "Value": ""
    }
  ]
}

#5

Yeah, thank @ulrich You have saved my soul :heart_eyes::heart_eyes::heart_eyes:
Now it’s work well
Thank you so much