Ejemplo n.º 1
0
        public void ClearText(By by, int?timeoutInmilliseconds = null)
        {
            _waitManager.WaitElementIsClickabled(by, timeoutInmilliseconds);
            var element = _findManager.Find(by);

            _logger.LogInfo(string.Format("Perform clear text on element [{0}]", by));
            try
            {
                element.Clear();
            }
            catch (Exception e)
            {
                _logger.LogError(e.ToString());
                throw;
            }
        }
Ejemplo n.º 2
0
        public string GetText(By by, int?timeoutInmilliseconds = null)
        {
            _waitManager.WaitElementIsVisibled(by, timeoutInmilliseconds);
            var element = _findManager.Find(by);

            _logger.LogInfo(string.Format("Get text from element [{0}]", by));
            try
            {
                string text = element.Text;
                _logger.LogInfo(string.Format("Text [{0}] get", text));
                return(text);
            }
            catch (Exception e)
            {
                _logger.LogError(e.ToString());
                throw;
            }
        }
Ejemplo n.º 3
0
        public void ScrollToElement(By by, int?timeoutInmilliseconds = null)
        {
            _waitManager.WaitPageLoadReady(timeoutInmilliseconds);
            _waitManager.WaitElementIsVisibled(by, timeoutInmilliseconds);
            var element = _findManager.Find(by);

            _logger.LogInfo(string.Format("Scroll page to element [{0}]", by));
            try
            {
                IJavaScriptExecutor js = (IJavaScriptExecutor)_driver;
                js.ExecuteScript("arguments[0].scrollIntoView();", element);
            }
            catch (Exception e)
            {
                _logger.LogError(e.ToString());
                throw;
            }
        }
Ejemplo n.º 4
0
 public void TryClick(By by)
 {
     _findManager.Find(by).Click();
 }
Ejemplo n.º 5
0
 protected IWebElement Find(By by)
 {
     return(_findManager.Find(by));
 }