public void VITestExampleLarge() { var site = new VISite(BrowserType.Chrome) { Domain = "http://market.yandex.ru/" }; site.HomePage.Open(); new TextField("Поле Поиска", By.XPath("//*[@class='search__table']//*[@id='market_search']")) .Input("IPhone"); new Button("Кнопка 'Найти'", By.XPath("//*[@class='search__table']//*[contains(text(),'Найти')]//..//..//button")) .Click(); new TextField("Цена От", By.XPath("//*[@class='b-gurufilters__filter-inputs']/input[contains(@id,'-0')]")) .Input("1000"); new TextField("Цена До", By.XPath("//*[@class='b-gurufilters__filter-inputs']/input[contains(@id,'-1')]")) .Input("20000"); new Checkbox("Wi-fi", By.XPath("//*[@class='b-gurufilters']//*[contains(text(),'Wi-Fi')]//..//input")) .Check(); new ClickableElement("Сенсорный экран", By.XPath("//*[@class='b-gurufilters']//*[contains(text(),'Сенсорный экран')]//..//i")) .Click(); new RadioButtons("Выбор Сенсорного Экрана", By.XPath("//*[@class='b-gurufilters']//*[contains(text(),'Сенсорный экран')]//..//..//*[text()='{0}']//..//input[@type='radio']")) .Select("да"); new ClickableElement("Процессор", By.XPath("//*[@class='b-gurufilters']//*[contains(text(),'Процессор')]//..//i")) .Click(); new Button("Показать", "input[value='Показать']").Click(); CheckIPhone(site.WebDriver); VISite.KillAllRunWebDrivers(); }
public void VIQASimpleExampleTest() { var site = new YandexMarketSite { UseBrowser = BrowserType.Chrome }; site.HomePage.Open(); site.HomePage.SearchSection.SearchProduct("IPhone"); CheckIPhone(site.WebDriver); VISite.KillAllRunWebDrivers(); }
public void VITestExampleLarge() { var site = new VISite(BrowserType.Chrome) { Domain = "http://market.yandex.ru/" }; site.HomePage.Open(); new TextField("Поле Поиска", By.XPath("//*[@class='search__table']//*[@id='market_search']")) .Input("IPhone"); new Button("Кнопка 'Найти'", By.XPath("//*[@class='search__table']//*[contains(text(),'Найти')]//..//..//button")) .Click(); new TextField("Цена От", By.XPath("//*[@class='b-gurufilters__filter-inputs']/input[contains(@id,'-0')]")) .Input("1000"); new TextField("Цена До", By.XPath("//*[@class='b-gurufilters__filter-inputs']/input[contains(@id,'-1')]")) .Input("20000"); new Checkbox("Wi-fi", By.XPath("//*[@class='b-gurufilters']//*[contains(text(),'Wi-Fi')]//..//input")) .Check(); new ClickableElement("Сенсорный экран", By.XPath("//*[@class='b-gurufilters']//*[contains(text(),'Сенсорный экран')]//..//i")) .Click(); new RadioButtons("Выбор Сенсорного Экрана", By.XPath( "//*[@class='b-gurufilters']//*[contains(text(),'Сенсорный экран')]//..//..//*[text()='{0}']//..//input[@type='radio']")) .Select("да"); new ClickableElement("Процессор", By.XPath("//*[@class='b-gurufilters']//*[contains(text(),'Процессор')]//..//i")) .Click(); var a = site.WebDriver.FindElements( By.XPath( "//*[@class='b-gurufilters']//*[contains(text(),'Процессор')]//..//..//li//span[contains(text(),'8500')]")); var processorsCheckBox = new CheckList("Выбор Процессора", By.XPath( "//*[@class='b-gurufilters']//*[contains(text(),'Процессор')]//..//..//*[text()='{0} ']//..//input[@type='checkbox']")); processorsCheckBox.CheckGroup("Apple A4", "Apple A5", "Apple A6", "Apple A7", "MediaTek MT6572W", "MediaTek MT6515"); processorsCheckBox.GetAllElementsFunc = driver => driver.FindElements( By.XPath("//*[@class='b-gurufilters']//*[contains(text(),'Процессор')]//..//..//li//label")) .ToDictionary( webEl => webEl.FindElement(By.TagName("span")).Text, webEl => new Checkbox(webEl.FindElement(By.CssSelector("input[type=checkbox]")))); processorsCheckBox.CheckGroup("Apple A5"); new Button("Показать", "input[value='Показать']").Click(); }
public void BadSeleniumTestExample() { var driver = new ChromeDriver("..\\..\\Drivers"); driver.Manage().Window.Maximize(); driver.Manage().Timeouts().ImplicitlyWait(new TimeSpan(0, 0, 5)); driver.Navigate().GoToUrl("http://market.yandex.ru/"); driver.FindElement(By.XPath("//*[@class='search__table']//*[@id='market_search']")) .SendKeys("IPhone"); driver.FindElement(By.XPath("//*[@class='search__table']//*[contains(text(),'Найти')]//..//..//button")) .Click(); driver.FindElement(By.XPath("//*[@class='b-gurufilters__filter-inputs']/input[contains(@id,'-0')]")) .SendKeys("1000"); driver.FindElement(By.XPath("//*[@class='b-gurufilters__filter-inputs']/input[contains(@id,'-1')]")) .SendKeys("20000"); driver.FindElement(By.XPath("//*[@class='b-gurufilters']//*[contains(text(),'Wi-Fi')]//..//input")) .Click(); driver.FindElement(By.XPath("//*[@class='b-gurufilters']//*[contains(text(),'Сенсорный экран')]//..//i")) .Click(); driver.FindElement(By.XPath("//*[@class='b-gurufilters']//*[contains(text(),'Сенсорный экран')]//..//..//*[contains(text(),'да')]//..//input[@type='radio']")) .Click(); driver.FindElement(By.XPath("//*[@class='b-gurufilters']//*[text()='Процессор']//..//i")) .Click(); driver.FindElement(By.XPath("//*[@class='b-gurufilters']//*[text()='Процессор']//..//..//*[text()='Apple A4 ']//..//input[@type='checkbox']")) .Click(); driver.FindElement(By.XPath("//*[@class='b-gurufilters']//*[text()='Процессор']//..//..//*[text()='Apple A5 ']//..//input[@type='checkbox']")) .Click(); driver.FindElement(By.XPath("//*[@class='b-gurufilters']//*[text()='Процессор']//..//..//*[text()='Apple A6 ']//..//input[@type='checkbox']")) .Click(); driver.FindElement(By.XPath("//*[@class='b-gurufilters']//*[text()='Процессор']//..//..//*[text()='Apple A7 ']//..//input[@type='checkbox']")) .Click(); foreach (var el in driver.FindElements(By.XPath("//*[@class='b-gurufilters']//*[contains(text(),'Процессор')]//..//..//li"))) { //el. } driver.FindElement(By.XPath("//*[@class='b-gurufilters']//input[@value='Показать']")).Click(); VISite.KillAllRunWebDrivers(); }
public ScreenshotAlert(VISite site) { _site = site; }
public void InitTestRun() { VISite.KillAllRunWebDrivers(); }
public void TestRunCleanup() { VISite.DisposeAll(); VISite.KillAllRunWebDrivers(); }
public static void Init(VISite site) { OpenPageName = null; DefaultSite = site; }