需要点击按钮

问题描述:

我需要点击IE浏览器按钮,我已经使用这两种情况下,但没有工作对我来说 需要点击按钮

driver.findElement(By.xpath("//button[text()='Existing Customer']")).click(); 

driver.findElement(By.xpath("//*[contains(text(), 'Existing Customer')]")).click(); 

WebElement obj = driver.findElement(By.xpath("//button[text()='Existing Customer']")).click(); 

Actions act = new Actions(driver); 
act.moveToElement(obj).build().perform(); 

HTML Image

+0

在我看来,这是一个下拉菜单。可以提供以下信息:1.提供更多的HTML DOM。 2.你能确认它是否是模态下拉菜单吗? 3.提供下拉菜单的屏幕截图。 – DebanjanB

代替“button”标签,您可以使用*符号,它可以代表任何标签。

driver.findElement(By.xpath("//*[text()='Existing Customer']")).click(); 

[或]

WebElement obj = driver.findElement(By.xpath("//button[text()='Existing Customer']")); 

Actions act = new Actions(driver); 

act.doubleClick(obj).build().perform();