diff --git a/CefSharp.WinForms/WebView.cs b/CefSharp.WinForms/WebView.cs index 40e3957ae..d85bb7184 100644 --- a/CefSharp.WinForms/WebView.cs +++ b/CefSharp.WinForms/WebView.cs @@ -322,5 +322,14 @@ namespace CefSharp.WinForms managedCefBrowserAdapter.GetText(taskStringVisitor); return taskStringVisitor.Task; } + + public string GetText() + { + var task = GetTextAsync(); + + task.Wait(); + + return task.Result; + } } } diff --git a/CefSharp.Wpf/WebView.cs b/CefSharp.Wpf/WebView.cs index 20287cb54..0ddf3112b 100644 --- a/CefSharp.Wpf/WebView.cs +++ b/CefSharp.Wpf/WebView.cs @@ -1127,5 +1127,14 @@ namespace CefSharp.Wpf managedCefBrowserAdapter.GetText(taskStringVisitor); return taskStringVisitor.Task; } + + public string GetText() + { + var task = GetTextAsync(); + + task.Wait(); + + return task.Result; + } } } diff --git a/CefSharp/IWebBrowser.cs b/CefSharp/IWebBrowser.cs index 1088e9f7b..8e6e9da97 100644 --- a/CefSharp/IWebBrowser.cs +++ b/CefSharp/IWebBrowser.cs @@ -146,5 +146,11 @@ namespace CefSharp /// /// that when executed returns the frame display text as a string. Task GetTextAsync(); + + /// + /// Retrieve the main frame's display text. + /// + /// The main frame display text as a string. + string GetText(); } }