Exemple #1
0
        /// <summary>
        /// enters phrase in a way depending on clickerInput
        /// </summary>
        /// <param name="clickerInput">bool if clicker enabled</param>
        /// <param name="webBrowser">cafsharp browser interface</param>
        /// <param name="phrase">built search phrase</param>
        public async Task EnterPhraseAsync(bool clickerInput, IWpfWebBrowser webBrowser, string phrase)
        {
            _log.Called(clickerInput, string.Empty, phrase);

            try
            {
                if (!clickerInput)
                {
                    phrase = ValidatePhrase(phrase);

                    await webBrowser.EvaluateScriptAsync(@"
                           var arr = document.getElementsByTagName('input')[2].value = '" + phrase + @"';
                           ");
                }
                else
                {
                    await _inputService.ClickSearchBarInputAsync();

                    await _inputService.EnterPhraseInputAsync(phrase);
                }
            }
            catch (Exception e)
            {
                _log.Error(e.Message);
            }
        }