public void QuickSearch(QuickSearchType recordtype, string name)
        {
            var wait = new WebDriverWait(Driver, TimeSpan.FromSeconds(15));
            var qucikSearchArrow =
                wait.Until(
                    ExpectedConditions.ElementIsVisible(
                        By.XPath(".//span[contains(text(), 'Search For')]/following::td[2]/a")));
            qucikSearchArrow.Click();


            const string xPath = "//li[.='{0}']";
            var key = string.Format(xPath, recordtype);

            wait = new WebDriverWait(Driver, TimeSpan.FromSeconds(15));
            var module = wait.Until(ExpectedConditions.ElementIsVisible(By.XPath(key)));
            module.Click();


            const string id = "ctl00_{0}_Input";
            var record = string.Format(id, QuickSearchInputBoxLibrary[recordtype]);

            wait = new WebDriverWait(Driver, TimeSpan.FromSeconds(15));
            var recordnameinputbx = wait.Until(ExpectedConditions.ElementIsVisible(By.Id(record)));
            recordnameinputbx.Click();
            recordnameinputbx.SendKeys(name);


            const string recordXpath = "//td/span[contains(text(), '{0}')]";
            var recordname = string.Format(recordXpath, name);


            wait = new WebDriverWait(Driver, TimeSpan.FromSeconds(15));
            var selectindividual = wait.Until(ExpectedConditions.ElementIsVisible(By.XPath(recordname)));
            selectindividual.Click();
        }
Esempio n. 2
0
        public async Task SendSearchInfoAsync(SocketCommandContext context, string title, QuickSearchType type)
        {
            if (title.Equals("fate/loli"))
            {
                title = "Fate/kaleid Liner Prisma Illya";
            }

            var session = new SearchSession(context.User, _shClient);

            if (_session.SessionExist(session))
            {
                return;
            }

            var res = await _shClient.Search.QuickSearchAsync(title, type);

            if (!res.IsSuccessStatusCode())
            {
                await context.Channel.SendMessageAsync("", false, GetResponseFromSearchCode(res).ToEmbedMessage(EMType.Error).Build());

                return;
            }

            var list   = res.Body;
            var toSend = GetSearchResponse(list, "Wybierz tytuł który chcesz wyświetlić poprzez wpisanie numeru odpowadającemu mu na liście.");

            if (list.Count == 1)
            {
                var info = (await _shClient.Title.GetInfoAsync(list.First())).Body;
                await context.Channel.SendMessageAsync("", false, info.ToEmbed());
            }
            else
            {
                session.SList = list;
                await SendSearchResponseAsync(context, toSend, session);
            }
        }