hi, i have tried everything that i find in forums and so on and i have stuck. I can not save selected option from select (drop down). Developers are using angularJs framework (Javascript-based). Events, SelectByText, Desktop.Mouse.Click and so on didn't helped....
Currently my code looks like this:
Currently my code looks like this:
Browser.RefreshDomTree();
var select = Browser.Find.ByAttributes<
HtmlSelect
>(attributes);
select.MouseClick();
Thread.Sleep(Extensions.SmallTimeOut);
Browser.RefreshDomTree();
select = Browser.Find.ByAttributes<
HtmlSelect
>(attributes);
var option = select.Options.First(itm => itm.Text.Equals(value));
option.Click();
7 Answers, 1 is accepted
0
Faris
Top achievements
Rank 1
answered on 20 Jun 2013, 05:02 PM
Hi Asha - You might need to invoke the OnChangeEvent on the dropdown.
DropDown.SelectByValue("foo",true);
Here is a code snippet tested against the code you pointed us to:
This sample simply returns "All" the dropdowns on the page you pointed us to and selected a specific value and then outputs it. I hope that helps :)
DropDown.SelectByValue("foo",true);
Here is a code snippet tested against the code you pointed us to:
[TestMethod]
public
void
Support_Issue()
{
Manager.LaunchNewBrowser(BrowserType.InternetExplorer);
ActiveBrowser.NavigateTo(
"http://jsfiddle.net/2JWb2/5/"
);
Browser jFiddleResultsFrame = ActiveBrowser.WaitForFrame(
new
FrameInfo
{
Name =
"result"
});
List<HtmlSelect> dropdown = jFiddleResultsFrame.Find.AllControls<HtmlSelect>().ToList();
foreach
(HtmlSelect s
in
dropdown)
{
Console.WriteLine(
string
.Format(
"Before Selection: {0}"
, s.SelectedIndex));
s.SelectByValue(
"2"
,
true
);
s.Refresh();
// Ensure the DOM is update for this particular control.
Console.WriteLine(
string
.Format(
"After Selection: {0}"
, s.SelectedIndex));
}
}
This sample simply returns "All" the dropdowns on the page you pointed us to and selected a specific value and then outputs it. I hope that helps :)
0
Hello,
Boyan Boev
Telerik
@Faris, thank you for your input.
@Asta, are you still experiencing the issue?
Should you have any additional questions please do not hesitate to ask us.
Boyan Boev
Telerik
Quickly become an expert in Test Studio, check out our new training sessions!
Test Studio Trainings
Test Studio Trainings
0
Asta
Top achievements
Rank 1
answered on 25 Jun 2013, 08:31 AM
Yes, it didn't help.
0
Hello Asta,
Boyan Boev
Telerik
As you can see in this video the code works correctly.
Please elaborate a bit more on your scenario. What exactly don't work?
1. Please send us the execution log.
2. Can you please record a Jing video demonstrating the issue?
Hope to hear from you soon.
Boyan Boev
Telerik
Quickly become an expert in Test Studio, check out our new training sessions!
Test Studio Trainings
Test Studio Trainings
0
Asta
Top achievements
Rank 1
answered on 26 Aug 2013, 08:19 AM
i found solution myself....
Browser.RefreshDomTree();
var select = Browser.Find.ByAttributes<HtmlSelect>(attributes);
select.SelectByText(value,
true
);
jQueryControl jQueryControl = select.AsjQueryControl();
jQueryControl.InvokejQueryEvent(jQueryControl.jQueryControlEvents.change);
0
Hi Asta,
Boyan Boev
Telerik
We are glad to hear that.
If you need additional assistance do not hesitate to contact us.
Boyan Boev
Telerik
Quickly become an expert in Test Studio, check out our new training sessions!
Test Studio Trainings
Test Studio Trainings