public void TestUpload()
        {
            NavigationHelper.NavigateToUrl(ObjectRepository.Config.GetWebsite());
            ButtonHelper.ClickButton(By.Id("enter_bug"));
            TextBoxHelper.TypeInTextBox(By.Id("Bugzilla_login"), ObjectRepository.Config.GetUsername());
            TextBoxHelper.TypeInTextBox(By.Id("Bugzilla_password"), ObjectRepository.Config.GetPassword());
            ButtonHelper.ClickButton(By.Id("log_in"));
            ButtonHelper.ClickButton(By.LinkText("Testng"));
            ButtonHelper.ClickButton(By.XPath("//div[@id='attachment_false']/input"));
            GenericHelper.WaitForWebElement(By.Id("data"), TimeSpan.FromSeconds(30));
            ButtonHelper.ClickButton(By.Id("data"));

            Console.WriteLine("\"" + Directory.GetCurrentDirectory() + @"\ExcelData.xlsx" + "\"");

            var processinfo = new ProcessStartInfo()
            {
                FileName  = "FileUpload.exe",
                Arguments = "\"" + Directory.GetCurrentDirectory() + @"\ExcelData.xlsx" + "\""
            };

            //processinfo.FileName = @"F:\Auto\FileUpload.exe";
            //processinfo.Arguments = @"C:\downloads\ExcelData.xlsx";

            //Process process = Process.Start(processinfo);
            //process.WaitForExit();
            //process.Close();

            using (var process = Process.Start(processinfo))
            {
                process.WaitForExit();
            }


            Thread.Sleep(5000);
            ButtonHelper.Logout();
        }
Beispiel #2
0
        public void TestAlert()
        {
            NavigationHelper.NavigateToUrl("http://www.w3schools.com/js/js_popup.asp");
            ButtonHelper.ClickButton(By.XPath("//div[@id='main']/descendant::a[position()=3]"));
            BrowserHelper.SwitchToWindow(1);
            IWebElement textarea = ObjectRepository.Driver.FindElement(By.Id("textareaCode"));

            JavaScriptExecutor.ExecuteScript("document.getElementById('textareaCode').setAttribute('style','display: inline;')");
            TextBoxHelper.ClearTextBox(By.CssSelector("#textareawrapper"));
            BrowserHelper.SwitchToFrame(By.Id("iframeResult"));
            // ButtonHelper.ClickButton(By.XPath("//button[text()='Try it']"));
            var text = JavaScriptPopHelper.GetPopUpText();

            JavaScriptPopHelper.ClickOkOnPopup();
            //IAlert alert = ObjectRepository.Driver.SwitchTo().Alert();
            //var text = alert.Text;
            //alert.Accept();
            ObjectRepository.Driver.SwitchTo().DefaultContent();
            GenericHelper.WaitForWebElement(By.Id("textareaCode"), TimeSpan.FromSeconds(60));
            //TextBoxHelper.ClearTextBox(By.Id("textareaCode"));
            //TextBoxHelper.TypeInTextBox(By.Id("textareaCode"),text);
            Logger.Info("Test Alert Complete");
            GenericHelper.Wait(ExpectedConditions.ElementIsVisible(By.Id("id")), TimeSpan.FromSeconds(60));
        }
Beispiel #3
0
 private void InitHander()
 {
     this.gridHelper   = new GridHelper(this.gridWebGrid);
     this.buttonHelper = new ButtonHelper(this);
     this.gridHelper.Grid.DisplayLayout.AllowUpdateDefault = AllowUpdate.No;
 }
 public void ThenIClickOnLink(string linkText)
 {
     ButtonHelper.ClickButton(By.LinkText(linkText));
 }
 public Cars NavigateToCars()
 {
     ButtonHelper.ClickButton(Cars_Hmenu);
     return(new Cars(driver));
 }
        public By JoinRewardsLnk     = By.Id("header-language-2058");          // Join Rewards

        #endregion Header Menus

        #endregion IWebElements

        #region Actions
        public void SignOut()
        {
            ButtonHelper.ClickButton(HelloUserMenu);
            LinkHelper.ClickLink(AccountSignOutLnk);
        }
Beispiel #7
0
 public void clickNext()
 {
     ButtonHelper.ClickButton(_btnNext);
 }
Beispiel #8
0
        //运行
        private void RunTool(object sender, RoutedEventArgs e)
        {
            this.IconCard.Visibility = Visibility.Collapsed;
            ButtonHelper.SetIsWaiting(RunButton, true);
            if (String.IsNullOrWhiteSpace(PackageIn.Text))
            {
                error.ErrorTo("发现错误(SOS - 001):输入为空。", Percent, Errorsay);
                ButtonHelper.SetIsWaiting(RunButton, false);
                this.RunCard.Visibility = Visibility.Visible;
                return;
            }

            try
            {
                string url       = "https://setting.smartisan.com/app/icon";
                string packageof = "[{\"package\":\"" + PackageIn.Text + "\"}]";

                string GetJson = HttpUitls.Post(url, packageof, "", "application/json");

                JObject obj = JObject.Parse(GetJson);

                JToken record = obj["body"]["app_icon"][PackageIn.Text];

                JToken recorda = obj["body"]["app_icon"][PackageIn.Text];
                int    num     = -1;
                int    numa    = 0;
                if (!Directory.Exists("SSTB/Files/Logo"))
                {
                    Directory.CreateDirectory("SSTB/Files/Logo");
                }
                if (!fist)
                {
                    Grid grida = new Grid();
                    for (int i = 0; i < names.Length; i++)
                    {
                        grida = Iconall.FindName(names[i]) as Grid;
                        Iconall.Children.Remove(grida);
                        Iconall.UnregisterName(names[i]);
                    }
                }
                fist = false;
                foreach (JObject jpa in recorda)
                {
                    numa++;
                }
                names = new String[numa];
                foreach (JObject jp in record)
                {
                    num++;
                    if (!Directory.Exists("SSTB/Files/Logo/" + num))
                    {
                        Directory.CreateDirectory("SSTB/Files/Logo/" + num);
                    }
                    string filepath  = "SSTB/Files/Logo/" + num + "/logo.png";
                    string filepatha = "SSTB/Files/Logo/" + num + "/md5.xml";
                    string filepathb = "SSTB/Files/Logo/logo" + num + ".png";

                    WebClient mywebclient = new WebClient();

                    string urlPng = jp["logo"].ToString();
                    string urlmd5 = jp["md5"].ToString();

                    mywebclient.DownloadFile(urlPng, filepath);
                    mywebclient.DownloadFile(urlmd5, filepatha);
                    mywebclient.DownloadFile(urlPng, filepathb);

                    Image img  = new Image();
                    Grid  grid = new Grid();

                    Iconall.Children.Add(grid);
                    grid.Children.Add(img);

                    RegisterName("grid" + num, grid);
                    names[num] = "grid" + num;

                    img.Height = 256;
                    img.Width  = 540;
                    Thickness thickness = new Thickness();
                    thickness.Left   = 0;
                    thickness.Top    = 18;
                    thickness.Right  = 0;
                    thickness.Bottom = 15;
                    img.Margin       = thickness;
                    img.Source       = new BitmapImage(new Uri(urlPng));
                    //this.T.Source = new BitmapImage(new Uri(urlPng));
                }
                T5.Text = "原图以及MD5检验文件已保存在程序所在目录的File/Logo文件夹下";
                this.IconCard.Visibility = Visibility.Visible;

                this.RunCard.Visibility = Visibility.Collapsed;
            }
            catch (Exception ex)
            {
                error.ErrorTo("发现错误(SOS - 003):请求图标失败, 错误原因:", "" + ex, Percent, Errorsay);
                this.RunCard.Visibility = Visibility.Visible;
                ButtonHelper.SetIsWaiting(RunButton, false);
                return;
            }
            ButtonHelper.SetIsWaiting(RunButton, false);
        }
 public void WhenUserClickOnTheCreateSchedule()
 {
     ButtonHelper.ClickOnButton(By.XPath("//button//span[text()='Create Schedule']"));
 }
