Exemple #1
0
        public static Netflix LoginTask(string email, string password)
        {
            IWebDriver driver = new FirefoxDriver();

            driver.Navigate().GoToUrl(ApiVars.netflixUrl + "login");

            IWebElement f_email    = driver.FindElement(By.Id("id_userLoginId"));
            IWebElement f_password = driver.FindElement(By.Id("id_password"));

            f_email.SendKeys(email);
            f_password.SendKeys(password);

            f_password.Submit();

            var wait = new WebDriverWait(driver, new TimeSpan(100));

            wait.Until(x => x.Url != ApiVars.netflixUrl + "login");

            CookieContainer container = new CookieContainer();

            foreach (var c in driver.Manage().Cookies.AllCookies)
            {
                System.Net.Cookie cookie = new System.Net.Cookie(c.Name, c.Value, c.Path, c.Domain);
                container.Add(cookie);
            }

            Netflix netflix = Netflix.BuildFromSource(container, driver.PageSource);

            netflix.LoadNetflixProfilesTask();

            return(netflix);
        }
Exemple #2
0
        public static Netflix BuildFromSource(CookieContainer cookies, string source)
        {
            string id = GetIdFromSource(source);
            //string lolomo = GetLolomoFromSource(source);

            Netflix netflix = new Netflix(cookies, id);

            return(netflix);
        }