0

I want to verify an element present in screen or not and store result in variable if it is present Please check image

I want an output like true or false in a variable and return this variable to flow (Power automate)

Please suggest ideas how to do this ?

1
  • You can use store xpath count , verify element does not return any value
    – PDHide
    Aug 18 '20 at 8:17
0

I'd go for store xpath count command, and if the count is greater than 0, I'd branch off:

enter image description here

The whole example project then could look like this:

{
  "id": "a5d5aba3-56da-4de9-8815-5940deb7ef8f",
  "version": "2.0",
  "name": "test",
  "url": "https://sqa.stackexchange.com/",
  "tests": [{
    "id": "e8f3cd72-4b61-4589-8790-a347a1b4672f",
    "name": "title",
    "commands": [{
      "id": "d57b9a19-07dd-4451-9176-56baac24ac6e",
      "comment": "",
      "command": "open",
      "target": "https://sqa.stackexchange.com/",
      "targets": [],
      "value": ""
    }, {
      "id": "4464658a-01ff-466c-84f9-999edabae6fc",
      "comment": "",
      "command": "store",
      "target": "false",
      "targets": [],
      "value": "elementPresent"
    }, {
      "id": "b18ff269-72fe-429d-a2db-17cb48463b58",
      "comment": "",
      "command": "storeXpathCount",
      "target": "//h1",
      "targets": [],
      "value": "elementCount"
    }, {
      "id": "bf26dd6d-d5b6-4578-b072-e51d2d634132",
      "comment": "",
      "command": "if",
      "target": "${elementCount} > 0",
      "targets": [],
      "value": ""
    }, {
      "id": "be042bf2-4377-486d-b011-2a3caa551cdb",
      "comment": "",
      "command": "store",
      "target": "true",
      "targets": [],
      "value": "elementPresent"
    }, {
      "id": "53f636c1-bda3-4277-8189-8ab0852f7cdf",
      "comment": "",
      "command": "end",
      "target": "",
      "targets": [],
      "value": ""
    }, {
      "id": "602d31a2-3714-4fa5-b946-6d651c7d2c41",
      "comment": "",
      "command": "echo",
      "target": "${elementPresent}",
      "targets": [],
      "value": ""
    }]
  }],
  "suites": [{
    "id": "d2854f6d-eb8c-407b-98c4-99f7e043f86d",
    "name": "Default Suite",
    "persistSession": false,
    "parallel": false,
    "timeout": 300,
    "tests": ["e8f3cd72-4b61-4589-8790-a347a1b4672f"]
  }],
  "urls": ["https://sqa.stackexchange.com/"],
  "plugins": []
}
2
  • link in this link when we use verifyelement they mentioned as test will run even it fails but why '!statusOK' isn't working now
    – Sriranjani
    Aug 19 '20 at 6:10
  • You're right about it being a soft test. I adjusted my answer. However, I didn't make it work with !statusOK, which of course could be only my inexperience with Selenium IDE that I haven't used for about 3 years now. But I provided a working solution, it could solve your problem. If you really need !statusOK, you can turn to Google and experiement a bit.
    – pavelsaman
    Aug 19 '20 at 9:12

Not the answer you're looking for? Browse other questions tagged or ask your own question.