public CommandResult Execute(IWebDriver driver, CommandDesc command)
        {
            try
            {
                var result = new CommandResult { Command = command };

                var timeout = GetTimeout(command);
                var complexSelector = WebDriverExtensions.GetContainsSelector(command.Selector);
                var by = WebDriverExtensions.GetBy(complexSelector.SimpleSelector);

                var elements = driver.FindElements(by);
                if (elements.Any())
                    driver.WaitForNotElement(by, timeout.GetValueOrDefault(WebDriverExtensions.DEFAULT_TIMEOUT));
                elements = driver.FindElements(by);

                var count = elements.Count();
                if (count > 0)
                    throw new Exception("Element was found.");

                return result;
            }
            catch (Exception ex)
            {
                return new CommandResult
                {
                    Command = command,
                    HasError = true,
                    Comments = ex.Message
                };
            }
        }
        private IWebElement GetElement(IWebDriver driver, CommandDesc command, CommandResult result)
        {
            var timeout = GetTimeout(command);
            var elements = driver.GetElements(command.Selector, timeout);
            var count = elements.Count();

            if (count == 0)
            {
                result.HasError = true;
                result.Comments = "Element not found.";
            }
            else if (count > 1)
            {
                result.HasWarning = true;
                result.Comments = "More than one element found";
            }

            return elements.FirstOrDefault();
        }
        public CommandResult Execute(IWebDriver driver, CommandDesc command)
        {
            try
            {
                var result = new CommandResult { Command = command };

                var value = ((IJavaScriptExecutor)driver).ExecuteScript("return " + command.Selector);
                Execute(value, command);

                return result;
            }
            catch (Exception ex)
            {
                return new CommandResult
                {
                    Command = command,
                    HasError = true,
                    Comments = ex.Message
                };
            }
        }
        public CommandResult Execute(IWebDriver driver, CommandDesc command)
        {
            try
            {
                var result = new CommandResult { Command = command };
                var element = GetElement(driver, command, result);

                if (result.HasError)
                    return result;
                Execute(driver, element, command);
                return result;
            }
            catch (Exception ex)
            {
                return new CommandResult
                {
                    Command = command,
                    HasError = true,
                    Comments = ex.Message
                };
            }
        }