Esempio n. 1
0
        public static void SetText(this IWebElement element, string text)
        {
            if (text == null)
            {
                text = "";
            }
            text = text.Replace(Environment.NewLine, @"\r\n");
            text = text.Replace("'", @"\'");
            text = JavaScriptEncoder.Default.Encode(text);
            var remote = (RemoteWebElement)element;
            var field  = element.IsInputTag() ? "value" : "innerText";

            remote.WrappedDriver.ExecuteJavaScript($"arguments[0].{field} = '{text}'", element);
        }