Reputation: 231
My chrome version is Version 68.0.3440.106 selenium version is 3.13. Below is code snippet.
Tried using the normal Xpath and Java script execution as well. Still no luck please help with this.
I am trying perform click action on the below button name " Submit"
driver.findElement(By.xpath("//button[@type='submit'and @class='btn wb-btn-default center-block']")).click();
WebElement ele = driver.findElement(By.xpath("//button[@type='submit'and @class='btn wb-btn-default center-block']"));
JavascriptExecutor js = (JavascriptExecutor)driver;
js.executeScript("arguments[0].click()", ele);
JavascriptExecutor js1 = (JavascriptExecutor)driver;
js1.executeScript("arguments[0].click()", "//button[@type='submit'and @class='btn wb-btn-default center-block']");
Upvotes: 1
Views: 654
Reputation: 176
Try Below Code, As per your summary I understood button name is Submit, in case it is different, please replace the actual text in contains section of Xpath:
driver.findElement(By.xpath("//button[@type='submit' and contains(text(),'Submit')]")).click();
Upvotes: 1