登录页面后,我找不到用于单击选项卡的正确定位器
HTML:
<td title="Maintenance" id="c1_tab3" class="tabTab noselect tabSelectedTab" onclick="getcontrol( 'c1').setvalue(3);">Maintenance</td>
测试:
@Test
public void Case1() {
driver.navigate().to(URL);
//driver.findElement(By.linkText("Transcode Service")).click();
driver.findElement(By.id("c1_tab3")).click();
错误:
FAILED: Case1 org.openqa.selenium.NoSuchElementException: no such element: Unable to locate element: {"method":"id","selector":"c1_tab3"} (Session info: chrome=70.0.3538.102)
答案 0 :(得分:0)
您可以尝试以下xpath:
driver.findElement(By.xpath("//td[@id='c1_tab3' and contains(.,'Maintenance')]")).click();