コード例 #1
0
        public void Test_PostPage_LeaveComment()
        {
            // Arrange
            string filename = "ids.xlsx";
            string dir      = Directory.GetCurrentDirectory();
            string path     = Path.Combine(dir, filename);
            string name     = "A";
            var    usersA   = Manager.GetUsers(path, name);
            var    usersB   = Manager.GetUsers(path, "B");

            for (int i = 0; i < usersA.Count; i++)
            {
                usersA[i].target = usersB[i].id;
            }
            var user = usersA[0];
            // Action
            var         driver      = Routine.Init_driver();
            HomePage    homePage    = new HomePage(driver, "https://www.instagram.com");
            LoginPage   loginPage   = homePage.GoToLoginPage();
            ProfilePage profilePage = loginPage.Login(user.id, user.password);
            PostPage    post        = profilePage.Find_Post("emalroni");

            if (user.like)
            {
                post.Click_Like();
            }
            if (user.save)
            {
                post.Click_Save();
            }
            if (user.target != null)
            {
                string msg = String.Format("@{0} {1}", user.target, user.message);
                post.Leave_Comment(msg);
            }
            Thread.Sleep(5000);
            driver.Close();
        }