我有此代码:
<ul class="changed each time" data-auto="timeSlots" aria-label="Choose party time">
<li datetime="2019-06-03T14:30" offset="-30" type="standard">
<button offset="-30" role="link">2:30 pm</button>
</li>
<li datetime="2019-06-03T14:45" offset="-15" type="standard">
<button offset="-15" role="link">2:45 pm</button>
</li>
<li datetime="2019-06-03T15:00" offset="0" type="standard">
<button offset="0" role="link">3:00 pm</button>
</li>
<li datetime="2019-06-03T17:30" offset="150" type="standard">
<button offset="150" role="link">5:30 pm</button>
</li>
<li >
<button disabled="" role="link"></button></li>
</ul>
我正在使用Laravel Dusk和 如何根据日期时间属性单击按钮?
我尝试过:
$browser->click($browser->element('li[datetime="2019-06-03T15:00"]'))->pause(2000);
但我遇到了错误:
ErrorException(E_WARNING)preg_match()期望参数2为 字符串,给定对象
是否可以点击属性?
答案 0 :(得分:0)
这有效:
$btn = $browser->element('YOUR_SELECTOR');
$btn->click();