0

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 thanks. I have attached some scenarios.

enter image description here enter image description here enter image description here

Do not worry about console error, I have checked when I do manual click on submit button, it works.

Thanks in advanced.

  • Can you share link to the website – PDHide Nov 19 '20 at 16:39
  • Are you sure nothing happens? In the JS a checkbox is checked if checked (O_o), is it? Can't spot it on the screens. – bish Nov 19 '20 at 17:10
  • @PDHide sorry I can't. – Jubayer Shamshed Nov 19 '20 at 17:22
  • @bish when submit button clicked page load, but no page loading happen. Yes something happen, because I can add css class "btn-small". – Jubayer Shamshed Nov 19 '20 at 17:29
  • Based on your eclipse console log, it successfully clicked the "btnSubmit". I assume that it's either there's issue with your data that's why it won't proceed or that element is not really the trigger. – Millie Anne Volante Nov 20 '20 at 2:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.