C# 在raspberry Pi上使用Windows 10 iot登录Gmail的用户名和密码

C# 在raspberry Pi上使用Windows 10 iot登录Gmail的用户名和密码,c#,windows-10-universal,raspberry-pi2,windows-10-iot-core,C#,Windows 10 Universal,Raspberry Pi2,Windows 10 Iot Core,我已经创建了一个应用程序,在其中我添加了webview并重定向到Gmail登录页面 GmailWebView.Navigate("https://accounts.google.com/ServiceLogin?service=mail&passive=true&rm=false&continue=https://mail.google.com/mail/&ss=1&scc=1&ltmpl=default&ltmplcache=2&

我已经创建了一个应用程序,在其中我添加了webview并重定向到Gmail登录页面

GmailWebView.Navigate("https://accounts.google.com/ServiceLogin?service=mail&passive=true&rm=false&continue=https://mail.google.com/mail/&ss=1&scc=1&ltmpl=default&ltmplcache=2&emr=1&osid=1#identifier")

现在,我想添加用户id和密码,并点击登录,但无法做到这一点。我无法添加System.Windows.Forms.WebBrowser以便使用它。win10 iot中是否有任何东西可以完成此操作。

首先在您的webView中订阅导航已完成,如下所示

<WebView x:Name="webView" NavigationCompleted="webView_NavigationCompleted"></WebView>

你是想用谷歌认证为第三方还是直接登录gmail?我想在webview中登录gmail,在那里我可以通过代码传递用户id和密码,然后选择第一封电子邮件并打开它。在win10 iot中,我们有没有什么方法可以在网站的文本框中输入数据,并在我们提交或登录时重定向。获取下面是System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(任务任务)at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务任务)at System.Runtime.CompilerServices.TaskAwaiter``1.GetResult()at AllinOnePi.MainPage.d_36.MoveNext()Dear@Farhan,通过使用InvokeScriptAsync方法调用脚本或将脚本注入WebView内容,以及使用ScriptNotify事件从WebView内容获取信息,可以与WebView的内容进行交互。要在WebView内容中调用JavaScript,请使用InvokeScriptAsync方法。被调用的脚本只能返回字符串值。有关更多信息,请参阅我尝试使用下面的代码,但在初始化uri uri=new uri(“);
private async void webview_NavigationCompleted(webview发送方,webviewsnavigationcompletedeventargs args){try{string functionString=“document.getElementById('lst-ib')中给出了与上面定义的异常uri相同的uri.value='abc';“wait webview.InvokeScriptAsync(“eval”,new string[]{functionString});}catch(Exception ex){LogTextbox.Text=ex.Message;}}
您到底在哪一行出错?我无法找出出错的原因和位置。在执行
webview时,InvokeScriptAsync给出错误
   await webView.InvokeScriptAsync("eval", new[] {
       "var usernameText=document.getElementById(\"UserName\");"+
       "var passwordText=document.getElementById(\"Password\");"+
       "var button=document.getElementById(\"SubmitButton\");"+
       "button.attachEvent('onclick', MyButtonClicked);"+
       "function MyButtonClicked(){" +
           " //click Function"+
       "}"
   });