我是Selenium / Java的新手
以下是HTML / JavaScript代码。
<span j:bind=“appProp.UserFor(‘user.subscription.type', element)">Yes</span>
在自动化测试案例中,如何找到并点击“是”&#39;使用Selenium和Java?
答案 0 :(得分:0)
您可以使用j:bind
属性
driver.findElement(By.xpath("//span[j:bind='appProp.UserFor(‘user.subscription.type', element)'][text()='Yes']")).click();
或使用contains
driver.findElement(By.xpath("//span[contains(j:bind, 'user.subscription.type'][contains(text(), 'Yes')]")).click();
答案 1 :(得分:0)
使用以下xpath
//OPEN NOW
$now = new \DateTime("NOW");
$day = strtolower($now->format('l'));
$time = $now->format('Hi');
$openNowAgg = new \ONGR\ElasticsearchDSL\Aggregation\FilterAggregation('open_now');
$openScript = new \ONGR\ElasticsearchDSL\Query\ScriptQuery("days_open = _source.days_open; for (day in days_open) { if (day.dotw == '{$day}' && day.open < '{$time}' && day.close > '{$time}') { return true; }}; return false;");
$openNowAgg->setFilter($openScript);
$search->addAggregation($openNowAgg);