量角器如何为非角度站点选择单选按钮

时间:2014-11-14 05:01:59

标签: angularjs protractor

我想在E2E测试中为非角度站点选择第二个单选按钮。如何选择单选按钮?

<blockquote>
        <label>
            <input type="radio" name="id" value="jo" onclick="form.submit(); return false;”>radio 1
        </label>
        <br>
        <label>
            <input type="radio" name="id" value="go" onclick="form.submit(); return false;" checked=“”>radio 2
        </label>
        <i>(some extra test)</i>
        <br>
        <label>
            <input type="radio" name="id" value="jw" onclick="form.submit(); return false;”>radio 3
        </label>
        <br>
        <br>
    </blockquote>

我试过这个

var rB browser.driver.findElements(By.xpath("//input[@value='go']")); 
but
 rB.click() says
 Message: TypeError: Object [object Object] has no method 'click' Stacktrace: TypeError: Object [object Object] has no method 'click' at [object Object].<anonymous> (/Library/WebServer/Documents/youman/test/spec/spec/example_spec.js:53:11) ==== async task ==== Asynchronous test function: it() Error at [object Object].<anonymous> (/Library/WebServer/Documents/youman/test/spec/spec/example_spec.js:49:4) at Object.<anonymous> – 

1 个答案:

答案 0 :(得分:0)

根据alexce,使用findElement()而不是findElement s ()