menu
Channels
# All channels
view-forward
# General
view-forward
# Meta
view-forward
# News
view-forward
Team

Readable code to deal with "buttons" based on css, divs and spans

November 12, 2020 at 7:07pm
The Gauge community has a new home. This thread is preserved for historical purposes. The content of this conversation may be innaccurrate or out of date. Go to new community home →

Readable code to deal with "buttons" based on css, divs and spans

November 12, 2020 at 7:07pm
Hi all,
Using "click($(".options-button"))", Taiko is able to click into the gear icon but I'm looking for a more readable way to implement it, not depending on css/xpath selectors
As suggested, I used "click(listItem(toRightOf("Web Canvas")))" and unfortunately is not working for this case
I'd appreciate any suggestions at this point. Thanks!

November 13, 2020 at 7:59am
Are you also in control of the frontend code? If you are, adding a test-element name could be an easy way to get a unique selector for the button. e.g. click($('[test-element="settingsButton"]'));
Edited
  • reply
  • like
THanks (skarra) . Unfotunately, I'm not in control of the source code
  • reply
  • like
Does click(button(toRightOf(textBox("Web Canvas")))); work? My go-to in these solutions is to just try all kinds of different proximity selectors, but it's hard without the actual page available. Hope you find a working solution!
  • reply
  • like
(skarra) again, thanks for your help! The above coded is not able to detect the icon neither; I tried replacing button() by link(), listItem(), checkBox()... with no success
I'll try the remaining ones but if you think uploading the HTML code of the page would help, I can do it :)
Edited
  • reply
  • like

November 15, 2020 at 9:44pm
  • reply
  • like
Not able to find the gear button yet. I'm uploading an screenshot of the HTML just in case.
do you have any suggestion?
Thanks in advance
  • reply
  • like

November 16, 2020 at 1:59pm
As there are no proximity selectors for span your best bet is to to use either xpath or css selectors
  • reply
  • like
Ok, thank you Zabil and kskarra!
  • reply
  • like