Beispiel #10
0
 public void SelectMacOption()
 {
     ButtonHelper.ClickButton(_macOption);
 }
Beispiel #11
0
 public void SelectDesktopHeader()
 {
     ButtonHelper.ClickButton(_desktopHeader);
 }
Beispiel #12
0
        private void Seeing()
        {
            if (!Directory.Exists("Cache"))
            {
                Directory.CreateDirectory("Cache");
            }
            if (File.Exists("Cache\\logs.log"))
            {
                File.Delete("Cache\\logs.log");
            }
            this.Dispatcher.BeginInvoke(DispatcherPriority.Normal, (ThreadStart) delegate()
            {
                NamePorc.Text = "加载中";
                IDPorc.Text   = "加载中";
                UsePorc.Text  = "加载中";
                Ping.Text     = "加载中";
            });
            Process            p   = SSUserClass.Proc.GetProc("edge");
            PerformanceCounter pf1 = new PerformanceCounter("Process", "Working Set - Private", p.ProcessName);

            this.Dispatcher.BeginInvoke(DispatcherPriority.Normal, (ThreadStart) delegate()
            {
                isRun = true;
                ButtonHelper.SetIcon(Run, "");
                IconHelper.SetFontSize(Run, 15);
                NamePorc.Text = p.ProcessName;
                IDPorc.Text   = p.Id + "/" + p.SessionId;
                UsePorc.Text  = pf1.NextValue() / 1024 + "KB";
                ProgressBarHelper.SetAnimateTo(openPer, 100);
                isOpen.Text          = "启动完成";
                TaskBar.ToolTipText  = "N2N Desktop Launcher - 正在运行";
                taskBarRun.IsChecked = true;
                logTextBox.Text      = ">[ 进程守护 ] 进程监控已正常运转——\n";
                PingReply reply      = SSUserClass.Net.GetPing(nowUsed.severIP, "abcd");
                ButtonHelper.SetIsWaiting(Run, false);
                if (reply.Status == IPStatus.Success)
                {
                    Ping.Text = (reply.RoundtripTime).ToString() + "ms";
                }
            });
            int failepingTimes = 0;
            int passtime       = 0;

            while (SSUserClass.Proc.HasProc("edge"))
            {
                String nexline = process.StandardOutput.ReadLine();
                if (!String.IsNullOrWhiteSpace(nexline))
                {
                    this.Dispatcher.BeginInvoke(DispatcherPriority.Normal, (ThreadStart) delegate()
                    {
                        using (StreamWriter sw = File.AppendText("Cache\\logs.log"))
                        {
                            sw.WriteLine(nexline);
                        }
                        if (nexline.IndexOf("WARNING") > 0)
                        {
                            logTextBox.Text += nexline + "\n";
                            logTextBox.Text += ">[ 进程守护 ] 发现疑似报错!\n";
                        }
                        else if (nexline.IndexOf("ERROR") > 0)
                        {
                            logTextBox.Text       += nexline + "\n";
                            logTextBox.Text       += ">[ 进程守护 ] 发现严重错误!\n";
                            panErrorMsg.Visibility = Visibility.Visible;
                            errMode         = 0;
                            errorTitle.Text = "错误";
                            errorSays.Text  = "发现了错误:" + nexline;
                            SSUserClass.Proc.KillProc(SSUserClass.Proc.GetProc("edge"));
                        }
                        else
                        {
                            logTextBox.Text += nexline + "\n";
                        }
                    });
                }
                if (passtime >= 30000)
                {
                    passtime = 0;
                }
                if (passtime % 2000 == 0)
                {
                    //刷新进程信息
                    try
                    {
                        p   = SSUserClass.Proc.GetProc("edge");
                        pf1 = new PerformanceCounter("Process", "Working Set - Private", p.ProcessName);
                        this.Dispatcher.BeginInvoke(DispatcherPriority.Normal, (ThreadStart) delegate()
                        {
                            NamePorc.Text = p.ProcessName;
                            IDPorc.Text   = p.Id + "/" + p.SessionId;
                            UsePorc.Text  = pf1.NextValue() / 1024 + "KB";
                            ProgressBarHelper.SetAnimateTo(openPer, 100);
                        });
                    }
                    catch { }
                    //刷新Ping
                    PingReply reply = SSUserClass.Net.GetPing(nowUsed.severIP, "abcd");
                    if (reply.Status == IPStatus.Success)
                    {
                        failepingTimes = 0;
                        this.Dispatcher.BeginInvoke(DispatcherPriority.Normal, (ThreadStart) delegate()
                        {
                            Ping.Text = (reply.RoundtripTime).ToString() + "ms";
                        });
                    }
                    else
                    {
                        failepingTimes++;
                        if (failepingTimes >= 5)
                        {
                            //判定掉线重启
                            SSUserClass.Proc.KillProc(SSUserClass.Proc.GetProc("edge"));
                            RunFun();
                        }
                    }
                }
                passtime += 20;
                Thread.Sleep(20);
            }
            this.Dispatcher.BeginInvoke(DispatcherPriority.Normal, (ThreadStart) delegate()
            {
                RunInfo.Visibility = Visibility.Collapsed;
                ProgressBarHelper.SetAnimateTo(openPer, 0);
                isOpen.Text         = "未启用";
                TaskBar.ToolTipText = "N2N Desktop Launcher -未启用";
                ButtonHelper.SetIcon(Run, "");
                IconHelper.SetFontSize(Run, 25);
                taskBarRun.IsChecked = false;
            });
            isRun = false;
        }
