Exemplo n.º 1
0
        public bool UpdateFieldData(string element, string data)
        {
            _l.info($"Webdriver: Attemp to update data [{data}] in element [{element}]...");

            By se = GetElement(element);

            if (ReferenceEquals(se, null))
            {
                _l.error($"Webdriver: Can't find element -> [{element}]");
                return(false);
            }
            try {
                var e = _cd.FindElement(se);
                e.Clear();
                e.SendKeys(data);
                _l.info($"Webdriver: Value [{data}] was successfully updated in element [{element}]");
                return(true);
            } catch (StaleElementReferenceException e)
            {
                _l.error(e.Message);

                return(false);
            }
            catch (InvalidElementStateException e)
            {
                _l.error(e.Message);

                return(false);
            }
            catch (WebDriverException e)
            {
                _l.error(e.Message);
                return(false);
            }
        }