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

save pop up

2 Answers 107 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
jaco
Top achievements
Rank 1
jaco asked on 12 Jan 2011, 02:27 PM
Hi, I have a problem with hyperlink which save and close pop up window.
Below is the code:

Manager aaa = new Manager(false);
aaa.Start();
if (aaa.Browsers.Count == 0)
{
    aaa.LaunchNewBrowser(BrowserType.InternetExplorer);
}
aaa.ActiveBrowser.NavigateTo(TextBox1.Text);
 
 
 
aaa.SetNewBrowserTracking(true);
// link wchich open pop up
aaa.ActiveBrowser.Actions.Click(aaa.ActiveBrowser.Find.ById("newQuestion"));
aaa.WaitForNewBrowserConnect(aaa.Browsers[aaa.Browsers.Count - 1].Url, true, 6000);
aaa.ActiveBrowser.WaitUntilReady();
aaa.ActiveBrowser.RefreshDomTree();
 
//update value in the pop up
aaa.ActiveBrowser.Actions.SetText(aaa.ActiveBrowser.Find.ById("name"), "nazwa testowa");
 
aaa.ActiveBrowser.PrepareFrameForClosing();               
aaa.ActiveBrowser.AutoDomRefresh = false;
aaa.ActiveBrowser.AutoWaitUntilReady = false;
//link wchich save data int the pop up and close pop up
aaa.ActiveBrowser.Actions.Click(aaa.ActiveBrowser.Find.ById("save"));
aaa.Browsers[aaa.Browsers.Count - 1].Close();


When I use the above code, data in the pop up window fills in just ok, pop up closes, but when I open this pop up window one more time, the data is null (in the id "name").

On the other hand after I delete those lines:
   
aaa.ActiveBrowser.AutoDomRefresh = false;
aaa.ActiveBrowser.AutoWaitUntilReady = false;

everything is just fine but I get an exception:

Wait for condition has timed out
 
 
[TimeoutException: Wait for condition has timed out]
   ArtOfTest.Common.WaitSync.CheckResult(WaitSync wait, String extraExceptionInfo) +115
   ArtOfTest.Common.WaitSync.For(Predicate`1 predicate, T target, Boolean invertCondition, Int32 timeout) +110
   ArtOfTest.WebAii.Core.Browser.WaitUntilReady() +149
   ArtOfTest.WebAii.Core.Browser.ExecuteCommand(BrowserCommand request, Boolean performDomRefresh, Boolean waitUntilReady) +38
   ArtOfTest.WebAii.Core.Browser.ExecuteCommand(BrowserCommand request) +25
   ArtOfTest.WebAii.Core.Actions.Click(Element targetElement) +89
   WebApplicationRealTelerikTest.str1.Button17_Click(Object sender, EventArgs e) in C:\Users\jbarteczek\Desktop\testyAutomat\oceny\WebApplicationRealTelerikTest\index.aspx.cs:1824
   System.Web.UI.WebControls.Button.OnClick(EventArgs e) +118
   System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +112
   System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +10
   System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +13
   System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +36
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +5563


Have You any sugestions ?

2 Answers, 1 is accepted

Sort by
0
Keaegan
Telerik team
answered on 12 Jan 2011, 08:06 PM
Hello jaco,

Please change the following line:

aaa.ActiveBrowser.Actions.Click(aaa.ActiveBrowser.Find.ById("save"));

To instead be

aaa.ActiveBrowser.Actions.MouseClick(aaa.ActiveBrowser.Find.ById("save"));

The .Click method directly clicks the DOM object, whereas the .MouseClick sends a desktop command to use the mouse to click the object (button in your case). When you use a .MouseClick() are you seeing the same feedback?

Best wishes,
Keaegan
the Telerik team
Interested in Agile Testing? Check out Telerik TV for a recording of Automated Testing in the Agile Environment
0
jaco
Top achievements
Rank 1
answered on 13 Jan 2011, 07:57 AM
Hi :)
Thank You for response.
I haven't metod MouseClick, but I found other way.

After line:
aaa.ActiveBrowser.Actions.Click(aaa.ActiveBrowser.Find.ById("save"));
I add:
aaa.Desktop.Mouse.Move(new System.Drawing.Point(1000, 900), new System.Drawing.Point(200, 900), 10, 100);

When program performs this line Data is saving, and after this, program close browser.
If this line isn't program cant make it.


Jaco
Tags
General Discussions
Asked by
jaco
Top achievements
Rank 1
Answers by
Keaegan
Telerik team
jaco
Top achievements
Rank 1
Share this question
or