Beispiel #13
0
 public void TestConfirmation()
 {
     NavigationHelper.NavigateToUrl("http://omayo.blogspot.com/");
     ButtonHelper.ClickButton(By.Id("confirm"));
     PopupHelper.ClickCancelButton();
 }
Beispiel #14
0
 public void ShoppingCart()
 {
     ButtonHelper.ClickButton(_shoppingCartButton);
 }
Beispiel #15
0
        private void RunTool(object sebder, RoutedEventArgs s)
        {
            bool Error = false;

            bool[] InPutHas    = new bool[4];
            String ErrorString = "";
            int    which       = 0;

            String[] ColorList = new string[2];

            ButtonHelper.SetIsWaiting(RunButton, true);

            this.Errorsay.Visibility = Visibility.Collapsed;
            this.RunCard.Visibility  = Visibility.Visible;

            this.Percent.Foreground = ColorFst;
            ProgressBarHelper.SetAnimateTo(Percent, 0);

            for (int i = 0; i < 2; i++)
            {
                InPutHas[i] = true;
            }
            if (String.IsNullOrWhiteSpace(J16.Text))
            {
                InPutHas[0] = false;
            }
            if (String.IsNullOrWhiteSpace(RGBA.Text))
            {
                InPutHas[1] = false;
            }

            {
                bool has = false;
                for (int i = 0; i < 2; i++)
                {
                    if (InPutHas[i] && !has)
                    {
                        has   = true;
                        which = i;
                        continue;
                    }
                    if (InPutHas[i] && has)
                    {
                        Error       = true;
                        ErrorString = "发现错误(ECC - 002):有多个无法统一的输入。";
                    }
                }
            }

            if ((InPutHas[0] || InPutHas[1]) == false)
            {
                Error       = true;
                ErrorString = "发现错误(ECC - 001):输入内容为空。";
            }
            ProgressBarHelper.SetAnimateTo(Percent, 100 / 3);

            if (Error)
            {
                error.ErrorTo(ErrorString, Percent, Errorsay);
            }
            else
            {
                SolidColorBrush ChangeColor = new SolidColorBrush();
                ChangeColor.Color = System.Windows.Media.Color.FromArgb(255, 209, 93, 93);

                switch (which + 1)
                {
                case 1:
                {
                    //十六进制
                    ColorList[0] = this.J16.Text;
                    int[] Color;

                    if (this.J16.Text[0] != '#' || this.J16.Text.Length != 9)
                    {
                        Error = true;
                        error.ErrorTo("发现错误(ECC - 003):输入内容无效,请检查。错误内容为……你瞎几把输入了些什么玩意。", Percent, Errorsay);
                        break;
                    }
                    for (int i = 1; i <= 8; i++)
                    {
                        if (this.J16.Text[i] != '0' && this.J16.Text[i] != '1' && this.J16.Text[i] != '2' && this.J16.Text[i] != '3' && this.J16.Text[i] != '4' && this.J16.Text[i] != '5' && this.J16.Text[i] != '6' && this.J16.Text[i] != '7' && this.J16.Text[i] != '8' && this.J16.Text[i] != '9' && this.J16.Text[i] != 'A' && this.J16.Text[i] != 'B' && this.J16.Text[i] != 'C' && this.J16.Text[i] != 'D' && this.J16.Text[i] != 'E' && this.J16.Text[i] != 'F')
                        {
                            Error = true;
                            error.ErrorTo("发现错误(ECC - 003):输入内容无效,请检查。错误内容为十六进制值大于F", Percent, Errorsay);
                        }
                        else
                        {
                            goto A;
                        }
                    }
                    break;
                    A : Color = toRGBA(this.J16.Text, 1);
                    if (Color[4] == -1)
                    {
                        Error = true;
                        break;
                    }
                    ColorList[1]      = Color[1] + "," + Color[2] + "," + Color[3] + "," + Color[0];
                    ChangeColor.Color = System.Windows.Media.Color.FromArgb(byte.Parse(Color[0].ToString()), byte.Parse(Color[1].ToString()), byte.Parse(Color[2].ToString()), byte.Parse(Color[3].ToString()));
                    SolidColorBrush CardColor = new SolidColorBrush();
                    if (Color[0] != 255)
                    {
                        CardColor.Color = System.Windows.Media.Color.FromArgb(0, 255, 255, 255);
                    }
                    else
                    {
                        CardColor.Color = System.Windows.Media.Color.FromArgb(255, 255, 255, 255);
                    }
                    this.ColorCard.Background = CardColor;
                    this.Color.Fill           = ChangeColor;
                }
                break;

                case 2:
                {
                    //RGBA
                    ColorList[1] = this.RGBA.Text;
                    byte     r, g, b, a;
                    string[] sArray = this.RGBA.Text.Split(',');
                    int      row    = sArray.GetLength(0);  //第一维的长度(即行数),结果为2
                    if (row == 4)
                    {
                        if (int.Parse(sArray[0]) > 255 || int.Parse(sArray[1]) > 255 || int.Parse(sArray[2]) > 255 || int.Parse(sArray[3]) > 255)
                        {
                            Error = true;
                            error.ErrorTo("发现错误(ECC - 003):输入内容无效,请检查。错误内容为RGBA值大于255。", Percent, Errorsay);
                            break;
                        }
                        r = byte.Parse(sArray[0]);
                        g = byte.Parse(sArray[1]);
                        b = byte.Parse(sArray[2]);
                        a = byte.Parse(sArray[3]);

                        ChangeColor.Color = System.Windows.Media.Color.FromArgb(a, r, g, b);
                        SolidColorBrush CardColor = new SolidColorBrush();
                        if (a != 255)
                        {
                            CardColor.Color = System.Windows.Media.Color.FromArgb(0, 255, 255, 255);
                        }
                        else
                        {
                            CardColor.Color = System.Windows.Media.Color.FromArgb(255, 255, 255, 255);
                        }
                        String aa = RGBATo(r, g, b, a, 1);
                        ColorList[0] = aa.ToUpper();
                        this.ColorCard.Background = CardColor;
                        this.Color.Fill           = ChangeColor;
                    }
                    else
                    {
                        Error = true;
                        error.ErrorTo("发现错误(ECC - 003):输入内容无效,请检查。错误内容为……你瞎几把输入了些什么玩意。", Percent, Errorsay);
                        break;
                    }
                }
                break;

                default:
                {
                    Error = true;
                    error.ErrorTo("发现错误(ECC - 004):在判断输入时发生未知错误,错误变量为which,数值为" + which + ",错误类型为无法匹配。", Percent, Errorsay);
                    MessageBoxX.Show("发现错误(ECC - 004),是否反馈。", "错误", Application.Current.MainWindow);
                }
                break;
                }
                ProgressBarHelper.SetAnimateTo(Percent, 100 / 3 * 2);
            }
            ButtonHelper.SetIsWaiting(RunButton, false);
            this.J16.Text  = ColorList[0];
            this.RGBA.Text = ColorList[1];
            if (!Error)
            {
                this.Errorsay.Visibility = Visibility.Collapsed;
                this.RunCard.Visibility  = Visibility.Collapsed;
                this.Percent.Foreground  = ColorFst;
                ProgressBarHelper.SetAnimateTo(Percent, 0);
            }
            Error       = false;
            ErrorString = "";
            which       = 0;
            ColorList   = new string[2];
        }
        public static bool CharacterCreation_ShowDetails(CharacterCreation __instance, ButtonHelper myButton)
        {
            if (__instance.loadMenu.gameObject.activeSelf)
            {
                return(true);
            }

            Image image = null; Text title = null; Text text = null;

            if (myButton.scrollingButtonUnlock.unlockType == UnlockTypes.Item)
            {
                image = __instance.detailsImageItems; title = __instance.detailsTitleItems; text = __instance.detailsTextItems;
            }
            else if (myButton.scrollingButtonUnlock.unlockType == UnlockTypes.Trait)
            {
                image = __instance.detailsImageTraits; title = __instance.detailsTitleTraits; text = __instance.detailsTextTraits;
            }
            else if (myButton.scrollingButtonUnlock.unlockType == UnlockTypes.Ability)
            {
                image = __instance.detailsImageAbilities; title = __instance.detailsTitleAbilities; text = __instance.detailsTextAbilities;
            }
            else if (myButton.scrollingButtonUnlock.unlockType == UnlockTypes.BigQuest)
            {
                image = __instance.detailsImageBigQuests; title = __instance.detailsTitleBigQuests; text = __instance.detailsTextBigQuests;
            }

            if (image != null)
            {
                DisplayedUnlock du = (DisplayedUnlock)myButton.scrollingButtonUnlock.__RogueLibsCustom;

                title.text   = du.GetName();
                text.text    = du.GetFancyDescription();
                image.sprite = du.GetImage();
                image.gameObject.SetActive(image.sprite != null);
            }

            __instance.curSelectedButton    = myButton;
            __instance.curSelectedButtonNum = myButton.scrollingButtonNum;
            return(false);
        }
 private void RevertButtonColors()
 {
     ButtonHelper.RevertColors(btnListaUposlenika, btnNoviUposlenik, btnNoviZahtjev, btnPregledZahtjeva);
 }
