Hi,
I would like to build a custom keyword, which validate if the given options exists in some list element.
I Selenium Library it was quite simple, because of the keyword “Get List Items”.
In Browser library exists only “Get Select Options” keyword, which returns a list of dictionaries from all list options.
Example validation keyword:
${dropdownElements} = Get Select Options ${listObject} validate [v[“label”] for v in value] in [“label1”, “label2”, “label3”]
works only, if the labels are sorted (as indexed in dictionary) and all of the list labels are given.
Example result from loop:
entry {
label: “label1”
selected: true
}
entry {
value: “Non Prod”
label: “label2”
index: 1
}
entry {
value: “Not Possible”
label: “label3”
index: 2
}
How could I make this validation more universal? I want to check if “[v[“label”] for v in value]” contains, for example, [“label3”, “label1”, “label2”] or [“label3”, “label1”]. Independent from sorting, giving not all existing options.
I have created an own validation keyword using “Get Text”, collecting and validating the text (labels) from the list options, but it’s quite expanded and want to try get something more compacted.
I will be grateful for any help and tips!