根据twitter bootstrap,这是我们如何做广播:我们如何使用Laravel Dusk检查Twitter Bootstrap单选按钮?
<div class="radio">
<label>
<input type="radio" name="optionsRadios" id="optionsRadios1" value="option1" checked>
Option one is this and that—be sure to include why it's great
</label>
</div>
这是我的代码:
$browser->click('#menu-reports')
->waitForText('Users')
->click('#menu-reports-users')
->radio('sitesActive', '2')
->radio('includeDisabled', '2')
->radio('includeNonCertifiable', '2')
->press('Apply')
->waitForText('Showing 0 to 0 of 0 entries')
;
带标签的标签内部的输入。但问题是,黄昏(实际上是Facebook Webdriver)无法以这种方式找到它。它不断提高:
Facebook\WebDriver\Exception\ElementNotVisibleException: element not visible
为了使它工作,我已经把输入的标签之外,但后来,当然,自举无线电不显示,因为它应该了。
<div class="radio">
<input type="radio" name="optionsRadios" id="optionsRadios1" value="option1" checked>
<label>
Option one is this and that—be sure to include why it's great
</label>
</div>
不使用IDS的工作,要么:
甚至不是一个ID设置为输入:
<input
type="radio"
name="sitesActive"
id="sitesActive3"
value="2"
>
,并试图选择这种方式:
->radio('#sitesActive3', '2')
的问题在于黄昏(Webdriver)甚至无法看到页面中的元素,因为这种简单的方式与以完全相同的方式失败:
$browser->waitFor('#sitesActive3');
,导致:
Facebook\WebDriver\Exception\TimeOutException: Waited 5 seconds for selector [#sitesActive3].
而且出现这种情况每次我有一个表格时,与输入一个标签围绕着它,如果我把输入了标签,它的工作原理。但是收音机并不是那么简单,因为它与其他一些输入,无线电一样。
这是一个正确编码电台:
这是与标签标签外部的输入无线电:
那么,你怎么做呢?
会很奇怪,因为我必须为每个收音机添加一个类'.myRadioClass1; .myRadioClass2',但我尝试了类似于ids的方式:'',并且执行了' - >点击('#radio1')',但它不起作用 –
我尝试了类的事情,它似乎工作 - 但你是对的,每个元素添加一个单独的类可能会很烦人。我期待着看到还有什么其他的建议。 – CaraGee