Beispiel #18
0
 private void RevertColors()
 {
     ButtonHelper.RevertColors(btnDostupniMaterijal, btnPotroseniMaterijal, btnNoviMaterijal);
 }
Beispiel #19
0
        public Page5()
        {
            InitializeComponent();

            this.Height = 477;

            String stTitle = "F**k QQ";

            this.Title.Foreground = baseColora.Fg;
            this.Title.FontFamily = baseColora.Fonts;;
            this.Title.FontSize   = 17;
            Title.Text            = stTitle;

            String stSays = "这儿是所有QQ相关功能的集合。某些操作需要使用到你的QQ号,请保证此QQ在登录状态。";

            this.Says.Foreground = baseColora.Fg;
            this.Says.FontFamily = baseColora.Fonts;
            this.Says.FontSize   = 14;
            Says.Text            = stSays;

            this.T1.Foreground = baseColora.Fg;
            this.T1.FontFamily = baseColora.Fonts;
            this.T1.FontSize   = 13;
            this.T4.Foreground = baseColora.Fg;
            this.T4.FontFamily = baseColora.Fonts;
            this.T4.FontSize   = 13;
            this.T5.Foreground = baseColora.Fg;
            this.T5.FontFamily = baseColora.Fonts;
            this.T5.FontSize   = 13;
            this.T3.Foreground = baseColora.Fg;
            this.T3.FontFamily = baseColora.Fonts;
            this.T3.FontSize   = 13;

            this.MT2.Foreground = baseColora.Fg;
            this.MT2.FontFamily = baseColora.Fonts;
            this.MT2.FontSize   = 15;
            this.MT3.Foreground = baseColora.Fg;
            this.MT3.FontFamily = baseColora.Fonts;
            this.MT3.FontSize   = 15;

            this.CD1.Background      = baseColora.Card;
            this.RunCard.Background  = baseColora.Card;
            this.HandCard.Background = baseColora.Card;
            this.ColCard.Background  = baseColora.Card;

            this.RunButton.Foreground = baseColora.Fg;
            this.RunButton.Background = baseColora.Tran;
            this.About.Foreground     = baseColora.Fg;
            this.About.Background     = baseColora.Tran;
            this.Chat.Foreground      = baseColora.Fg;
            this.Chat.Background      = baseColora.Tran;

            this.QQ.Background  = baseColora.Bg;
            this.QQY.Background = baseColora.Bg;
            this.QQ.Foreground  = baseColora.Fg;
            this.QQY.Foreground = baseColora.Fg;


            ButtonHelper.SetHoverBrush(RunButton, baseColora.DBg);

            this.Percent.Background = baseColora.DBg;

            this.RunCard.Visibility  = Visibility.Collapsed;
            this.Errorsay.Visibility = Visibility.Collapsed;
            this.HandCard.Visibility = Visibility.Collapsed;
            this.ColCard.Visibility  = Visibility.Collapsed;
        }
        public static void ExecuteScript(IPage pageObject, string xlPath, string text)
        {
            // var totalRow = ExcelReaderHelper.GetTotalRows(xlPath, sheetName);
            // for (var i = 2; i < totalRow; i++)
            // {
            var action = "";    //ExcelReaderHelper.GetCellValue(xlPath, sheetName, i, 1);
            var webEle = "";    //ExcelReaderHelper.GetCellValue(xlPath, sheetName, i, 2);


            var locator = pageObject.GetLocatorOfWebElement(webEle);

            Log.Info("Action " + action + ", WebElement " + webEle + ", Locator  " + locator);
            switch (action)
            {
            case "SendKeys":
            {
                // var text = ExcelReaderHelper.GetCellValue(xlPath, sheetName, i, 3);
                TextBoxHelper.TypeInTextBox(locator, text);
            }
            break;

            case "ClearAndSendKeys":
            {
                //var text = ExcelReaderHelper.GetCellValue(xlPath, sheetName, i, 3);
                TextBoxHelper.ClearTextBox(locator);
                TextBoxHelper.TypeInTextBox(locator, text);
            }
            break;

            case "Click":
            {
                ButtonHelper.ClickButton(locator);
            }
            break;

            case "ClickIfExist":
            {
                if (GenericHelper.IsElementPresentQuick(locator))
                {
                    ButtonHelper.ClickButton(locator);
                }
            }
            break;

            case "Select":
            {
                // var text = ExcelReaderHelper.GetCellValue(xlPath, sheetName, i, 3);
                DropDownHelper.SelectByVisibleText(locator, text);
            }
            break;

            case "SelectIndex":
            {
                //var text = ExcelReaderHelper.GetCellValue(xlPath, sheetName, i, 3);
                DropDownHelper.SelectByIndex(locator, Convert.ToInt32(text));
            }
            break;

            case "WaitForEle":
            {
                //  var text = ExcelReaderHelper.GetCellValue(xlPath, sheetName, i, 3);
                if (text == string.Empty)
                {
                    GenericHelper.WaitForElement(locator);
                }
                else
                {
                    GenericHelper.WaitForElement(locator, Convert.ToInt32(text));
                }
            }
            break;

            case "Sleep":
            {
                // var text = ExcelReaderHelper.GetCellValue(xlPath, sheetName, i, 3);
                Thread.Sleep(Convert.ToInt32(text));
            }
            break;

            case "SelectFile":
            {
                // var text = ExcelReaderHelper.GetCellValue(xlPath, sheetName, i, 3);
                pageObject.FileUpload(text);
            }
            break;

            case "AssertTitle":
            {
                // var text = ExcelReaderHelper.GetCellValue(xlPath, sheetName, i, 3);
                Assert.AreEqual(text, ObjectRepository.Driver.Title);
            }

            break;

            case "PerformClick":
            {
                MouseActionHelper.PerformClick(locator);
            }
            break;

                // }
            }
        }
