I am using the below attributes :
To click on one of the following options given:
How can I handle the fact that ‘class’ changes for the activated option? How to select the ‘-0.5 mm’ option here, no matter if activated or not.
Thanks in advance,
Lukas
kat2.PNG
kat.PNG
You can use xpath selector
//span[contains(., '-0.5 mm')]
Thank you for the answer, using your suggestion
//span[contains(., ‘-0.5 mm’)]
selects the first option ‘-1 mm’ instead of ‘-0.5 mm’
Using (tabindex = 6, text = ‘0.5 mm’) in the attributes tab works, but I still would like to know how to express that as a xpath selector, or how to get your solution going
If you are able to use CSS and if you are able to select based on dom structure position, then you could use CSS like this:
span.option-note-options span:nth-child[2]
But I suspect you want to select by text content, i.e. -0.5
Dan
September 24, 2018, 2:06pm
5
try either:
//span[contains(., ‘-0.5 mm’)][not(contains(@class ,‘option-note-options’))]
or
//span[contains(@class ,‘option-note-options’)]/span[contains(., ‘-0.5 mm’)]
The problem is the parent span element beeing selected first when using //span[contains(., ‘-0.5 mm’)]
Dan
September 24, 2018, 2:11pm
6
or better
//span[text()=’-0.5 mm’][not(contains(@class ,‘option-note-options’))]
//span[contains(@class ,‘option-note-options’)]/span[text()=’-0.5 mm’]
as otherwise the xpath is not unique when using the value ‘0.5 mm’