public async Task <bool> IsOptionElementTogglable(string elementId, CancellationToken cancellationToken = new CancellationToken())
        {
            //var expression = $"({is_option_element_toggleable.JsSource}).apply(null, {{\"{GetElementKey()}\":\"{elementId}\"}})";
            //var frameId = Session == null ? "" : Session.GetCurrentFrameId();
            //var res = await webView.EvaluateScript(expression, frameId, true, cancellationToken);
            var res = await webView.CallFunction(is_option_element_toggleable.JsSource, $"{{\"{GetElementKey()}\":\"{elementId}\"}}", null, true, false, cancellationToken);

            return(ResultValueConverter.ToBool(res?.Result?.Value));
        }
        public async Task <bool> SetOptionElementSelected(string elementId, bool selected = true, CancellationToken cancellationToken = new CancellationToken())
        {
            var res = await WebView.CallFunction(atoms.CLICK, $"{{\"{Session.GetElementKey()}\":\"{elementId}\"}}, {selected.ToString().ToLower()}", Session?.GetCurrentFrameId(), true, false, cancellationToken).ConfigureAwait(false);

            var value     = res?.Result?.Value as JToken;
            var exception = ResultValueConverter.ToWebBrowserException(value);

            if (exception != null)
            {
                throw exception;
            }
            return(ResultValueConverter.ToBool(res?.Result?.Value));
        }
        public async Task <bool> IsElementEnabled(string elementId, CancellationToken cancellationToken = new CancellationToken())
        {
            var res = await WebView.CallFunction(atoms.IS_ENABLED, $"{{\"{Session.GetElementKey()}\":\"{elementId}\"}}", Session?.GetCurrentFrameId(), true, false, cancellationToken).ConfigureAwait(false);

            var value     = res?.Result?.Value as JToken;
            var exception = ResultValueConverter.ToWebBrowserException(value);

            if (exception != null)
            {
                throw exception;
            }
            return(ResultValueConverter.ToBool(res?.Result?.Value));
        }
        public async Task <bool> IsOptionElementTogglable(string elementId, CancellationToken cancellationToken = new CancellationToken())
        {
            //var expression = $"({is_option_element_toggleable.JsSource}).apply(null, {{\"{Session.GetElementKey()}\":\"{elementId}\"}})";
            //var frameId = Session == null ? "" : Session.GetCurrentFrameId();
            //var res = await webView.EvaluateScript(expression, frameId, true, cancellationToken);
            var res = await WebView.CallFunction(is_option_element_toggleable.JsSource, $"{{\"{Session.GetElementKey()}\":\"{elementId}\"}}", Session?.GetCurrentFrameId(), true, false, cancellationToken).ConfigureAwait(false);

            var value     = res?.Result?.Value as JToken;
            var exception = ResultValueConverter.ToWebBrowserException(value);

            if (exception != null)
            {
                throw exception;
            }
            return(ResultValueConverter.ToBool(res?.Result?.Value));
        }
        public async Task <bool> VerifyElementClickable(string elementId, WebPoint location, CancellationToken cancellationToken = new CancellationToken())
        {
            var res = await webView.CallFunction(atoms.IS_ELEMENT_CLICKABLE, $"{{\"{GetElementKey()}\":\"{elementId}\"}}, {location.X}, {location.Y}", null, true, false, cancellationToken);

            return(ResultValueConverter.ToBool(res?.Result?.Value));
        }
        public async Task <bool> SetOptionElementSelected(string elementId, bool selected = true, CancellationToken cancellationToken = new CancellationToken())
        {
            var res = await webView.CallFunction(atoms.CLICK, $"{{\"{GetElementKey()}\":\"{elementId}\"}}, {selected.ToString().ToLower()}", null, true, false, cancellationToken);

            return(ResultValueConverter.ToBool(res?.Result?.Value));
        }
        public async Task <bool> IsOptionElementSelected(string elementId, CancellationToken cancellationToken = new CancellationToken())
        {
            var res = await webView.CallFunction(atoms.IS_SELECTED, $"{{\"{GetElementKey()}\":\"{elementId}\"}}", null, true, false, cancellationToken);

            return(ResultValueConverter.ToBool(res?.Result?.Value));
        }