Hello!
So, at the moment PA desktop lacks directives for OR and AND. That can still be done (when checking for values on variables and things like that) by comparing everything on the first operand and then to "true" on the second one.
However, what if you need to check for two elements on the web page? I haven't been able to find how to build an expression sort of like
%Browser.Contains(UIElementButton0)%
or something like that.
Any workaround would be appreciated in any case.
Thanks in advance!
Solved! Go to Solution.
Hi @TPDBS
I suggested working with nested If's statements because your original question mentions two elements.
With more than 2 elements, an idea is using variables as flags and then compare those variables within Case/Switch options.
For example, first you set the variables as result of existing elements:
1. 'If web page contains' element A then
2. 'Set variable' %FlagA% to 1
3. 'End' if
4. 'If web page contains' element B then
5. 'Set variable' %FlagB% to 1
6. 'End' if
7. 'If web page contains' element N then
8. 'Set variable' %FlagN% to 1
9. 'End' if
and so on
Then, concatenate these variables into a new one:
10. 'Set variable' %Test% as %FlagA%%FlagB%%FlagN% (this gives you 111 or 101 for example)
At last, use Switch/Case to define situations and actions:
11. 'Switch', value to check= %Test%
12. 'Case' =110
13. (Your actions here)
14. 'Case =101
15. (Your actions here)
...
Hi @TPDBS
Not sure if I got your question correctly, but if you need something like %Browser.Contains(UIElementButton0)%, you can start with 'If web page contains' conditional and select the web element you want.
Conditionals - Power Automate | Microsoft Docs
To emulate 'AND' and 'OR', work with nested conditionals. For example:
AND:
1. 'If web page contains' element A
2. 'If web page contains' element B
3. [Actions if true+true]
4. 'End' if
5. 'End' if
OR:
1. 'If web page contains' element A
2. Go to Actions
3. 'Else'
4. 'If web page contains' element B
5. Go to Actions
6. 'End' if
7. 'End' if
Hi @yasunm02
Thank you for you answer. But yeah that's precisely what I'm trying to avoid. If you need to check 3 or 4 elements it becomes increasingly complicated.
Hi @TPDBS
I suggested working with nested If's statements because your original question mentions two elements.
With more than 2 elements, an idea is using variables as flags and then compare those variables within Case/Switch options.
For example, first you set the variables as result of existing elements:
1. 'If web page contains' element A then
2. 'Set variable' %FlagA% to 1
3. 'End' if
4. 'If web page contains' element B then
5. 'Set variable' %FlagB% to 1
6. 'End' if
7. 'If web page contains' element N then
8. 'Set variable' %FlagN% to 1
9. 'End' if
and so on
Then, concatenate these variables into a new one:
10. 'Set variable' %Test% as %FlagA%%FlagB%%FlagN% (this gives you 111 or 101 for example)
At last, use Switch/Case to define situations and actions:
11. 'Switch', value to check= %Test%
12. 'Case' =110
13. (Your actions here)
14. 'Case =101
15. (Your actions here)
...
Learn to digitize and optimize business processes and connect all your applications to share data in real time.
Read the latest about new experiences and capabilities in the Power Automate product blog.
At the monthly call, connect with other leaders and find out how community makes your experience even better.
User | Count |
---|---|
24 | |
7 | |
4 | |
2 | |
2 |
User | Count |
---|---|
46 | |
10 | |
9 | |
5 | |
5 |