Beispiel #21
0
 public void wlll()
 {
     // Test name: wlll
     // Step # | name | target | value | comment
     // 1 | open | /login?returnUrl=%2F |  |
     NavigationHelper.NavigateToUrl("http://support.charmhealth.com.au:492/login?returnUrl=%2F");
     // 2 | setWindowSize | 1720x934 |  |
     // driver.Manage().Window.Size = new System.Drawing.Size(1720, 934);
     // 3 | click | css=.form-group:nth-child(1) > .form-control |  |
     ButtonHelper.ClickButton(By.CssSelector(".form-group:nth-child(1) > .form-control"));
     // 4 | type | css=.ng-valid | chadmin |
     TextboxHelper.TypeInTextbox(By.CssSelector(".ng-valid"), "chadmin");
     // 5 | type | css=.ng-untouched | j06 |
     TextboxHelper.TypeInTextbox(By.CssSelector(".ng-untouched"), "j06");
     // 6 | click | css=.btn-outline-primary |  |
     ButtonHelper.ClickButton(By.CssSelector(".btn-outline-primary"));
     // 7 | click | name=search |  |
     ButtonHelper.ClickButton(By.Name("search"));
     // 8 | type | name=search | smith |
     TextboxHelper.TypeInTextbox(By.Name("search"), "smith");
     // 9 | click | css=.iconic-magnifying-glass |  |
     ButtonHelper.ClickButton(By.CssSelector(".iconic-magnifying-glass"));
     // 10 | click | css=.ng-star-inserted:nth-child(1) > .ng-star-inserted > .inline .ng-star-inserted:nth-child(2) > .ng-star-inserted |  |
     ButtonHelper.ClickButton(By.CssSelector(".ng-star-inserted:nth-child(1) > .ng-star-inserted > .inline .ng-star-inserted:nth-child(2) > .ng-star-inserted"));
     // 11 | click | css=.active .ng-star-inserted:nth-child(2) > .ng-star-inserted |  |
     ButtonHelper.ClickButton(By.CssSelector(".active .ng-star-inserted:nth-child(2) > .ng-star-inserted"));
     // 12 | click | css=.col-3 > .form-control-plaintext |  |
     ButtonHelper.ClickButton(By.CssSelector(".col-3 > .form-control-plaintext"));
     // 13 | mouseOver | css=#bannerBtnLv1MedLists > .iconic-list |  |
     {
         var     element = driver.FindElement(By.CssSelector("#bannerBtnLv1MedLists > .iconic-list"));
         Actions builder = new Actions(driver);
         builder.MoveToElement(element).Perform();
     }
     // 14 | mouseOut | css=#bannerBtnLv1MedLists > .iconic-list |  |
     {
         var     element = ObjectRepository.Driver.FindElement(By.TagName("body"));
         Actions builder = new Actions(driver);
         builder.MoveToElement(element, 0, 0).Perform();
     }
     // 15 | mouseOver | id=bannerBtnLv1MedLists |  |
     {
         var     element = ObjectRepository.Driver.FindElement(By.Id("bannerBtnLv1MedLists"));
         Actions builder = new Actions(driver);
         builder.MoveToElement(element).Perform();
     }
     // 16 | mouseOut | id=bannerBtnLv1MedLists |  |
     {
         var     element = ObjectRepository.Driver.FindElement(By.TagName("body"));
         Actions builder = new Actions(driver);
         builder.MoveToElement(element, 0, 0).Perform();
     }
     // 17 | click | name=search |  |
     ButtonHelper.ClickButton(By.Name("search"));
     // 18 | type | name=search | smith |
     TextboxHelper.TypeInTextbox(By.Name("search"), "smith");
     // 19 | click | css=.btn-primary:nth-child(4) |  |
     ButtonHelper.ClickButton(By.CssSelector(".btn-primary:nth-child(4)"));
     // 20 | click | css=.list-group-item:nth-child(1) .list-view-pf-main-info:nth-child(3) |  |
     ButtonHelper.ClickButton(By.CssSelector(".list-group-item:nth-child(1) .list-view-pf-main-info:nth-child(3)"));
     // 21 | click | css=.iconic-people |  |
     ButtonHelper.ClickButton(By.CssSelector(".iconic-people"));
     // 22 | click | css=.list-group-item:nth-child(2) .flex-1 |  |
     ButtonHelper.ClickButton(By.CssSelector(".list-group-item:nth-child(2) .flex-1"));
     // 23 | click | css=.navbar-brand > .ng-tns-c1-0 |  |
     ButtonHelper.ClickButton(By.CssSelector(".navbar-brand > .ng-tns-c1-0"));
     // 24 | click | css=.navbar-brand > .ng-tns-c1-0 |  |
     ButtonHelper.ClickButton(By.CssSelector(".navbar-brand > .ng-tns-c1-0"));
     // 25 | click | css=.iconic-home |  |
     ButtonHelper.ClickButton(By.CssSelector(".iconic-home"));
     // 26 | click | css=.iconic-share |  |
     ButtonHelper.ClickButton(By.CssSelector(".iconic-share"));
     // 27 | click | name=search |  |
     ButtonHelper.ClickButton(By.Name("search"));
     // 28 | type | name=search | smith |
     TextboxHelper.TypeInTextbox(By.Name("search"), "smith");
     // 29 | sendKeys | name=search | ${KEY_ENTER} |
     TextboxHelper.TypeInTextbox(By.Name("search"), Keys.Enter);
     // 30 | close |  |  |
 }
 public void LogIn(string userName, string password)
 {
     TextBoxHelper.TypeInTextBox(EmailAddressTxtBox, userName);
     TextBoxHelper.TypeInTextBox(PasswordTxtBox, password);
     ButtonHelper.ClickButton(SignInBtn);
 }
