Esempio n. 1
0
        public async Task <List <HtmlSection> > GetSiteStreamAsync(string keywords, int?resultsNum)
        {
            numOfResults = resultsNum ?? numOfResults;
            var searchUrl    = GenerateStringUrl(numOfResults, keywords);
            var htmlSections = new List <HtmlSection>();
            CancellationTokenSource cancellationToken = new CancellationTokenSource();
            var httpClient = new HttpClient();
            HttpResponseMessage request = await httpClient.GetAsync(searchUrl);

            cancellationToken.Token.ThrowIfCancellationRequested();

            var response = await request.Content.ReadAsStreamAsync();

            cancellationToken.Token.ThrowIfCancellationRequested();

            var theStreamReader = new StreamReader(response);

            string[] fileLines = theStreamReader.ReadToEnd().Split(delimiter, StringSplitOptions.RemoveEmptyEntries);

            foreach (var section in fileLines.Skip(1).Take(numOfResults).Select((value, i) => new { i, value }))
            {
                if (!string.IsNullOrEmpty(section.value) && section.value.Contains(hrefDelimiter.First()))
                {
                    var result = new HtmlSection();
                    result.Index = section.i + 1;
                    result.Href  = _parseHelper.ParseHtmlTag(section.value, hrefDelimiter);
                    htmlSections.Add(result);
                }
            }
            return(htmlSections.OrderBy(o => o.Index).ToList());
        }
Esempio n. 2
0
 public OrderSection(IWebDriver webDriver, By by, HtmlSection parent) : base(webDriver, by, parent)
 {
 }
Esempio n. 3
0
 public OrderSection(IWebElement webElement, By by, HtmlSection parent) : base(webElement, by, parent)
 {
 }
Esempio n. 4
0
 public MainOverlay(IWebDriver webDriver, By by, HtmlSection parent) : base(webDriver, by, parent)
 {
 }
Esempio n. 5
0
 public MainOverlay(IWebElement webElement, By by, HtmlSection parent) : base(webElement, by, parent)
 {
 }
Esempio n. 6
0
 public AddressInputBlock(IWebDriver webDriver, By by, HtmlSection parent) : base(webDriver, by, parent)
 {
 }
Esempio n. 7
0
 public AddressInputBlock(IWebElement webElement, By by, HtmlSection parent) : base(webElement, by, parent)
 {
 }
Esempio n. 8
0
 public ServiceMenu(IWebElement webElement, By by, HtmlSection parent) : base(webElement, by, parent)
 {
 }
Esempio n. 9
0
 public CityPromoSection(IWebDriver webDriver, By by, HtmlSection parent) : base(webDriver, by, parent)
 {
 }
Esempio n. 10
0
 public CityPromoSection(IWebElement webElement, By by, HtmlSection parent) : base(webElement, by, parent)
 {
 }
Esempio n. 11
0
 public HeaderMenu(IWebDriver webDriver, By by, HtmlSection parent) : base(webDriver, by, parent)
 {
 }
Esempio n. 12
0
 public HeaderMenu(IWebElement webElement, By by, HtmlSection parent) : base(webElement, by, parent)
 {
 }
 public AutocompleteOption(IWebDriver webDriver, By by, HtmlSection parent) : base(webDriver, by, parent)
 {
 }
 public AutocompleteOption(IWebElement webElement, By by, HtmlSection parent) : base(webElement, by, parent)
 {
 }
 public CallCenterPlaceholderSection(IWebElement webElement, By by, HtmlSection parent) : base(webElement, by, parent)
 {
 }
 public CallCenterPlaceholderSection(IWebDriver webDriver, By by, HtmlSection parent) : base(webDriver, by, parent)
 {
 }
Esempio n. 17
0
 public ServiceMenu(IWebDriver webDriver, By by, HtmlSection parent) : base(webDriver, by, parent)
 {
 }