0

I have a dynamic form that changes based on the results of what is selected in certain dropdowns. The submit button is also set to be disabled until there is at least one textbox with data set in it.

When I'm testing this manually, everything seems to be working ok. The disabled submit button becomes enabled when the textfields are populated.

However, when I'm testing this with Java Selenium, the submit button seems to never trigger unless I manually click the screen a few times while selenium is filling in the text fields.

What is causing this, and what can I do to make this fully automated? I tried telling selenium to click on another textfield after it is done filling in the data, but that didn't seem to work.

1 Answer 1

1

If it is required that you click in order to get the buttons to become active, it is likely that your fields require a change of focus to execute any commands in the HTML.

An easy way to simulate this in Selenium is to send

driver.switchTo().activeElement().sendKeys(Keys.TAB)

after you have finished interacting with that element. This will cause it to focus on the next element and likely will execute the Javascript to activate the submit button.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.