Beispiel #23
0
        public KillSTL()
        {
            InitializeComponent();
            Height  = 500;
            Topmost = true;

            this.T20.Text = "这就是一个超级简单的、超级普通的、超级正常的养成对战类回合制文字游戏 / ?,灵感来自STL。同时这也是SSTB内涵的第一个游戏为主的彩蛋。";
            this.T19.Text = "相杀象征相爱\nBy Stapx Steve [ 林槐 ] @2019 / 版权所有";

            setTitle(version);
            this.T2.Text  = "Version - " + version;
            this.T18.Text = "Version - " + version;

            WindowXCaption.SetBackground(this, baseColora.Main);
            WindowXCaption.SetForeground(this, baseColora.FontM);

            BG.BeginInit();
            BG.Source = baseColora.Bgpa;
            BG.EndInit();
            BG1.BeginInit();
            BG1.Source = baseColora.Bgpa;
            BG1.EndInit();
            BG2.BeginInit();
            BG2.Source = baseColora.Bgpa;
            BG2.EndInit();

            this.TT.Foreground = baseColora.Main;

            this.T.Foreground   = baseColora.Fg;
            this.T1.Foreground  = baseColora.Fg;
            this.T2.Foreground  = baseColora.Fg;
            this.T3.Foreground  = baseColora.Fg;
            this.T4.Foreground  = baseColora.Fg;
            this.T5.Foreground  = baseColora.Fg;
            this.T6.Foreground  = baseColora.Fg;
            this.T7.Foreground  = baseColora.Fg;
            this.T8.Foreground  = baseColora.Fg;
            this.T9.Foreground  = baseColora.Fg;
            this.T10.Foreground = baseColora.Fg;
            this.T11.Foreground = baseColora.Fg;
            this.T12.Foreground = baseColora.Fg;
            this.T13.Foreground = baseColora.Fg;
            this.T14.Foreground = baseColora.Fg;
            this.T15.Foreground = baseColora.Fg;
            this.T16.Foreground = baseColora.Fg;
            this.T17.Foreground = baseColora.Fg;
            this.T18.Foreground = baseColora.Fg;
            this.T19.Foreground = baseColora.Fg;
            this.T20.Foreground = baseColora.Fg;

            this.TopIcon.Background = baseColora.Main;
            this.TopIcon.Foreground = baseColora.FontM;
            ButtonHelper.SetHoverBrush(TopIcon, baseColora.Main);
            ButtonHelper.SetClickCoverOpacity(TopIcon, 1);

            this.RunButton.Foreground = baseColora.Font;
            this.RunButton.Background = baseColora.Tran;
            ButtonHelper.SetHoverBrush(RunButton, baseColora.Main);
            this.Pass.Foreground = baseColora.Font;
            this.Pass.Background = baseColora.DBg;
            ButtonHelper.SetHoverBrush(Pass, baseColora.Main);
            this.Exit.Foreground = baseColora.Font;
            this.Exit.Background = baseColora.DBg;
            ButtonHelper.SetHoverBrush(Exit, baseColora.Main);
            this.Hits.Foreground = baseColora.Font;
            this.Hits.Background = baseColora.DBg;
            ButtonHelper.SetHoverBrush(Hits, baseColora.Main);

            this.MainTab.Background = baseColora.Bg;
            this.MainTab.Foreground = baseColora.Fg;
            TabControlHelper.SetHeaderPanelBackground(MainTab, baseColora.DBg);
            TabControlHelper.SetItemIcon(MainTab, baseColora.DBg);
            TabControlHelper.SetSelectedBackground(MainTab, baseColora.Bg);
            TabControlHelper.SetSelectedForeground(MainTab, baseColora.Fg);
            this.GameTab.Background = baseColora.Bg;
            this.GameTab.Foreground = baseColora.Fg;
            TabControlHelper.SetHeaderPanelBackground(GameTab, baseColora.DBg);
            TabControlHelper.SetItemIcon(GameTab, baseColora.DBg);
            TabControlHelper.SetSelectedBackground(GameTab, baseColora.Bg);
            TabControlHelper.SetSelectedForeground(GameTab, baseColora.Fg);

            this.Hit.Background = baseColora.DBg;
            this.Hit.Foreground = baseColora.Fg;
            ComboBoxHelper.SetShadowColor(Hit, baseColora.Bg.Color);
            ComboBoxHelper.SetHoverBackground(Hit, baseColora.Bg);
            ComboBoxHelper.SetHoverForeground(Hit, baseColora.Fg);
            ComboBoxHelper.SetSelectedBackground(Hit, baseColora.DBg);
            ComboBoxHelper.SetSelectedForeground(Hit, baseColora.Fg);
            this.Do.Background = baseColora.DBg;
            this.Do.Foreground = baseColora.Fg;
            ComboBoxHelper.SetShadowColor(Do, baseColora.Bg.Color);
            ComboBoxHelper.SetHoverBackground(Do, baseColora.Bg);
            ComboBoxHelper.SetHoverForeground(Do, baseColora.Fg);
            ComboBoxHelper.SetSelectedBackground(Do, baseColora.DBg);
            ComboBoxHelper.SetSelectedForeground(Do, baseColora.Fg);
            this.Give.Background = baseColora.DBg;
            this.Give.Foreground = baseColora.Fg;
            ComboBoxHelper.SetShadowColor(Give, baseColora.Bg.Color);
            ComboBoxHelper.SetHoverBackground(Give, baseColora.Bg);
            ComboBoxHelper.SetHoverForeground(Give, baseColora.Fg);
            ComboBoxHelper.SetSelectedBackground(Give, baseColora.DBg);
            ComboBoxHelper.SetSelectedForeground(Give, baseColora.Fg);

            this.BagBD.Background = baseColora.DBg;
            ListViewItem listViewItem = new ListViewItem();

            listViewItem.Name = "空";
            TextBlock textBlock = new TextBlock();

            textBlock.Text       = "  空";
            textBlock.Foreground = baseColora.Font;
            textBlock.FontSize   = 14;
            listViewItem.Content = textBlock;
            Bag.Items.Add(listViewItem);

            this.Health.Background = baseColora.DBg;
            this.Health.Foreground = baseColora.Main;
            this.Love.Background   = baseColora.DBg;
            this.Love.Foreground   = baseColora.Main;
            this.Hug.Background    = baseColora.DBg;
            this.Hug.Foreground    = baseColora.Main;
            this.Duang.Background  = baseColora.DBg;
            this.Duang.Foreground  = baseColora.Main;

            this.yHealth.Background = baseColora.DBg;
            this.yHealth.Foreground = baseColora.Main;
            this.yLove.Background   = baseColora.DBg;
            this.yLove.Foreground   = baseColora.Main;
            this.yHug.Background    = baseColora.DBg;
            this.yHug.Foreground    = baseColora.Main;
            this.yDuang.Background  = baseColora.DBg;
            this.yDuang.Foreground  = baseColora.Main;

            this.Run.Background = baseColora.DBg;
            this.Run.Foreground = baseColora.Fg;

            CMD.Foreground    = baseColora.Font;
            CMDCOL.Foreground = baseColora.Font;

            this.MainGame.Visibility = Visibility.Collapsed;

            CMDIN.Visibility = Visibility.Collapsed;

            if (PageHD2.opin)
            {
                you = "Stapx Steve";
                op  = true;
            }

            customHit.Add(new customerHit()
            {
                ID = 0, Name = "  - 空 -", ShowName = "空", Hit = 0, HitMax = 0, Love = 0, LoveMax = 0, Hug = 0, HugMax = 0, Duang = 0, DuangMax = 0
            });
            customHit.Add(new customerHit()
            {
                ID = 1, Name = "  - 轻拳 -", ShowName = "轻拳", Hit = -10, HitMax = -5, Love = -1, LoveMax = 0, Hug = -45, HugMax = -25, Duang = 1, DuangMax = 2
            });
            Hit.ItemsSource       = customHit;
            Hit.DisplayMemberPath = "Name";
            Hit.SelectedValuePath = "ID";
            Hit.SelectedValue     = 0;

            customGive.Add(new customerGive()
            {
                ID = 0, Name = "  - 空 -", ShowName = "空", Hit = 0, HitMax = 0, Love = 0, LoveMax = 0, Hug = 0, HugMax = 0, Buff = "", BuffPes = 0
            });
            customGive.Add(new customerGive()
            {
                ID = 1, Name = "  - 面包 -", ShowName = "面包", Hit = 0, HitMax = 0, Love = 0, LoveMax = 2, Hug = 10, HugMax = 10, Buff = "吃撑", BuffPes = 5
            });
            Give.ItemsSource       = customGive;
            Give.DisplayMemberPath = "Name";
            Give.SelectedValuePath = "ID";
            Give.SelectedValue     = 0;

            customDo.Add(new customerDo()
            {
                ID = 0, Name = "  - 空 -", ShowName = "空", Hit = 0, HitMax = 0, Love = 0, LoveMax = 0, Hug = 0, HugMax = 0, Buff = "", BuffPes = 0
            });
            customDo.Add(new customerDo()
            {
                ID = 1, Name = "  - 捏捏 -", ShowName = "捏捏", Hit = 0, HitMax = 0, Love = 0, LoveMax = 2, Hug = -5, HugMax = -2, Buff = "", BuffPes = 0
            });
            Do.ItemsSource       = customDo;
            Do.DisplayMemberPath = "Name";
            Do.SelectedValuePath = "ID";
            Do.SelectedValue     = 0;
        }
 public VacationRentals NavigateToVacationRentals()
 {
     ButtonHelper.ClickButton(VacationRentals_Hmenu);
     return(new VacationRentals(driver));
 }
