Exemple #1
0
        public void JavascriptClick()
        {
            HyperLink Element = Service.LocateWebElement.LocateElementByXPath(eElementType.HyperLink, "/html/body/table/tbody/tr[3]/td[3]/a") as HyperLink;

            Element.JavascriptClick();

            GingerWebElement validation = Service.LocateWebElement.LocateElementByID(eElementType.WebElement, "test13") as GingerWebElement;
            string           value      = validation.GetAttribute("class");

            Assert.AreEqual("TestPass", value);
        }
        public void DragAndDrop()
        {
            try
            {
                Service.BrowserActions.Navigate("https://www.seleniumeasy.com/test/drag-and-drop-demo.html", "Current");

                GingerWebElement Element = Service.LocateWebElement.LocateElementByXPath(eElementType.WebElement, "//*[@id=\"todrag\"]/span[1]") as GingerWebElement;
                GingerWebElement Target  = Service.LocateWebElement.LocateElementByID(eElementType.WebElement, "mydropzone") as GingerWebElement;
                Element.DragAndDrop("DragDropJS", Target);

                GingerWebElement validation = Service.LocateWebElement.LocateElementByXPath(eElementType.Span, "//*[@id=\"droppedlist\"]/span") as GingerWebElement;
                Assert.AreEqual("Draggable 1", validation.GetAttribute("innerHTML"));
            }
            finally
            {
                //cleanup
                string url = Path.Combine(TestResources.GetTestResourcesFolder("HTML"), "HTMLControls.html");
                Service.BrowserActions.Navigate(url, "Current");
            }
        }
        public void GetAttribute()
        {
            GingerWebElement Element = Service.LocateWebElement.LocateElementByXPath(eElementType.WebElement, "//*[@id=\"test7\"]/a") as GingerWebElement;

            Assert.AreEqual("http://www.google.com/", Element.GetAttribute("href"));
        }
Exemple #4
0
        public void LocateElementByLinkTest()
        {
            GingerWebElement Element = Service.LocateWebElement.LocateElementByPartiallinkText(eElementType.WebElement, "This is A Link to Google, Click me") as GingerWebElement;

            Assert.AreEqual("http://www.google.com/", Element.GetAttribute("href"));
        }