1

My form (which is inside a dropdown menu) has 3 dropdowns (select option) and 2 texts input. This form is used to apply filters to a list of items. I am able to fill my inputs and to select my options without the use of a JavascriptExecutor, it works fine with .sendKeys("Text") for text inputs and sendKeys(Keys.ARROW_DOWN) for the dropdown options.

But, when I do btn.submit() or btn.sendKeys("\n") or btn.sendKeys(Keys.ENTER) or btn.click(), it clicks the button and the dropdown menu which contains the form disappears, but the page doesn't refresh. So I am able to click the button with selenium (and even if I force it manually I cannot click the submit button, but the button does not trigger anything.

I have been stuck on this issue for 3 days. I tried to find the answer to my problem but the IEDriver click issue's solution seems to be the diagnostic but it is not, because I am able to click the button.

Also, when I do the same tests on chrome using the chromedriver, everything works fine.

When I launch IE myself, navigate to the form, fill it in myself and submit it, everything works fine. So, the problem is when I insert data with java, it "disables" the submit button.

Using Kendo UI in IE11, IEDriverServer 64x 3.0.0 (also tried 32x ver.), Java JDK 1.8.0_25 in Windows 10 Pro

I set these capibilities to my IE driver

cap.setCapability("nativeEvents", false);
cap.setCapability("unexpectedAlertBehaviour", "accept");
cap.setCapability("ignoreProtectedModeSettings", true);
cap.setCapability("disable-popup-blocking", true);
cap.setCapability("enablePersistentHover", true);

I have been using selenium for only two weeks but I am very familiar with Java. I read that IE has difficulties with forms here but they do not suggest a fix or a workaround.

Antoine
  • 800
  • 3
  • 14
  • 29
  • Looking at my cucumber, I found out that it's when I fill in the second text input that we can no longer submit the form. What's weird is that the first and second text inputs use the same java methods. I still don't know what it is exactly that prevents the submit button from working. – Antoine Feb 02 '17 at 19:21
  • Have you tried using `Select` to deal with dropdowns? It's probably not the best practice to use arrowdown, etc. to select options. This may solve your problem. When you are repro'ing manually, are you using the keyboard like your script does? – JeffC Feb 02 '17 at 19:29
  • Thank you for taking the time to answer @JeffC . Yes I have tried but it was not working. Now My 3 dropdowns work (manually and with script) and my first text input works too (manually and with script) Though as soon as soon as I try to fill the second text input with script, my submit button no longer works. For both text input, I use `textField.sendKeys(textStr);` so I don't understand why it works for one and not for the second one. It inserts the text in it and I can see it but after I can't submit the form. – Antoine Feb 02 '17 at 19:42
  • Even if I do `js.executeScript("value:arguments[0].value = \'" + textStr + "\';", textField);`, it changes the text in the input but it will not let me submit the form. – Antoine Feb 02 '17 at 20:41

1 Answers1

0

After hours and hours trying to fix the second input in the form, the only way I was able to make it work is with a Robot Object.

I used this thread to help me convert my strings into robot.keyPress(KeyEvent.VK_EXAMPLE); and send them to the input. So, as soon as the form was opened, my java procedures looked like this:

    if (System.getProperty("browser").equals("ie")) {
        try {
            Robot robot = new Robot();
            //...
            //Rest of the robot code
            //...
        } catch (AWTException e) {
            throw new RuntimeException(e);
        }
    } else {
        textField.clear();
        textField.sendKeys(textStr);
    }

So every action I had to do, I did them with Robot until I sublitted the form with a btn.click(); on the fom

Community
  • 1
  • 1
Antoine
  • 800
  • 3
  • 14
  • 29