MyWindow.MyPanel.MySubPanel.MyControlpublic class MyPanel : CustomPanelWrapper{ private CustomPanelWrapper subPanel; public CustomPanelWrapper MySubPanel { get { return subPanel ?? (subPanel = this.Find.ByAutomationId<CustomPanelWrapper>("MySubPanel"); } } }public class CustomPanelWrapper : FrameworkElement{ ....}public class MyTestRunner{ private TelerikWpfTestRunner telerikTestRunner; public void StartTest() { var appProcess = new Process(); appProcess.StartInfo.FileName = <filePath>; appProcess.StartInfo.WorkingDirectory= <App Directory>; appProcess.Start(); telerikTestRunner = new TelerikWpfTestRunner(appProcess, <logPath>); } public void StopTest() { telerikTestRunner.CleanUp(); telerikTestRunner.Dispose(); }}public class TelerikWpfTestRunner : BaseWpfTest{ public TelerikWpfTestRunner (Process appProcess, string logPath) { Initialize(logPath); Application = Manager.ConnectToApplication(appProcess); Manager.ActiveApplication.MainWindow.RefreshVisualTrees(); Manager.ActiveApplication.QuitOnDetach = true; Application.WaitForWindow(<MainWindow>); }}[TestClass]public class Login : RadControlsBaseTest{ [TestMethod()] public void SettingUpBrowser() { SetUpBrowser(capiPage); ActiveBrowser.WaitUntilReady(); } [TestMethod()] [DeploymentItem("Data\\Login.xlsx", "Data")] [DataSource("LoginDataSource")] public void LoginTest() { if (TestContext.DataRow != null) { string Username = TestContext.DataRow["Username"].ToString(); string Password = TestContext.DataRow["Password"].ToString(); string ExpectedResult = TestContext.DataRow["Expected Result"].ToString(); string ErrorText = TestContext.DataRow["Error Text"].ToString(); Login(capiPage, Username, Password); ActiveBrowser.WaitUntilReady(); if (ExpectedResult.Equals("Fail")) { //compare error text } else if (ExpectedResult.Equals("Pass")) { //can navigate to main screen } } } protected void SetUpBrowser(PageControls page) { if(Manager.ActiveBrowser == null) Manager.LaunchNewBrowser(); ActiveBrowser.ClearCache(BrowserCacheType.Cookies); ActiveBrowser.ClearCache(BrowserCacheType.TempFilesCache); ActiveBrowser.NavigateTo("/" + page.pageURL); } protected void Login(PageControls page, string username, string password) { //waiting for page to redirect to the login page Manager.ActiveBrowser.WaitUntilReady(); if (Manager.ActiveBrowser.ContainsText("Login.aspx") == true) { HtmlInputText txtUserName = Find.ById<HtmlInputText>("loginControls_txtUserName"); AttributeUtils.chkNotNull(txtUserName, "loginControls_txtUserName"); HtmlInputPassword txtPwd = Find.ById<HtmlInputPassword>("loginControls_txtPassword"); AttributeUtils.chkNotNull(txtPwd, "loginControls_txtPassword"); HtmlInputSubmit btnLogin = Find.ById<HtmlInputSubmit>("loginControls_btnLogin"); AttributeUtils.chkNotNull(btnLogin, "loginControls_btnLogin"); txtUserName.Text = username; txtPwd.Text = password; btnLogin.Click(); } }}[TestClass] public class MyTest:BaseTest { [TestMethod] public void TestMethodChrome() { base.Initialize(); Manager.LaunchNewBrowser(BrowserType.Chrome); ActiveBrowser.Cookies.SetCookie(new System.Net.Cookie("mycookie", "myvalue", "/", "www.google.com")); ActiveBrowser.NavigateTo("http://www.google.com"); } [TestMethod] public void TestMethodFireFox() { base.Initialize(); Manager.LaunchNewBrowser(BrowserType.FireFox); ActiveBrowser.Cookies.SetCookie(new System.Net.Cookie("mycookie", "myvalue", "/", "www.google.com")); ActiveBrowser.NavigateTo("http://www.google.com"); } }Hi
I can set the cookie with domain "ctrip.com" when testing in FireFox, but couldn't set the value with domain which likes ".ctrip.com".
//the following codes works well
Cookie cookie = new Cookie();cookie.Domain = "ctrip.com";cookie.Name = cookieName;cookie.Value = cookieValue; cookie.Path = "/";cookie.Expires = DateTime.Now.AddHours(2);Manager.ActiveBrowser.Cookies.SetCookie(cookie);//the following codes doesn't work, after executing the codes, I couln't find the cooke.
Cookie cookie = new Cookie();cookie.Domain = ".ctrip.com";cookie.Name = cookieName;cookie.Value = cookieValue; cookie.Path = "/";cookie.Expires = DateTime.Now.AddHours(2);Manager.ActiveBrowser.Cookies.SetCookie(cookie);Thanks in advance.
When using webaii for automating my test cases,I have stumped across a case where in a security pop up appears, I am unable to override using either code/ Firefox browser settings.
How can I handle this firefox dialog?
Attached is the screenshot, but it's Chinese not english, below is the dialog content in english
Dialog Caption: Security Warning
Dialog Text: "Although this page is encrypted, the information you have entered is to be sent over an unencrypted connection and could easily be read by a third party. Are you sure you want to continue sending this information?"
Buttons: One is "Continue", another one is "Cancel"
Thanks in advance.
Jet
Hello.
I have html code:
<input id="j_idt9:revertBtn" class="button-primary" type="submit" value="Revert" onclick="jsf.util.chain(this,event,"if(!confirm('Do you really want to revert these changes?'))return false;","RichFaces.ajax(\"j_idt9:revertBtn\",event,{\"incId\":\"1\"} )");return false;" name="j_idt9:revertBtn" disabled="">
Manager.DialogMonitor.AddDialog(AlertDialog.CreateAlertDialog(ActiveBrowser, DialogButton.OK)); Manager.DialogMonitor.Start(); Find.ById<HtmlInputSubmit>("j_idt9:revertBtn").Click();
In initialization phase i have:
Settings settings = GetSettings();
settings.UnexpectedDialogAction = UnexpectedDialogAction.DoNotHandle; Initialize(settings);pop-up has Ok and Cancel buttons.
but when i execute test, pop-up appeared and then nothing happened.
Hm.. I noticed that pop-up "blinking" with this code.
PS. i try this link but have same issue.
PS2. I execute on IE9 and FF14.0.1 Win7 x64 but project compiled in x86