public void register(string name, string gender, string dob, string add, string city, string state, string pin, string mobile, string email, string password)
        {
            try
            {
                NewCustomerLink.Click();
                Name.SendKeys(name);
                foreach (var gender1 in Gender)
                {
                    String gen = gender1.GetAttribute("value");
                    if (String.Equals(gen, gender, StringComparison.OrdinalIgnoreCase))
                    {
                        gender1.Click();
                    }
                }
                DateOfBirth.SendKeys(dob);
                Address.SendKeys(add);
                City.SendKeys(city);
                State.SendKeys(state);
                PinNo.SendKeys(pin);
                TelephoneNo.SendKeys(mobile);
                EmailId.SendKeys(email);
                Password.SendKeys(password);

                IJavaScriptExecutor js = (IJavaScriptExecutor)driver;
                js.ExecuteScript("window.scrollTo(0, document.body.scrollHeight);");
                WebDriverWait wait = new WebDriverWait(driver, TimeSpan.FromSeconds(20));
                wait.Until(ExpectedConditions.ElementToBeClickable(Submit)).Click();
            }

            catch (Exception e)
            {
                Console.WriteLine(e);
                TakeScreenshot.takeScreenshotAs(driver, "register");
            }
        }
예제 #2
0
        public void edit_customer(string field_to_change, string add, string city, string state, string pin, string mobile, string email)
        {
            // DatabaseConnectorFixture db = new DatabaseConnectorFixture();
            // values=db.executeQuery(query);
            try
            {
                if (field_to_change.Equals("address"))
                {
                    Address.Clear();
                    Address.SendKeys(add);
                }
                if (field_to_change.Equals("city"))
                {
                    City.Clear();
                    City.SendKeys(city);
                }
                if (field_to_change.Equals("state"))
                {
                    State.Clear();
                    State.SendKeys(state);
                }
                if (field_to_change.Equals("pin"))
                {
                    PinNo.Clear();
                    PinNo.SendKeys(pin);
                }
                if (field_to_change.Equals("mobile"))
                {
                    TelephoneNo.Clear();
                    TelephoneNo.SendKeys(mobile);
                }
                if (field_to_change.Equals("email"))
                {
                    EmailId.Clear();
                    EmailId.SendKeys(email);
                }

                IJavaScriptExecutor js = (IJavaScriptExecutor)driver;
                js.ExecuteScript("window.scrollTo(0, document.body.scrollHeight);");
                // Assert.Equal("dfdg", driver.Title);
                WebDriverWait wait = new WebDriverWait(driver, TimeSpan.FromSeconds(20));
                wait.Until(ExpectedConditions.ElementToBeClickable(Submit)).Click();
            }

            catch (Exception e)
            {
                Console.WriteLine(e);
                TakeScreenshot.takeScreenshotAs(driver, "edit_customer");
            }
        }