Java code to click Submit button and confirm alert

public String clickSubmitWithAlert(WebDriver driver, WebDriverWait wait, String xpath)
{
WebElement webel = driver.findElement(By.xpath(xpath));
JavascriptExecutor executor = (JavascriptExecutor)driver;
executor.executeScript("arguments[0].click();", webel);
wait.until(ExpectedConditions.alertIsPresent());
String alertText = driver.switchTo().alert().getText();
driver.switchTo().alert().accept();
return alertText;
}

Web element