I'm a very new for Xebium
.
I cannot use
| ensure | do | click | on | id=text |
to click on a checkbox because it is a label, id is look like hidden. So, is there any way to click from label?
thank you for your suggestion :)
I'm a very new for Xebium
.
I cannot use
| ensure | do | click | on | id=text |
to click on a checkbox because it is a label, id is look like hidden. So, is there any way to click from label?
thank you for your suggestion :)
You can use Xpath to find your desired element. If you have the following structure of your form
:
<form action="target.html">
<label for="male">Male</label>
<input type="checkbox" name="sex" id="male" value="male"><br />
<label for="female">Female</label>
<input type="checkbox" name="sex" id="female" value="female"><br />
<br/>
<input type="submit" value="Submit">
</form>
, then you could the following Xebium
command to click on the label with Female
as value:
| ensure | do | click | on | xpath=(//label[contains(text(),'Female')]) |
You can also use the following command, if you want to click in the check box that is coupled to a specific label:
| ensure | do | click | on | xpath=(//input[contains(preceding-sibling::label/text(),'Male')])|
If your label tag is after your input tag, you have to change preceding-sibling
to following-sibling
.
Note; you can try this out on w3schools xpath examples. That example uses radio buttons instead of check boxes. Since the example occurs in an iFrame
, you have to move into the frame by selectFrame|iframeResult
.