using NUnit.Framework.Internal; using OpenQA.Selenium; using OpenQA.Selenium.Chrome; namespace TestProject1 { [TestClass] public class Tests { [TestMethod] public void Create_Contact() { ChromeDriver driver = new ChromeDriver(); // Login driver.Navigate().GoToUrl("https://demo.1crmcloud.com/login.php"); driver.Manage().Window.Maximize(); driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(10); driver.FindElement(By.XPath("//input[@id='login_user']")).SendKeys("admin"); driver.FindElement(By.XPath("//input[@id='login_pass']")).SendKeys("admin"); driver.FindElement(By.XPath("//button[@id='login_button']")).Click(); // Navigate to Contacts driver.FindElement(By.XPath("//a[@id='grouptab-1']")).Click(); driver.FindElement(By.XPath("//a[text()=' Contacts']")).Click(); // Create Contact driver.FindElement(By.XPath("/html/body/div[7]/div/div[3]/div/div/div[2]/div/div[1]/div[1]/button")).Click(); driver.FindElement(By.XPath("//div[@id='DetailFormsalutation-input']")).Click(); driver.FindElement(By.XPath("//input[@id='DetailFormfirst_name-input']")).SendKeys("Michael"); driver.FindElement(By.XPath("//input[@id='DetailFormlast_name-input']")).SendKeys("James"); Thread.Sleep(5000); // Add categories driver.FindElement(By.XPath("//div[@id='DetailFormcategories-input']")).Click(); driver.FindElement(By.XPath("/html/body/div[10]/div[1]/div/div[1]/input")).SendKeys("customers"); driver.FindElement(By.XPath("//div[text()='Customers']")).Click(); driver.FindElement(By.XPath("//div[@id='DetailFormcategories-input']")).Click(); driver.FindElement(By.XPath("/html/body/div[10]/div[1]/div/div[1]/input")).SendKeys("suppliers"); driver.FindElement(By.XPath("//div[text()='Suppliers']")).Click(); // Select business role driver.FindElement(By.XPath("//div[@id='DetailFormbusiness_role-input']")).Click(); driver.FindElement(By.XPath("//div[contains(text(),'CEO')]")).Click(); Thread.Sleep(5000); driver.Quit(); } } }