private void ChO_BT_Click(object sender, RoutedEventArgs e) { Drv.Navigate().Refresh(); System.Threading.Thread.Sleep(TimeSpan.FromSeconds(0.5)); string numbOooo; try { WebDriverWait ww = new WebDriverWait(Drv, TimeSpan.FromSeconds(20)); ww.Until(ExpectedConditions.VisibilityOfAllElementsLocatedBy(By.XPath("//ul/li"))); ReadOnlyCollection <IWebElement> colectionPage = Drv.FindElements(By.XPath("//ul/li")); int page = colectionPage.Count; for (int j = 0; j < (page - 2); j++) { By xPathTitleOfTable = By.XPath("//div[@aria-label='row']"); List <IWebElement> titleElements = AddToolsSe.getXpathElements(xPathTitleOfTable, ref Drv); int count_elem = 1; int count = 0; foreach (var item in titleElements) { int numbSymb = 10; numbOooo = ""; for (int i = 0; i < numbSymb; i++) { if (item.Text[i] == '/') { break; } numbOooo += item.Text[i]; } if (numbOooo == NO_TB.Text) { RocXPath(ref Drv, "//input[@type='checkbox']", out count)[count_elem].Click(); UATools.AllElemContainText(ref Drv, "*", "АА", "following-sibling::div/button").Click(); UATools.AllElemContainText(ref Drv, "*", "КК", "ancestor::span").Click(); numbOooo = NO_TB.Text = ""; return; } count_elem++; } UATools.Next(ref Drv, 10); } } catch (Exception ex) { MessageBox.Show(ex.ToString()); numbOooo = NO_TB.Text = ""; } }
private void GetListBT_Click(object sender, RoutedEventArgs e) { try { By xPathTitleOfTable = By.XPath(@"//div[@class='Xxx__Table__Row']/div"); List <IWebElement> titleElements = AddToolsSe.getXpathElements(xPathTitleOfTable, ref Drv); ExcelMO._Worksheet workSheetFirst = MakeXLS.CreateExcelSingleSheet(ref appl); MakeXLS.MakeTitle(ref titleElements, ref workSheetFirst); string DataOfTable = @"//div[@aria-label='row'][1]/div"; int countColumn = AddToolsSe.getXpathElements(By.XPath(DataOfTable), ref Drv).Count; MakeXLS.MakeData(ref Drv, DataOfTable, countColumn, ref workSheetFirst); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }