Verify selected value in dropdown

Hi,

I am using Katalon Recorder and I have a problem and I need your help.

I would like to either :

  1. capture the selected value from a dropdown list and compare it to an expression.
    UI_DropdownExampleOpen

  2. to be able to do it all in 1, i.e. check directly the correspondence of the selected value with another one.

Here is what I had in mind but I can’t get the desired result.

storeEval | document.getElementById("select2-motifCollection_0_label-container").texContent; | text

if | ${text} = 'Option A'|
.............
endif | |

Thanks

How about:
if | ${text} == 'Option A'|

Using 1 equal sign is an equate, meaning ${text} now holds the contents ‘Option A’.
Using 2 equal sign is a comparison, meaning does ${text} holds contents that is the same as ‘Option A’.