0

我正在使用带有bootstrap-vue 的VueJS ,并使用Laravel Dusk,我需要通过单击它们来测试复选框。有两种类型的复选框组:选中和默认。默认值取决于在选定复选框组中所做的选择。每个复选框组都有许多具有相同名称但值不同的复选框元素。

如何单击具有特定值的特定复选框?

/**
* rendered html
*/

    <div
        role="group"
        tabindex="-1"
        aria-required="true"
        class="btn-group-toggle btn-group btn-group-sm bv-no-focus-ring"
        id="__BVID__175"
    >
        <label class="btn btn-secondary btn-sm"
            ><input
                type="checkbox"
                name="select_optionName"
                required="required"
                autocomplete="off"
                aria-required="true"
                class=""
                value="P"
                id="__BVID__175_BV_option_0"
            />
            <span><i title="Pass"> P </i></span>
            </label
        ><label class="btn btn-secondary btn-sm"
            ><input
                type="checkbox"
                name="select_optionName"
                required="required"
                autocomplete="off"
                aria-required="true"
                class=""
                value="F"
                id="__BVID__175_BV_option_1"
            />
            <span><i title="Fail"> F </i></span>
            </label
        >
    </div>

/// dusk

    $browser->assertSee('SelectionName')
                    ->check("input:checkbox[name='select_optionName'][value='P']");

我试过这个但得到错误“Facebook\WebDriver\Exception\InvalidSelectorException:无效选择器:指定了无效或非法选择器”

4

0 回答 0