Esempio n. 1
0
        public async Task Post(string content)
        {
            IWebElement textBox = interactor.WaitUntilElementLoad(By.CssSelector("div.b3i9ofy5"));

            await interactor.Click(textBox);

            IWebElement contentTextBox = interactor.WaitUntilElementLoad(By.CssSelector("div[class=\"l9j0dhe7 tkr6xdv7\"] form div[role=\"textbox\"]"));

            await interactor.Click(contentTextBox);

            contentTextBox.SendKeys(content);

            ICollection <IWebElement> postButtons = interactor.FindElements(By.CssSelector("div[class=\"l9j0dhe7 tkr6xdv7\"] form .ihqw7lf3 > div:nth-child(2) > div > div[role=\"button\"]"));

            if (postButtons.Count > 0)
            {
                await interactor.Click(postButtons.First());
            }
        }
Esempio n. 2
0
        public async Task LogIntoFacebook(string email, string password)
        {
            await interactor.Navigate("https://www.facebook.com").ConfigureAwait(false);

            ICollection <IWebElement> emailTextFields    = interactor.FindElements(By.Id("email"));
            ICollection <IWebElement> passwordTextFields = interactor.FindElements(By.Id("pass"));
            ICollection <IWebElement> submitButtons      = interactor.FindElements(By.CssSelector("button[type=\"submit\"]"));

            if (emailTextFields.Count > 0 && passwordTextFields.Count > 0 && submitButtons.Count > 0)
            {
                IWebElement emailField    = emailTextFields.First();
                IWebElement passwordField = passwordTextFields.First();
                IWebElement submitButton  = submitButtons.First();

                emailField.SendKeys(email);
                passwordField.SendKeys(password);
                await interactor.Click(submitButton);

                interactor.WaitUntilElementUnLoads(submitButton);
            }
        }