Замените свою находку
WebElement we4 = driver.findElement(By.xpath(property.getProperty("Intouch")));
на
private WebDriverWait wait_element;
wait_element = new WebDriverWait(driver, 40);
WebElement we4 = wait_element.until(ExpectedConditions.presenceOfElementLocated(By.xpath(property.getProperty("Intouch"))));
Second, Thread.sleep ();плохая практикаЯ несу с собой эти вспомогательные методы от проекта к проекту.Вы можете использовать их.
public void waitForBrowserReadystateComplete(WebDriver webDriver) {
for (int a=0; a<20; a++) {
JavascriptExecutor javascriptExecutor = (JavascriptExecutor) webDriver;
if (javascriptExecutor.executeScript("return document.readyState")
.toString().equals("complete")) {
break;
}
sleepResponsibly(500);
}
}
public void sleepResponsibly(int timeMillisecond){
try{
Thread.sleep(timeMillisecond);
} catch (InterruptedException ex) {
Thread.currentThread().interrupt();
throw new RuntimeException(ex);
}
}
/**
*
* @param webDriver
* @param elementToScrollIntoView
* @param blockOption - If true, the top of the element will be aligned to the top of the visible area of the scrollable ancestor.
* If false, the bottom of the element will be aligned to the bottom of the visible area of the scrollable ancestor
*/
public void explicitScrollIntoView(WebDriver webDriver, WebElement elementToScrollIntoView, boolean blockOption) {
final String scriptStr = "arguments[0].scrollIntoView(" + blockOption + ");";
((JavascriptExecutor) webDriver).executeScript(scriptStr, elementToScrollIntoView);
sleepResponsibly(500);
}