Beispiel #25
0
        //private void ClearBasket()
        //{
        //    ButtonHelper.ClickButtonPrev(Manager.Driver);
        //    DimensionWCServices dimension = new DimensionWCServices(Manager);
        //    dimension.GetDimensions().GetFieldByDescription("A").PlusSign.ClickIfElementIsClickable(Manager.Driver);
        //    //DriverManager.AcceptAlert();
        //    ButtonHelper.ClickButtonNext(Manager.Driver);
        //}
        #region HelpersMethod

        private void GoToSecondStep()
        {
            homeServices.GetHomePageModel().StartButton.ClickIfElementIsClickable(Manager.Driver);
            ButtonHelper.ClickButtonNext(Manager.Driver);
        }
 public SignIn NavigateToSignIn()
 {
     ButtonHelper.ClickButton(AccountMenu);
     ButtonHelper.ClickButton(SignInMenuBtn);
     return(new SignIn(driver));
 }
 public void clicarBuscar()
 {
     ButtonHelper.ClickButton(btnBuscar);
     //Reporter.AddLogStep("buscar");
     //Thread.Sleep(3000);
 }
 public void ThenILogoutFromTheApplication()
 {
     ButtonHelper.Logout();
 }
        public static bool CharacterCreation_PushedButton(CharacterCreation __instance, ButtonHelper myButton)
        {
            bool debug = RogueFramework.IsDebugEnabled(DebugFlags.UnlockMenus);

            if (__instance.selectedSpace == "Load")
            {
                if (debug)
                {
                    RogueFramework.LogDebug("Redirecting the button push to the original method.");
                }
                return(true);
            }

            if (debug)
            {
                RogueFramework.LogDebug($"Pressing \"{myButton.myText.text}\" ({myButton.scrollingButtonNum}, {myButton.scrollingButtonType}) button.");
            }

            string            type        = myButton.scrollingButtonUnlock.unlockType;
            List <ButtonData> buttonsData = type == UnlockTypes.Item ? __instance.buttonsDataItems
                                : type == UnlockTypes.Trait ? __instance.buttonsDataTraits
                                : type == UnlockTypes.Ability ? __instance.buttonsDataAbilities
                                : type == UnlockTypes.BigQuest ? __instance.buttonsDataBigQuests : null;

            ButtonData      buttonData = buttonsData[myButton.scrollingButtonNum];
            DisplayedUnlock du         = (DisplayedUnlock)buttonData.__RogueLibsCustom;

            try { du.OnPushedButton(); }
            catch (Exception e) { RogueFramework.LogError(e, "DisplayedUnlock.OnPushedButton", du, du.Menu); }
            __instance.curSelectedButton    = myButton;
            __instance.curSelectedButtonNum = myButton.scrollingButtonNum;
            return(false);
        }
