public void TestMethod1() { BrowserApplication webBrowser = _desktop.BrowserApplication("google_com"); BrowserWindow browserWindow = webBrowser.BrowserWindow("BrowserWindow"); Application xlApp = new Application(); Workbook xlWorkBook = xlApp.Workbooks.Open(@"d:\Projects\SilkTestLab5\Silk4NETProject\DDT.xls", 0, true, 5, "", "", true, Microsoft.Office.Interop.Excel.XlPlatform.xlWindows, "\t", false, false, 0, true, 1, 0);; Worksheet xlWorkSheet = (Worksheet)xlWorkBook.Worksheets.get_Item(1);; Microsoft.Office.Interop.Excel.Range range = xlWorkSheet.UsedRange; int rw = 4; for (int rCnt = 3; rCnt <= rw; rCnt++) { string operation1 = (range.Cells[rCnt, 1] as Microsoft.Office.Interop.Excel.Range).Value2.ToString(); string operation2 = (range.Cells[rCnt, 2] as Microsoft.Office.Interop.Excel.Range).Value2.ToString(); string operation3 = (range.Cells[rCnt, 3] as Microsoft.Office.Interop.Excel.Range).Value2.ToString(); string res = (range.Cells[rCnt, 4] as Microsoft.Office.Interop.Excel.Range).Value2.ToString(); browserWindow.DomElement(operation1).Click(); browserWindow.DomElement(operation2).Click(); browserWindow.DomElement(operation3).Click(); browserWindow.DomElement("DIV").Click(); Assert.AreEqual(res, browserWindow.DomElement("cwos").GetProperty("textContents")); Assert.AreEqual(res, browserWindow.DomElement("cwos").Text); } xlWorkBook.Close(true, null, null); xlApp.Quit(); browserWindow.Close(); }
public void TestMethod1() { BrowserApplication webBrowser = _desktop.BrowserApplication("calc_by"); Application xlApp = new Application(); Workbook xlWorkBook = xlApp.Workbooks.Open("C:/Users/German/source/repos/Silk4NETProject3/test.xls", 0, true, 5, "", "", true, Microsoft.Office.Interop.Excel.XlPlatform.xlWindows, "\t", false, false, 0, true, 1, 0);; Worksheet xlWorkSheet = (Worksheet)xlWorkBook.Worksheets.get_Item(1);; Microsoft.Office.Interop.Excel.Range range = xlWorkSheet.UsedRange; int rw = 2; for (int rCnt = 1; rCnt <= rw; rCnt++) { string val1 = (range.Cells[rCnt, 1] as Microsoft.Office.Interop.Excel.Range).Value2.ToString(); string operation = (range.Cells[rCnt, 2] as Microsoft.Office.Interop.Excel.Range).Value2.ToString(); string val2 = (range.Cells[rCnt, 3] as Microsoft.Office.Interop.Excel.Range).Value2.ToString(); string res = (range.Cells[rCnt, 4] as Microsoft.Office.Interop.Excel.Range).Value2.ToString(); BrowserWindow browserWindow = webBrowser.BrowserWindow("BrowserWindow"); browserWindow.DomLink("btn_" + val1).Click(); browserWindow.DomLink(operation).Click(); browserWindow.DomLink("btn_" + val2).Click(); browserWindow.DomLink("btn_enter").Click(); Assert.AreEqual(res, browserWindow.DomTextField("calc_display_input").Text); } xlWorkBook.Close(true, null, null); xlApp.Quit(); }
public void TestMethod1() { BrowserApplication webBrowser = _desktop.BrowserApplication("calc_by"); BrowserWindow browserWindow = webBrowser.BrowserWindow("BrowserWindow"); browserWindow.DomTextField("calc_display_input").SetText("5+5*5-10/2"); browserWindow.DomLink("btn_enter").Click(); Assert.AreEqual("25", browserWindow.DomTextField("calc_display_input").Text); }
public void TestMethod1() { BrowserApplication webBrowser = _desktop.BrowserApplication("google_com"); BrowserWindow browserWindow = webBrowser.BrowserWindow("BrowserWindow"); browserWindow.DomTextField("q").SetText("cos(3x)"); browserWindow.DomElement("http www w3 org 202").Click(); Assert.AreEqual("График функции cos(3*x)", browserWindow.DomElement("graph_heading").Text); }
private IOperation BuildBrowserOperation() { var moduleLogger = new ModuleLogger(logger, nameof(BrowserApplication)); var browser = new BrowserApplication(configuration.AppConfig, configuration.Settings.Browser, messageBox, moduleLogger, text, uiFactory); var browserInfo = new BrowserApplicationInfo(); var operation = new BrowserOperation(actionCenter, browser, logger, taskbar, uiFactory); this.browser = browser; return(operation); }
private IOperation BuildBrowserOperation() { var fileSystemDialog = BuildFileSystemDialog(); var moduleLogger = ModuleLogger(nameof(BrowserApplication)); var browser = new BrowserApplication(context.AppConfig, context.Settings.Browser, fileSystemDialog, messageBox, moduleLogger, text, uiFactory); var operation = new BrowserOperation(actionCenter, context, logger, taskbar, taskview, uiFactory); context.Browser = browser; return(operation); }
public void TestMethod1() { BrowserApplication webBrowser = _desktop.BrowserApplication("DemoApp"); BrowserWindow browserWindow = webBrowser.BrowserWindow("BrowserWindow"); browserWindow.DomTextField("EmailID").SetText("*****@*****.**"); browserWindow.DomTextField("Password").TypePasswordKeys("7092Gw=="); browserWindow.DomButton("login-form login").Click(); Assert.AreEqual("John Smith", browserWindow.DomElement("John Smith").Text); browserWindow.DomButton("logout-form logout").Click(); }
public void TestMethod1() { BrowserApplication webBrowser = _desktop.BrowserApplication("google_com"); BrowserWindow browserWindow = webBrowser.BrowserWindow("BrowserWindow"); browserWindow.DomLink("Подробнее").Click(); browserWindow.DomLink("geometry").Click(); browserWindow.DomElement("объем цилиндра радиу").Click(); Assert.AreEqual("объем цилиндра радиусом 4 см и высотой 8 см", browserWindow.DomElement("объем цилиндра радиу").GetProperty("textContents")); Assert.AreEqual("объем цилиндра радиусом 4 см и высотой 8 см", browserWindow.DomElement("объем цилиндра радиу").Text); }
public void TestMethod1() { BrowserApplication webBrowser = _desktop.BrowserApplication("google_com"); BrowserWindow browserWindow = webBrowser.BrowserWindow("BrowserWindow"); browserWindow.DomElement("1").Click(); browserWindow.DomElement("×").Click(); browserWindow.DomElement("2").Click(); browserWindow.DomElement("DIV").Click(); Assert.AreEqual("2", browserWindow.DomElement("cwos").GetProperty("textContents")); Assert.AreEqual("2", browserWindow.DomElement("cwos").Text); browserWindow.Close(); }
public void TestMethod1() { BrowserApplication webBrowser = _desktop.BrowserApplication("calc_by"); BrowserWindow browserWindow = webBrowser.BrowserWindow("BrowserWindow"); browserWindow.DomRadioButton("trad").Select(); browserWindow.DomLink("sin").Click(); browserWindow.DomLink("π").Click(); browserWindow.DomLink("btn_mult").Click(); browserWindow.DomLink("btn_6").Click(); browserWindow.DomLink(")").Click(); browserWindow.DomLink("btn_enter").Click(); Assert.AreEqual("0.5", browserWindow.DomTextField("calc_display_input").Text); }
public void TestMethod1() { BrowserApplication webBrowser = _desktop.BrowserApplication("google_com"); BrowserWindow browserWindow = webBrowser.BrowserWindow("BrowserWindow"); browserWindow.DomElement("4").Click(); browserWindow.DomElement("+").Click(); browserWindow.DomElement("8").Click(); browserWindow.DomElement("DIV").Click(); browserWindow.DomElement("cwos").Click(); browserWindow.DomElement("AC").Click(); Assert.AreEqual("0", browserWindow.DomElement("cwos").Text); browserWindow.Close(); }
public void TestMethod1() { BrowserApplication webBrowser = _desktop.BrowserApplication("google_com"); BrowserWindow browserWindow = webBrowser.BrowserWindow("BrowserWindow"); browserWindow.DomElement("4").Click(); browserWindow.DomElement("÷").Click(); browserWindow.DomElement("0").Click(); browserWindow.DomElement("DIV").Click(); Assert.AreEqual("Infinity", browserWindow.DomElement("cwos").GetProperty("textContents")); Assert.AreEqual("Infinity", browserWindow.DomElement("cwos").Text); browserWindow.DomElement("http www w3 org 20").Click(); Assert.AreEqual("4 ÷ 0", browserWindow.DomElement("4 ÷ 0").Text); browserWindow.Close(); }
public void TestMethod1() { BrowserApplication webBrowser = _desktop.BrowserApplication("calc_by"); BrowserWindow browserWindow = webBrowser.BrowserWindow("BrowserWindow"); browserWindow.DomLink("n!").Click(); browserWindow.DomLink("btn_5").Click(); browserWindow.DomLink(")").Click(); browserWindow.DomLink("+").Click(); browserWindow.DomLink("btn_3").Click(); browserWindow.DomLink("btn_plus").Click(); browserWindow.DomLink("btn_3").Click(); browserWindow.DomLink("btn_minus").Click(); browserWindow.DomLink("btn_5").Click(); browserWindow.DomLink("btn_enter").Click(); Assert.AreEqual("124", browserWindow.DomTextField("calc_display_input").Text); }
public void Login_Invalido() { BrowserApplication webBrowser = _desktop.BrowserApplication("voeazul_com_br"); BrowserWindow browserWindow = webBrowser.BrowserWindow("BrowserWindow"); browserWindow.DomTextField("login-username").SetText("298429128009"); browserWindow.DomTextField("password").SetText("123456"); browserWindow.DomButton("OK2").Click(); Assert.AreEqual("dialog-0003__message dialog-0003__message--small", browserWindow.DomElement("Se o seu login usual").GetProperty("class")); Silk4NET.VerifyAsset("Imagem Exclamação"); Assert.AreEqual(true, browserWindow.DomElement("Atenção!").Visible); Assert.AreEqual("Atenção!", browserWindow.DomElement("Atenção!").Text); Assert.AreEqual("dialog-0003__title", browserWindow.DomElement("Atenção!").GetProperty("class")); Silk4NET.VerifyAsset("Botão OK Vermelho"); Assert.AreEqual(true, browserWindow.DomButton("OK").Visible); Assert.AreEqual("OK", browserWindow.DomButton("OK").Text); Assert.AreEqual("button-0001 skin-0085", browserWindow.DomButton("OK").GetProperty("class")); browserWindow.DomButton("OK").Click(); Assert.AreEqual("username", browserWindow.DomTextField("login-username").GetProperty("name")); Assert.AreEqual(true, browserWindow.DomTextField("login-username").Visible); }
public void TestMethod1() { BrowserApplication webBrowser = _desktop.BrowserApplication("voeazul_com_br"); BrowserWindow browserWindow = webBrowser.BrowserWindow("BrowserWindow"); browserWindow.DomTextField("login-username").SetText("29942912574"); browserWindow.DomTextField("password").SetText("123456"); browserWindow.DomButton("OK2").Click(); Silk4NET.VerifyAsset("Exclamação Vermelho"); Assert.AreEqual(true, browserWindow.DomElement("icon icon-alert").Visible); Assert.AreEqual("", browserWindow.DomElement("icon icon-alert").Text); Assert.AreEqual("icon icon-alert", browserWindow.DomElement("icon icon-alert").GetProperty("class")); Assert.AreEqual(true, browserWindow.DomElement("Atenção!").Visible); Assert.AreEqual("Atenção!", browserWindow.DomElement("Atenção!").Text); Assert.AreEqual("dialog-0003__title", browserWindow.DomElement("Atenção!").GetProperty("class")); Assert.AreEqual(true, browserWindow.DomElement("Se o seu login usual").Visible); Assert.AreEqual("Se o seu login usual não funcionar, por favor tente usar o seu CPF (somente números, sem hífen ou pontos) ou verifique a digitação da sua senha.Persistindo o problema entre em contato com o TudoAzul: 11 – 4003 1141 ou pelo email: [email protected]", browserWindow.DomElement("Se o seu login usual").Text); Assert.AreEqual("dialog-0003__message dialog-0003__message--small", browserWindow.DomElement("Se o seu login usual").GetProperty("class")); /*Silk4NET.VerifyAsset("Botão OK Vermelho");*/ browserWindow.DomButton("OK").Click(); Assert.AreEqual("login-username", browserWindow.DomTextField("login-username").GetProperty("id")); }
internal Browser( ServiceProvider provider ) : base(provider) { // Find default browser. string progId; using ( RegistryKey userChoiceKey = Registry.CurrentUser.OpenSubKey( @"Software\Microsoft\Windows\Shell\Associations\UrlAssociations\http\UserChoice" ) ) { if ( userChoiceKey == null ) { return; } object progIdValue = userChoiceKey.GetValue( "Progid" ); if ( progIdValue == null ) { return; } progId = progIdValue.ToString(); switch ( progId ) { case "IE.HTTP": _browser = BrowserApplication.InternetExplorer; break; case "FirefoxURL": _browser = BrowserApplication.Firefox; break; case "ChromeHTML": _browser = BrowserApplication.Chrome; break; default: _browser = BrowserApplication.Unknown; break; } } // Find browser path. const string exeSuffix = ".exe"; using ( RegistryKey pathKey = Registry.ClassesRoot.OpenSubKey( progId + @"\shell\open\command" ) ) { if ( pathKey == null ) { return; } // Trim parameters. try { string path = pathKey.GetValue( null ).ToString().ToLower().Replace( "\"", "" ); if ( !path.EndsWith( exeSuffix ) ) { path = path.Substring( 0, path.LastIndexOf( exeSuffix, StringComparison.Ordinal ) + exeSuffix.Length ); _browserPath = new FileInfo( path ); } } // ReSharper disable EmptyGeneralCatchClause catch { // Assume the registry value is set incorrectly, or some funky browser is used which currently is unknown. } // ReSharper restore EmptyGeneralCatchClause } }
internal Browser(ServiceProvider provider) : base(provider) { // Find default browser. string progId; using (RegistryKey userChoiceKey = Registry.CurrentUser.OpenSubKey(@"Software\Microsoft\Windows\Shell\Associations\UrlAssociations\http\UserChoice")) { if (userChoiceKey == null) { return; } object progIdValue = userChoiceKey.GetValue("Progid"); if (progIdValue == null) { return; } progId = progIdValue.ToString(); switch (progId) { case "IE.HTTP": _browser = BrowserApplication.InternetExplorer; break; case "FirefoxURL": _browser = BrowserApplication.Firefox; break; case "ChromeHTML": _browser = BrowserApplication.Chrome; break; default: _browser = BrowserApplication.Unknown; break; } } // Find browser path. const string exeSuffix = ".exe"; using (RegistryKey pathKey = Registry.ClassesRoot.OpenSubKey(progId + @"\shell\open\command")) { if (pathKey == null) { return; } // Trim parameters. try { string path = pathKey.GetValue(null).ToString().ToLower().Replace("\"", ""); if (!path.EndsWith(exeSuffix)) { path = path.Substring(0, path.LastIndexOf(exeSuffix, StringComparison.Ordinal) + exeSuffix.Length); _browserPath = new FileInfo(path); } } // ReSharper disable EmptyGeneralCatchClause catch { // Assume the registry value is set incorrectly, or some funky browser is used which currently is unknown. } // ReSharper restore EmptyGeneralCatchClause } }