Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private void init()
- {
- webDriver.Navigate().GoToUrl("http://play.pokemonshowdown.com");
- IWebElement teamBuilder = webDriver.FindElement(By.CssSelector("div.menugroup:nth-child(2) > p:nth-child(1) > button:nth-child(1)"));
- teamBuilder.Click();
- IWebElement newTeam = webDriver.FindElement(By.Name("newTop"));
- newTeam.Click();
- IWebElement import = webDriver.FindElement(By.Name("import"));
- import.Click();
- ReadOnlyCollection<IWebElement> teamimport = webDriver.FindElements(By.ClassName("textbox"));
- foreach (IWebElement iwe in teamimport)
- {
- string value = iwe.GetAttribute("value");
- if (value == null || value.Equals(""))
- {
- iwe.SendKeys(config.team);
- break;
- }
- }
- IWebElement save = webDriver.FindElement(By.Name("saveImport"));
- save.Click();
- Thread.Sleep(500);
- ReadOnlyCollection<IWebElement> selectTier = webDriver.FindElements(By.Name("format"));
- foreach (IWebElement iwe in selectTier)
- {
- if (iwe.Text.Contains("Select a format"))
- {
- iwe.Click();
- ReadOnlyCollection<IWebElement> selectFormat = webDriver.FindElements(By.Name("selectFormat"));
- foreach (IWebElement iwe2 in selectFormat)
- {
- if (iwe2.Text == "OU")
- {
- iwe2.Click();
- break;
- }
- }
- break;
- }
- }
- Thread.Sleep(500);
- ReadOnlyCollection<IWebElement> home = webDriver.FindElements(By.ClassName("button"));
- foreach (IWebElement iwe in home)
- {
- if (iwe.Text.Contains("Home"))
- {
- iwe.Click();
- break;
- }
- }
- IWebElement login = webDriver.FindElement(By.Name("login"));
- login.Click();
- IWebElement username = webDriver.FindElement(By.CssSelector(".ps-popup > form:nth-child(1) > p:nth-child(1) > label:nth-child(1) > .textbox"));
- username.SendKeys(config.user);
- IWebElement submit = webDriver.FindElement(By.CssSelector(".buttonbar > button:nth-child(1)"));
- submit.Click();
- Thread.Sleep(1000);
- IWebElement pass = webDriver.FindElement(By.CssSelector("body > div.ps-overlay > div > form > p:nth-child(4) > label > input"));
- pass.SendKeys(config.password);
- login = webDriver.FindElement(By.CssSelector("p.buttonbar:nth-child(5) > button:nth-child(1)"));
- login.Click();
- IWebElement musik = webDriver.FindElement(By.CssSelector("button.icon:nth-child(2)"));
- musik.Click();
- webDriver.FindElement(By.CssSelector(".ps-popup > p:nth-child(3) > label:nth-child(1) > input:nth-child(1)")).Click();
- musik = webDriver.FindElement(By.CssSelector("button.icon:nth-child(2)"));
- musik.Click();
- IJavaScriptExecutor js = webDriver as IJavaScriptExecutor;
- js.ExecuteScript("window.app.tryJoinRoom(\"Pokefans\");");
- Thread.Sleep(1000);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement