There is a lot online about testing if an element exists, but i can't find anything really specific that could help in my case.
For context, I am working on a website that has certain elements in them (like a todo list).
I want to write a method/function called editItem
which filters inside a searchbar for the itemName
and then clicks on the filtered item.
The problem is, if something is already inside the searchbar for some reason I can not use the function .clear()
to clear the text inside the searchbar. So I've tried to work around that and now I am using the inbuilt "x"-button that clears the searchbar on click.
The problem here is I need to implement an if-Condition that checks if the "x"-button is shown, but I don't know how to implement this.
In pseudocode:
if (searchbar.exists) searchbar.click()