質問

I been trying to click on a link with class "selectable" without success.

The html code is as display below:

<div class="form-group">
    <label for="txtEmail">Email</label>
    <label class="selectable col-xs-offset-2">
        <input type="checkbox" id="chkNoEmail" data-bind="checked: noEmail, attr: { 'disabled': baseController.readonly() }">
    </label>
    <a class="selectable" data-toggle="popover" data-bind="click: baseController.noEmailClicked, popover: { title: '', customClass: 'popover-lrg popover-alert', contentHtmlId: 'noEmailAlert', onlyIf: function () { return noEmail() } }" data-original-title="" title="">no email</a>
    <input type="text" class="form-control" id="txtEmail" placeholder="Email" data-bind="value: email, attr: { 'disabled': noEmail() || baseController.readonly() }"><span class="validationMessage" style="display: none;"></span>
</div>

I have try using the parent div and also using

browser.selectable(:text, /no email/).click 

and

browser.selectable(:text, /no email/).fire_event("onclick") but not success.
役に立ちましたか?

解決

I would try something like this.

@browser.div(:class => "forum-group").label(:class => "selectable").check

However, I am not sure you can do a ".check" on a label element. You could also try

@browser.div(:class => "forum-group").checkbox(:id => "chkNoEmail").check

Or, since I dont think it is an actual check box, you could try ".click" instead of ".check" on either one of them, I still do not think you can do either action on a label element though.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top