This is a migrated thread and some comments may be shown as answers.

Handling Javascript-dependent (?) "HtmlSelect"

2 Answers 68 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Ricardo
Top achievements
Rank 1
Ricardo asked on 09 Feb 2012, 07:02 PM
Hello everyone!

I'm having a little issue automating this site on a particular situation. To test this, we'll need to have at least one item in the "Saved Items" list. The steps are very simple:

1) Open this page.
2) Click "Save for Later" on the right-hand side, just below the "Add to Bag" button.
3) On the top-right corner, click on "My saved items".
4) Click on "Update Size and Quantity"

Here, we have the two "HtmlSelect" in question.

What I'm trying to do is selecting a size and, after the second combobox is refreshed, select a quantity.
The thing is, I can select a size without a problem, but the site doesn't recognize the "click" and doesn't refresh the second combobox.

This is my code for clicking on the comboboxes:
var sizeDropbox = itemSaved.Find.ByXPath<HtmlSelect>("//select[1]");
var selectedSizeIndex = new Random().Next(1, sizeDropbox.Options.Count - 1);
var selectedSize = sizeDropbox.Options[selectedSizeIndex];
sizeDropbox.SelectByIndex(selectedSizeIndex);

var quantityDropbox = itemSaved.Find.ByXPath<HtmlSelect>("//select[2]");
var selectedQuantityIndex = new Random().Next(1, quantityDropbox.Options.Count - 1);
var selectedQuantity = quantityDropbox.Options[selectedQuantityIndex];
quantityDropbox.SelectByIndex(selectedQuantityIndex);

(The itemSaved object is the TableRow parent element)

Can anyone help, please?

Best regards,
Ricardo Moura

2 Answers, 1 is accepted

Sort by
0
Accepted
Anthony
Telerik team
answered on 10 Feb 2012, 09:55 PM
Hello Ricardo,

It appears there is jQuery event attached to the drop-down box. Test Studio won't automatically trigger the jQuery event after the drop-down selection, so you'll have to do it manually.

See how to do that here.

All the best,
Anthony
the Telerik team
Quickly become an expert in Test Studio, check out our new training sessions!
Test Studio Trainings
0
Ricardo
Top achievements
Rank 1
answered on 14 Feb 2012, 01:22 PM
Confirmed! That fixed it! Thank you very much!

Best regards,
Ricardo
Tags
General Discussions
Asked by
Ricardo
Top achievements
Rank 1
Answers by
Anthony
Telerik team
Ricardo
Top achievements
Rank 1
Share this question
or