TestStack / TestStack.Seleno

Seleno helps you write automated UI tests in the right way by implementing Page Objects and Page Components and by reading from and writing to web pages using strongly typed view models.
http://teststack.github.com/TestStack.Seleno/
MIT License
180 stars 60 forks source link

DropDown.SelectElementByText does not trigger change event #220

Open brunoshine opened 8 years ago

brunoshine commented 8 years ago

Hi,

when using the DropDown.SelectElementByText the change event on the client-side is not triggered. A simple change to the TestStack.Seleno/PageObjects/Controls/DropDown.cs method change can fix this:

From: var scriptToExecute = string.Format("$('#{0} option:contains(\"{1}\")').attr('selected',true)", Id, optionText.ToJavaScriptString());

To: var scriptToExecute = string.Format("$('#{0} option:contains(\"{1}\")').attr('selected',true).change()", Id, optionText.ToJavaScriptString());

Cheers, Bruno

robdmoore commented 8 years ago

There are other events that don't get triggered too, but I agree that change is the most important and this has annoyed me in the past.

You can overcome it by dropping down to Selenium Web Driver, but that code's not as nice of course.

I'm happy for you or someone else to submit a pull request to add the change() call.