Esempio n. 1
0
        public bool CreateBoard()
        {
            try
            {
                Driver.Url = $"https://www.pinterest.com/{this.UserName}/boards/";
                Thread.Sleep(new TimeSpan(0, 0, 2));
                var buttons = Driver.FindElementsByCssSelector("[data-test-id='createBoardCard']");
                buttons[0].Click();
                Thread.Sleep(new TimeSpan(0, 0, 5));

                //Driver.FindElementByCssSelector("div[title='Create board']").Click();
                // Thread.Sleep(new TimeSpan(0, 0, 5));
                Driver.FindElementById("boardEditName").SendKeys(RandomValue.GetString(@"Data/city_names.txt"));
                buttons = Driver.FindElementsByTagName("button");
                foreach (var button in buttons)
                {
                    if (button.Text.Trim().ToUpper() == "CREATE")
                    {
                        button.Click();
                        Thread.Sleep(new TimeSpan(0, 0, 5));
                        Console.WriteLine("board done" + this.UserName);
                        Console.WriteLine("https://pinterest.com/" + this.UserName);
                        return(true);
                    }
                }
                return(false);
            }
            catch (Exception ex)
            {
                var d = ex.Message;
                return(false);
            }
        }
Esempio n. 2
0
        public ActionInfo Follow()
        {
            Driver.Url = "https://www.pinterest.com/search/boards/?q=" + RandomValue.GetString(@"Data/city_names.txt") + "&rs=filter";

            var buttons = Driver.FindElementsByCssSelector("[data-test-id='board-follow-button'] button");

            ///todo check if have different
            foreach (var button in buttons)
            {
                try
                {
                    button.Click();
                }
                catch
                {
                    Driver.FindElementByTagName("body").SendKeys(OpenQA.Selenium.Keys.ArrowDown);
                    Driver.FindElementByTagName("body").SendKeys(OpenQA.Selenium.Keys.ArrowDown);
                    Driver.FindElementByTagName("body").SendKeys(OpenQA.Selenium.Keys.ArrowDown);
                    Driver.FindElementByTagName("body").SendKeys(OpenQA.Selenium.Keys.ArrowDown);
                    Driver.FindElementByTagName("body").SendKeys(OpenQA.Selenium.Keys.ArrowDown);
                    Driver.FindElementByTagName("body").SendKeys(OpenQA.Selenium.Keys.ArrowDown);
                    Driver.FindElementByTagName("body").SendKeys(OpenQA.Selenium.Keys.ArrowDown);
                }
            }
            return(new ActionInfo(true, "followed not checked"));
        }
Esempio n. 3
0
        public void FillName()
        {
            try
            {
                Driver.Url = "https://www.pinterest.com/settings#profile";

                //  Driver.FindElementById("location").SendKeys(new RandomValue().GetString("city_names.txt"));


                for (int i = 0; i < 50; i++)
                {
                    Driver.FindElementById("first_name").SendKeys(Keys.Backspace);
                    Driver.FindElementById("last_name").SendKeys(Keys.Backspace);
                }

                Driver.FindElementById("first_name").SendKeys(RandomValue.GetString("Data/names.txt").ToLower());
                Driver.FindElementById("last_name").SendKeys(RandomValue.GetString("Data/names.txt").ToLower());
                Driver.FindElementById("first_name").SendKeys(Keys.Space);



                var buttons = Driver.FindElementsByTagName("button");
                foreach (var button in buttons)
                {
                    if (button.Text.Trim().ToUpper() == "DONE")
                    {
                        Actions actions = new Actions(Driver);
                        actions.MoveToElement(Driver.FindElementByCssSelector("div[data-test-id='settings-header']"));
                        actions.Perform();
                        button.Click();
                        Thread.Sleep(new TimeSpan(0, 0, 5));
                        break;
                    }
                }
                AddImage();
                return;
            }

            catch (Exception ex)
            {
                var sdfs = ex.Message;
                return;
            }
        }