Iframe not always selecting Elements with upload, Dynamic drop down, text box, and OK button. The Iframe is wrapped inside a DIV modal, here is the code I am using:
// Grabbing all the HTML DIV into a list showing the count.
IList<HtmlDiv> PopUpList = Find.AllByXPath<HtmlDiv>("//div[@role='dialog']");
iml.VerboseMsg($"Popup Element Count: {PopUpList.Count}");
// Grabbing the last DIV
HtmlDiv lastPopUp;
lastPopUp = PopUpList.Last();
ArtOfTest.WebAii.Core.Browser t1_frame = lastPopUp.OwnerBrowser.Frames[0];
iml.VerboseMsg($"Frame: {t1_frame.ToString()}");
Assert.IsNotNull(t1_frame);
t1_frame.WaitUntilReady();
Element toggleOff = t1_frame.Find.ById("ContentPlaceHolder1_ASPxUploadControl1_TextBox0_FakeInput");
ActiveBrowser.WaitUntilReady();
t1_frame.Actions.Click(toggleOff);
Element DocumentType = t1_frame.Find.ById("ContentPlaceHolder1_ddlDocType");
t1_frame.Actions.SelectDropDown(DocumentType, 2);
Element UploadFileOK = t1_frame.Find.ById("btnUpload");
t1_frame.Actions.Click(UploadFileOK);
The code does not always work but it does work here and there. Any thoughts?
John