You shpould be clicking the Button tag adn not the span tag, please use the below locator: WebElement submit = driver.findElement(By.xpath("//span[contains(text(),'Submit')]/..")