@Test
public void searchandSelectProduct() throws Exception
{
Actions action = new Actions(driver);
WebElement mainMenu = driver.findElement(By.xpath("
(//li[@id='categories']/a/span)[2]"));
action.moveToElement(mainMenu).moveToElement(driver.findElement
(By.xpath("//li[@id='categories']/ul/li[10]/a/span")))
.click().build().perform();
WebDriverWait wait = new WebDriverWait(driver, 10);
element = wait.until(ExpectedConditions.elementToBeClickable(By.id("kAdd to
cart")));
element.click();
}
我已经使用HTML SPAN元素来标识该元素。谁能帮助我找出如何在不使用span作为元素的情况下运行此代码。