Skip to content
This repository was archived by the owner on Nov 29, 2018. It is now read-only.
This repository was archived by the owner on Nov 29, 2018. It is now read-only.

onchange js event fired in WebElement.clear() and WebElement.sendKeys() #214

Description

@lukeis

Originally reported on Google Code with ID 214

Browser: Firefox, perhaps others
Version: Firefox 3.0.11
Operating System: Vista

What steps will reproduce the problem?
1. HTML Page has a text input with an onchange event
2. Changing the input's value either with clear() or sendKeys(...) fires
the onchange javascript event.

What is the expected output? What do you see instead?

The browser user behaviour I am trying to reproduce is changing the
text in a text input.   So normally, I can call WebElement.clear() and
then WebElement.sendKeys("...").

The problem comes when the text input has an onchange js event,
because both "clear" and the "sendKeys" trigger the onchange event.
This means, I can't avoid it being called twice.

When I use firefox manually, the onchange event is fired just once,
when I click out of the text field.

What makes the problem even worse, is that sometimes, the application
I'm testing submits the form in the onchange event.   I know it's a
horrible design - but that's what I've got.



What version of the product are you using? On what operating system?

1039 also happens in earlier versions



Please provide any additional information below.

This has been discussed in mailing list item "how to change the value of a
text field when it has an onchange event." and issue 156

Using Keys enum in sendkeys is a good workaround


Reported by jjimjam on 2009-06-26 13:12:35

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions