Beispiel #1
0
        private void ButtonActions(IButton element)
        {
            switch (ElementAction)
            {
            case eElementAction.Click:
                element.Click();
                break;

            case eElementAction.Submit:     // !!!!!!!!!!! remove from here need special handling ??!!
                element.Submit();
                break;

            case eElementAction.GetValue:

                AOVs.Add(new NodeActionOutputValue()
                {
                    Param = "Actual", Value = element.GetValue()
                });
                break;

            case eElementAction.ClickAndValidate:     // !!!!!!!!!!! remove from here need special handling ??!!
                ClickActions(element, eElementAction.ClickAndValidate);
                break;
            }
        }
Beispiel #2
0
 public HomePage Login(TestData data)
 {
     Username.Type(data.LoginDetails.Username);
     Password.Type(data.LoginDetails.Password);
     Submit.Click();
     return(new HomePage(Browser));
 }
Beispiel #3
0
        public void Start()
        {
            _button   = _factory.CreateButton();
            _checkbox = _factory.CreateCheckbox();

            _button.Click();
            Console.ReadKey();
        }
Beispiel #4
0
        public void Login()
        {
            //var logob = new LoginPage();


            username_input.Keys("Tester");
            password_input.Keys("test");
            submitButton.Click();
        }
        public CalculatorWindow Click(string buttonName)
        {
            switch (buttonName)
            {
            case "One":
                oneButton.Click();
                break;

            case "Two":
                twoButton.Click();
                break;

            case "Three":
                threeButton.Click();
                break;

            case "Six":
                sixButton.Click();
                break;

            case "Nine":
                nineButton.Click();
                break;

            case "Add":
                addButton.Click();
                break;

            case "Minus":
                minusButton.Click();
                break;

            case "Multiply":
                multiplyButton.Click();
                break;

            case "Calc":
                calcButton.Click();
                break;

            case "Clear":
                clearButton.Click();
                break;

            case "Off":
                offButton.Click();
                break;

            default:
                onButton.Click();
                break;
            }
            return(this);
        }
 private void AssertLocatorIs(IButton button, string expectedLocator)
 {
     if (expectedLocator == null) throw new ArgumentNullException("expectedLocator");
     string actualLocator = null;
     _seleniumMock
         .Setup(x => x.Click(It.IsAny<string>()))
         .Callback<string>(s => actualLocator = s);
     button.Click();
     Assert.That(actualLocator, Is.Not.Null, "Guard");
     Assert.That(actualLocator, Is.EqualTo(expectedLocator));
 }
        public void ChangeSelectedValueOfDDLFromButton()
        {
            IButton     selectNewDDLValue = Browser.Button("selectNewDDLValue");
            IButton     selectNewDDLValueUsingSelectedProperty = Browser.Button("selectNewDDLValueUsingSelectedProperty");
            ISelectList dropDownListCallback = Browser.SelectList("dropDownListCallback");

            selectNewDDLValue.Click();
            Assert.AreEqual(3, dropDownListCallback.SelectedOption.Index);
            Assert.AreEqual("Text of fourth", dropDownListCallback.SelectedItem);

            selectNewDDLValueUsingSelectedProperty.Click();
            Assert.AreEqual(2, dropDownListCallback.SelectedOption.Index);
            Assert.AreEqual("Text of third", dropDownListCallback.SelectedItem);
        }
        public void ClickButtonDirect()
        {
            // Arrange


            // Act
            IButton elem = (IButton)webPlatform.LocateWebElement.LocateElementByID(Ginger.Plugin.Platform.Web.Elements.eElementType.Button, "button1");

            elem.Click();


            //Assert
            // Assert.AreEqual(url, browserurl, "URL of naviagte equel browser url");
        }
Beispiel #9
0
 public void FillAndSubmitForm(string firstName, string secondName, string description)
 {
     FillForm(firstName, secondName, description);
     ContactSubmit.Click();
 }
Beispiel #10
0
 public bool PlaceOrder()
 {
     return(PlaceOrderButton.Click());
 }
Beispiel #11
0
        public void TestMethod1()
        {
            try
            {
                //Set reporter to take all snapshots
                Reporter.SnapshotCaptureLevel = HP.LFT.Report.CaptureLevel.All;

                //Navigate to Search Engine
                browser.Navigate("www.duckduckgo.com");

                //Search for Learn2Automate blog
                IEditField txtSearch = browser.Describe <IEditField>(new EditFieldDescription
                {
                    Type    = "text",
                    TagName = "INPUT",
                    Name    = "q"
                });
                txtSearch.SetValue("learn2automate");

                IButton btnSearch = browser.Describe <IButton>(new ButtonDescription
                {
                    ButtonType = "submit",
                    TagName    = "INPUT",
                    Name       = "S"
                });
                btnSearch.Click();


                //Select the first search result
                ILink firstResult = browser.Describe <ILink>(new LinkDescription
                {
                    TagName   = "A",
                    InnerText = As.RegExp(".*learn2automate.*"),
                    Index     = 0
                });

                Assert.IsTrue(firstResult.Exists(10));

                firstResult.Click();

                //Search for LeanFT if the blog opens
                IEditField searchBox = browser.Describe <IEditField>(new EditFieldDescription
                {
                    Type    = "text",
                    TagName = "INPUT",
                    Name    = "s"
                });

                Assert.IsTrue(searchBox.Exists(10));

                searchBox.SetValue("leanft");

                IButton goButton = browser.Describe <IButton>(new ButtonDescription
                {
                    ButtonType = "submit",
                    TagName    = "INPUT",
                    Name       = "Go"
                });

                goButton.Click();

                //Verify that the blog entry with title LeanFT opens
                ILink blogResult = browser.Describe <ILink>(new LinkDescription
                {
                    TagName   = "A",
                    InnerText = As.RegExp(".*leanfT.*"),
                    Index     = 0
                });

                Assert.IsTrue(blogResult.Exists(10));
                blogResult.Highlight();
            }
            catch (Exception e)
            {
                Reporter.ReportEvent("Look for LeanFT on Lean2Automate", e.Message);
            }
        }
Beispiel #12
0
 public void ClickTest()
 {
     _button.Click();
     CommonActionsData.CheckCalculate("Summary: 3");
 }
Beispiel #13
0
 public V2OHomePage GotoValleyV2O()
 {
     GotoValleyButton.Click();
     return(new V2OHomePage(Browser));
 }
Beispiel #14
0
 public void Click()
 {
     _button.Click();
 }
Beispiel #15
0
        public void TestMethod1()
        {
            // Following is the program flow:
            // 1. Launch notepad.
            // 2. Open the Format > Font menu item.
            // 3. Select "Arial" from the Font combobox.
            // 4. Use the Assert statement to verify that "Arial" is the selected font in the combobox.

            // Locate the Notepad window and assign it to an IWindow object.
            IWindow notepadWindow = Desktop.Describe <IWindow>(new WindowDescription
            {
                WindowClassRegExp = "Notepad",
                WindowTitleRegExp = " Notepad"
            });

            // Locate the Notepad menu and assign it to an IMenu object.
            IMenu notepadMenu = notepadWindow.Describe <IMenu>(new MenuDescription(MenuType.Menu));

            // Build the path for the Font menu item. (The second item in the Format menu in Notepad)
            var path = notepadMenu.BuildMenuPath("Format", 2);

            // Use the path to retrieve the actual Font menu item object.
            var menuItem = notepadMenu.GetItem(path);

            //Open the Font dialog using the font menu item.
            notepadMenu.Select(menuItem);

            // Locate the Font dialog box and assign it to an IDialog object.
            IDialog notepadFontDialog = notepadWindow.Describe <IDialog>(new DialogDescription
            {
                WindowTitleRegExp = "Font"
            });

            // Locate the Font combobox in the Font dialog box and assign it to an IComboBox object.
            IComboBox fontsComboBox = notepadFontDialog.Describe <IComboBox>(new ComboBoxDescription
            {
                AttachedText = @"&Font:",
                NativeClass  = @"ComboBox"
            });

            // Select "Arial" font in the combobox
            fontsComboBox.Select("Arial");

            // Get the selected combobox item
            var selectedFont = fontsComboBox.SelectedItem;

            // Verify the selected combobox item is "Arial"
            Assert.AreEqual("Arial", selectedFont);

            // Locate the Cancel button in the dialog box and assign it to an IButton object.
            IButton cancelButton = notepadFontDialog.Describe <IButton>(new ButtonDescription
            {
                Text        = @"Cancel",
                NativeClass = @"Button"
            });

            // Clicks "Cancel" in the dialog box.
            cancelButton.Click();

            IEditor theEditor = notepadWindow.Describe <IEditor>(new EditorDescription
            {
                NativeClass = @"Edit"
            });

            String junk_str = "Hi Meir,\nHow are you?\nThe Download & Installation of LeanFT and VS2013 went without \ntoo much"
                              + " trouble....... \nAnd it works nicely too! \nBye (-:";

            char[]       charsRead = new char[junk_str.Length];
            StringReader sr        = new StringReader(junk_str);

            sr.Read(charsRead, 0, junk_str.Length);

            foreach (char c in charsRead)
            {
                theEditor.SendKeys(c.ToString());
            }


            // Build the path for the Exit menu item. (The seventh item in the File menu in Notepad)

            /*
             * path = notepadMenu.BuildMenuPath("File", 7);
             * menuItem = notepadMenu.GetItem(path);
             *
             * // Exits and closes Notepad.
             * notepadMenu.Select(menuItem);
             */
        }
 public void ClickSearchButton()
 {
     searchbutton = getSearchButton();
     searchbutton.Click();
 }
 public void SubmitSearch(string query)
 {
     TypeQuery(query);
     startSearchButton.Click();
 }
 public void OpenSettings()
 {
     settingsButton.Click();
 }
Beispiel #19
0
 public void TapLogin() => loginBtn.Click();
Beispiel #20
0
 public void Click(IButton frame)
 {
     this.MouseOver(frame);
     frame.Click();
 }
Beispiel #21
0
 public void TapOk() => okBtn.Click();
Beispiel #22
0
 public void SearchProduct(string productName)
 {
     VISite.Logger.Event("SearchProduct: " + productName);
     SearchTextField.NewInput(productName);
     SearchButton.Click();
 }
Beispiel #23
0
        public void Verify_CounterShowsNumberOfButtonClicks()
        {
            int numOfClicks = 10;

            // Launch the browser and navigate to site.
            var browser = BrowserFactory.Launch(BrowserType.Chrome);

            browser.Navigate("http://shaharbehagenmail.wix.com/tutoring-company");

            // Wait for the browser to complete the navigation.
            browser.Sync();

            try
            {
                IFrame frame = browser.Describe <IFrame>(new FrameDescription
                {
                    Id    = string.Empty,
                    Name  = string.Empty,
                    Index = 2
                });

                IButton butt = frame.Describe <IButton>(new ButtonDescription
                {
                    ButtonType = @"button",
                    TagName    = @"BUTTON",
                    Name       = @"Click Me"
                });

                IWebElement counter = frame.Describe <IWebElement>(new WebElementDescription
                {
                    TagName = @"H1",
                    // InnerText = @"1" // Cannot use InnerText to describe object, since changes during the test.
                });

                // Give it a few good Buttkicks!
                for (int i = 0; i < numOfClicks; i++)
                {
                    butt.Click();
                }

                // (Is this necessary here?)
                browser.Sync();

                // Verify that the web page counter shows the number of clicks we just clicked.
                int presentedCounter = Int32.Parse(counter.InnerText);

                Assert.AreEqual(numOfClicks, presentedCounter);

                Reporter.ReportEvent("Verify_CounterShowsNumberOfButtonClicks", "Passed validation", Status.Passed);
            }
            catch (AssertFailedException e) //catch (AssertionException e)
            // Add a log message to the results report on failure.
            {
                Reporter.ReportEvent("Verify_CounterShowsNumberOfButtonClicks", "Failed during validation", Status.Failed, e);
                throw;
            }
            finally
            {
                browser.Close();
            }
        }
 public void OpenTwoButtonsDialog() => twoButtonsDialogButton.Click();
Beispiel #25
0
 public void ClickUI()
 {
     button.Click();
 }
        public void Run(IBrowser browser)
        {
            using (browser)
            {
                foreach (Command command in commands)
                {
                    bool result = false;
                    switch (command.Action)
                    {
                    case "open":
                    {
                        string url = string.Format("{0}{1}.aspx", FairyTalesUrl, command.Subject);

                        browser.GoTo(url);
                        result = browser.Url == url;
                    }
                    break;

                    case "check":
                    {
                        if (command.Subject == "ActiveProject")
                        {
                            ISpan span = browser.Span("ctl00_ContentPlaceHolder1_activeProject");
                            if (span.Exists)
                            {
                                result = span.Text == command.Argument.Replace("\"", "");
                            }
                        }
                    }
                    break;

                    case "enter":
                    {
                        if (command.Subject == "ProjectInput")
                        {
                            string     input        = command.Argument.Replace("\"", "");
                            ITextField projectInput = browser.TextField("ctl00_ContentPlaceHolder1_projectInput");
                            if (projectInput.Exists)
                            {
                                projectInput.Value = input;
                                result             = projectInput.Value == input;
                            }
                        }
                    }
                    break;

                    case "press":
                    {
                        if (command.Subject == "AddProject")
                        {
                            IButton button = browser.Button("ctl00_ContentPlaceHolder1_addProjectButton");
                            if (button.Exists)
                            {
                                button.Click();
                                result = true;
                            }
                        }
                    }
                    break;
                    }
                    results.Add(command.ToString(), result);
                }
            }
            results["close"] = true;
        }
Beispiel #27
0
 public void CloseSettings()
 {
     closeButton.Click();
 }
Beispiel #28
0
 public ProjectManagementPage GotoBlueprint()
 {
     BlueprintButton.Click();
     return(new ProjectManagementPage(Browser));
 }