I have faced a critical problem in my work. I have passed 2 days but can not solve it. I have used several options but not working in automation but working in manual processes. I know I am wrong but can not find it. I also use explicit and implicit wait.
I used the following code to submit a form.
By btnSubmit = By.id("btnSubmit");
driver.findElement(btnSubmit).click();
driver.findElement(btnSubmit).submit();
javaScript.executeScript("arguments[0].click();", driver.findElement(btnSubmit));
public Object executeScript(String script, Object... args) {
JavascriptExecutor js = (JavascriptExecutor) driver;
return js.executeScript(script, args);
}
javaScript.executeScript("document.getElementById('btnSubmit').setAttribute('class','btn-small');");
this code added class in "btnSubmit".
But click not working. If you have time would you please give me feedback. I have attached some scenarios.
Do not worry about console error, I have checked when I do manual click on submit button, it works.