Beispiel #30
0
        void bw_RunWorkerCompleted(object sender, System.ComponentModel.RunWorkerCompletedEventArgs e)
        {
            //取消后台登录
            if (this.cancellationOperation)
            {
                this.cancellationOperation = false; //恢复以前状态
                return;                             //截断
            }

            switch (feedBack)
            {
            case 1:
                //登录成功
                //获取新的登录信息
                var userInfo = new UserInfo
                {
                    AutomaticLogon = (bool)this.checkBox2.IsChecked,
                    RememberPwd    = (bool)this.checkBox1.IsChecked,
                    UserName       = AccountNmaeTxt.Text.Trim(),
                    UserPwd        = PwdTxt.Password.Trim(),
                };
                if (!(bool)this.checkBox1.IsChecked)
                {
                    userInfo.UserPwd = "";
                }
                listUserInfo.Remove(listUserInfo.FirstOrDefault(u => u.UserName == userInfo.UserName));
                listUserInfo.Insert(0, userInfo);
                //保存登录信息
                loginInfoXmlHelper.CreateXml(listUserInfo.ToList());
                HomeWindow home = new HomeWindow();
                home.Show();
                this.Close();
                break;

            case 0:
                MessageBox.Show("登录失败!", "系统提示", MessageBoxButton.OK, MessageBoxImage.Error);
                break;

            case -1:
                System.Windows.MessageBox.Show("数据库未连接!", "系统提示", System.Windows.MessageBoxButton.OK, System.Windows.MessageBoxImage.Error);
                ButtonHelper.SetIsWaiting(this.LoginBtn, false);
                break;

            case -2:
                System.Windows.MessageBox.Show("用户名不能为空!", "系统提示", System.Windows.MessageBoxButton.OK, System.Windows.MessageBoxImage.Information);
                ButtonHelper.SetIsWaiting(this.LoginBtn, false);
                break;

            case -3:
                System.Windows.MessageBox.Show("密码不能为空!", "系统提示", System.Windows.MessageBoxButton.OK, System.Windows.MessageBoxImage.Information);
                ButtonHelper.SetIsWaiting(this.LoginBtn, false);
                break;

            case -4:
                System.Windows.MessageBox.Show("密码含有特殊字符!", "系统提示", System.Windows.MessageBoxButton.OK, System.Windows.MessageBoxImage.Information);
                break;

            //case -5:
            //    System.Windows.MessageBox.Show("用户名不正确!", "系统提示", System.Windows.MessageBoxButton.OK, System.Windows.MessageBoxImage.Information);
            //    break;
            case -6:
                System.Windows.MessageBox.Show("用户名或密码不正确!", "系统提示", System.Windows.MessageBoxButton.OK, System.Windows.MessageBoxImage.Information);
                ButtonHelper.SetIsWaiting(this.LoginBtn, false);
                break;

            default:
                MessageBox.Show("未知错误!", "系统提示", MessageBoxButton.OK, MessageBoxImage.Error);
                ButtonHelper.SetIsWaiting(this.LoginBtn, false);
                break;
            }
        }
 /// <summary>
 /// Renders a Twitter Bootstrap Button Component
 /// </summary>
 /// <param name="helper">The helper.</param>
 /// <param name="text">The text.</param>
 /// <param name="action">The action.</param>
 /// <param name="controller">The controller.</param>
 /// <param name="status">The status.</param>
 /// <param name="htmlAttributes">The HTML attributes.</param>
 /// <returns></returns>
 public static MvcHtmlString Button(this HtmlHelper helper, string text, string action, string controller="", ButtonStatus status = ButtonStatus.Default, object htmlAttributes = null)
 {
     ButtonHelper button = new ButtonHelper(helper, GetStatusStrategy(status), text, action, controller, status, htmlAttributes);
     return new MvcHtmlString(button.Render());
 }