Модифицированный метод ожидания:
public WebDriverWait wait_sec(WebDriver driver, int sec) {
return new WebDriverWait(driver, sec);
}
Управление веб-элементами:
public WebElement get_element_by_classname (WebDriver driver, String classname) {
WebElement element = driver.findElement(By.className(classname));
return element;
}
public WebElement wait2element_and_get_element_by_xpath (WebDriver driver, String xpath) {
WebElement element = wait_sec(driver, 20).until(ExpectedConditions.elementToBeClickable(By.xpath(xpath)));
return element;
}
Использование:
@Test
public void update_x() {
get_element_by_classname(driver, "row-title").click();
wait2element_and_get_element_by_xpath(driver, ".//*[@id='menu-posts-presentation']/a/div[3]").click();
}