public void test() { element = (IWebelement)driver.FindElement(By.Id("realbox")); element.SendKeys("iLAB Quality"); element = (IWebelement)driver.FindElement(By.Id("realbox-icon")); element.Click(); }
public void MyFirstTest() { IWebDriver driver = new ChromeDriver(); driver.Navigate().GoToUrl("http://automationpractice.com/"); IWebElement contactUsButton = webDriver.FindElement(By.ClassName("header_user_info")); contactUsButton.Click(); //contact-link IWebElement contactUsButton = webDriver.FindElement(By.Id("contact-link")); contactUsButton.Click(); //capture subject heading heading combo box IWebelement subjectHeading = webDriver.FindElement(By.Id("id_contact")); SelectElement subjectHeadingCombobox = new selectElement(SubjectHeading); //CustomerService subjectheadingCombobox.SelectbyText("Customer service"); //capture email address input IWebElement emailAddresInput = webDriver.FindElement(by.Name("from")); emailAddresInput.SendKeys("*****@*****.**"); //id order IWebElement orderReferenceInput = webDriverFindElement(By.name('id_order')); orderReferenceInput.SendKeys("1234"); //fileupload IWebElement attachfile = webDriverFindElement(By.Id("fileUpload")); attachFile.SendKeys(@"C:\file.txt"); //message IWebElement messageInput = webDriver.Findelement(By.Id("Message")); messageInput.SendKeys("Test Message"); //submitMessage IWebDriver sendbutton = webDriver.FindElement(By.Id("submitMessage")); sendButton.Click(); //ypur mesage has been succefully sent to our team //p[@class = 'alert-success'] IWebElement confirmationLabel = webDriverFindElement(By.Xpath("//p[@class = 'alert-success']")); string actual message = comfirmationlabel.Text //system data string expectedMessage = "Your message has been succefully sent to our team members" Assert.AreEqual(expectedMessage, actualMesaage; ) }
public void cssDemo() { driver = new ChromeDriver("C:\\Users\\acer\\Desktop\\DesignPatternsTestAutomation\\DesignPatternsTestAutomation\\PresentFirst\\PatternTest\\drivers\\chromdriver.exe"); m_driver.Url = "http://demo.guru99.com/test/guru99home/"; m_driver.Manage().Window.Maximize(); IWebelement link = m_driver.FindElement(By.XPath(".//*[@id='rt-header']//div[2]/div/ul/li[2]/a")); link.Click(); m_driver.Close(); }