Zvika Nadav Zvika Nadav - 1 year ago 75
HTML Question

Clicking span button by id of the parent(with id) - selenium with java

Is it possible to click a

button which is under the
element, also I would like to use the id of the input to make my test stable.


<div class="idit-go">
<input id="IDITForm@checkRuleVO" class="GoLong align-left idit-go-text" type="text" value="" title="Validation Rule" tabindex="257" name="unknown" ignoredisableenableaction="true" helptextinfo="" disabled="">
<div class="idit-go-buttons">
<span id="IDITForm@checkRuleVOGoClearButtonClear" class="idit-go-clear" title="Clear" tabindex="259" onclick="clearField('IDITForm@checkRuleVOhidden');clearField('IDITForm@checkRuleVO');;">
<span class="fa-stack idit-go-button" value="" title="" tabindex="258" onclick="newPerformSubAction('selectRule',true);">
<i class="fa fa-stack-1x fa-square"></i>
<i class="fa fa-stack-1x fa-ellipsis-h"></i>

How it looks on screen:


As you can see the 3 dots button to the right, that is the button I'd like to click. Thanks in advance.

Answer Source

In this case you could identify the span that has the id attribute and then just use following-sibling (from your example they seems to be on the same level).

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download