I want to automate a process that consists in adding badges to employee profiles in a web portal. When the employee doesn’t have any badge assigned, only the empty field appears to add the badge. If the user has one badge assigned, it appears the field with the badge in first place and an empty field in second place. If the user has two badges assigned, the first two fields have the badges on them and the third field is the empty one, and so on.
My question is, how can I validate which is the empty field to type in and not overwrite the ones that have values.
Is the “else if” activity the correct option approach this? If yes, how can I structure it? If not, please feel free to provide your suggestions.
Hi Ruben.
First you need to better identify the “empty field” and how to differentiate it from the field with the badge.
With that, you create a new selector for the empty field only and work with that.
Yes, I have identified them, the thing is that the 2nd, 3rd fields and so on don’t appear if the user doesn’t have a badge(s) assigned. My idea is that I have to validate using “if/else if” whether the field(s) are empty.
Something like:
Else If
condition: field 1 is empty
type into field 1
Else If
condition: field 1 is not empty and field 2 is empty
type into field 2
and so on
Ideally what you can use is a selector which contains innertext…as the innertext is emptyfor the empty one and filled for the one with filled…it is differentiated and you need not use if conditions and all instead directly use the selector with tag and innertext empty to get the first empty field