Example #1
0
        public void LocateElementByID()

        {
            GingerWebElement Element = Service.LocateWebElement.LocateElementByID(eElementType.WebElement, "button1") as GingerWebElement;

            Assert.AreEqual("button 1", Element.GetAttribute("value"));
        }
        public void GetSize()
        {
            GingerWebElement Element = Service.LocateWebElement.LocateElementByXPath(eElementType.WebElement, "//*[@id=\"test7\"]/a") as GingerWebElement;

            Size size = Element.GetSize();

            Assert.AreNotEqual(0, size.Height);
            Assert.AreNotEqual(0, size.Width);
        }
        public void RightClick()
        {
            GingerWebElement Element = Service.LocateWebElement.LocateElementByXPath(eElementType.WebElement, "//*[@id=\"chk11\"]") as GingerWebElement;

            Element.RightClick();
            GingerWebElement validation = Service.LocateWebElement.LocateElementByXPath(eElementType.WebElement, "//*[@id=\"clickedright\"]") as GingerWebElement;

            Assert.AreEqual("clicked right", validation.GetAttribute("innerHTML"));
        }
Example #4
0
        public void MouseClick()
        {
            HyperLink Element = Service.LocateWebElement.LocateElementByXPath(eElementType.HyperLink, "/html/body/table/tbody/tr[3]/td[3]/a") as HyperLink;

            Element.MouseClick();

            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 GetWidth()
        {
            GingerWebElement Element = Service.LocateWebElement.LocateElementByXPath(eElementType.WebElement, "//*[@id=\"test7\"]/a") as GingerWebElement;

            Assert.AreNotEqual(0, Element.GetWidth());
        }
        public void GetAttribute()
        {
            GingerWebElement Element = Service.LocateWebElement.LocateElementByXPath(eElementType.WebElement, "//*[@id=\"test7\"]/a") as GingerWebElement;

            Assert.AreEqual("http://www.google.com/", Element.GetAttribute("href"));
        }
        public void IsVisible()
        {
            GingerWebElement Element = Service.LocateWebElement.LocateElementByXPath(eElementType.WebElement, "//*[@id=\"invisible\"]") as GingerWebElement;

            Assert.AreEqual(false, Element.IsVisible());
        }
        public void IsEnabled()
        {
            GingerWebElement Element = Service.LocateWebElement.LocateElementByXPath(eElementType.WebElement, "//*[@id=\"submitformtest\"]/input[2]") as GingerWebElement;

            Assert.AreEqual(false, Element.IsEnabled());
        }
        public void Hover()
        {
            GingerWebElement Element = Service.LocateWebElement.LocateElementByXPath(eElementType.WebElement, "//*[@id=\"test7\"]/a") as GingerWebElement;

            Element.Hover();
        }
Example #11
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"));
        }