'How to click on a Label without identification
I have a javascript controlled switch "button" with the following structure:
<span class="customSwitch">
<label tabindex="0" class="selected-option">Relative</label>
<label tabindex="0">Absolute</label>
</span>
And looking for a way to click on Absolute label with Protractor
Solution 1:[1]
Another method you can use to solve this issue is by creating a custom XPath for this label which will be like this
element(by.xpath("//span[@class='customSwitch']//label[contains(.,'Absolute')]").click();
Hope this helps to resolve the issue
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | sarath |
