本文介绍了退出表格雅虎帐户的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好

我如何从雅虎帐户退出?

我使用以下代码登录雅虎:



Hello
How can I sign out from Yahoo account?
I sign in to Yahoo with this code:

private void webBrowser1_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
{
    try
    {
        HtmlElementCollection theElementCollection = webBrowser1.Document.GetElementsByTagName("Input");
        foreach (HtmlElement curElement in theElementCollection)
        {
            string controlName = curElement.GetAttribute("id").ToString();
            if (controlName.IndexOf("username") >= 0)
            {
                curElement.SetAttribute("Value", textBox1.Text);
                break;
            }
        }
           ……
       }



编辑:

我更改了代码:




EDITED:
I changed the code:

private void button1_Click(object sender, EventArgs e)
{
    string url = "https://login.yahoo.com/?.src=ym&.intl=xe&.lang=en-JO&.done=https%3a//mail.yahoo.com";
    webBrowser1.Navigate(url);
    webBrowser1.ScriptErrorsSuppressed = true;
    flag = "SignIn";
}

private void webBrowser1_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
{
    try
    {
        if (flag == "SignIn")
        {
            HtmlElementCollection theElementCollection = webBrowser1.Document.GetElementsByTagName("Input");
            foreach (HtmlElement curElement in theElementCollection)
            {
                if (controlName.IndexOf("username") >= 0)
                {
                    curElement.SetAttribute("Value", textBox1.Text);
                }
            }

            theElementCollection = webBrowser1.Document.All;
            foreach (HtmlElement curElement in theElementCollection)
            {
                if (curElement.GetAttribute("value").IndexOf("Next") >= 0)
                {
                    curElement.InvokeMember("click");
                }
            }

            theElementCollection = webBrowser1.Document.GetElementsByTagName("Input");
            foreach (HtmlElement curElement in theElementCollection)
            {
                String controlName = curElement.GetAttribute("id").ToString();
                if (controlName.IndexOf("passwd") >= 0)
                {
                    curElement.SetAttribute("Value", textBox2.Text);
                }
            }

            theElementCollection = webBrowser1.Document.All;
            foreach (HtmlElement curElement in theElementCollection)
            {
                if (curElement.GetAttribute("value").IndexOf("Sign in") >= 0 || curElement.GetAttribute("value").IndexOf("Next") >= 0)
                {
                    curElement.InvokeMember("click");
                }
            }
        }


        else if (flag == "SignOut")
        {
            HtmlElementCollection theElementCollection = webBrowser1.Document.GetElementsByTagName("a");
            foreach (HtmlElement curElement in theElementCollection)
            {
                if (curElement.InnerText == "Sign Out")
                {
                    curElement.InvokeMember("click");
    }
    catch (Exception ex)
    {
        MessageBox.Show(ex.Message);
    }
}

private void button2_Click(object sender, EventArgs e)
{
    flag = "SignOut";
    HtmlElementCollection theElementCollection = webBrowser1.Document.GetElementsByTagName("a");
    foreach (HtmlElement curElement in theElementCollection)
    {
        if (curElement.InnerText == "Sign Out")
        {
            curElement.InvokeMember("click");
        }
    }
}





我有时会看到一个窗口,我必须按button1才能签名在完全。这个窗口的属性是:

文件下载 - 安全警告

您要保存此文件,还是在线查找某个程序以打开它?

名称:login-yahoo-com

类型:未知文件类型

来自:login.yahoo.com

{status :redirect,url:https:\ / \ / mail.yahoo.com}

这是什么窗口?它出现了什么?



我尝试过:



如何从雅虎帐户登录和退出



I see sometime a window that I must press button1 to sign in completely. The properties of this window are:
File Download-Security Warning
Do you want to save this file, or find a program online to open it?
Name: login-yahoo-com
Type: Unknown File Type
From: login.yahoo.com
{"status":"redirect","url":"https:\/\/mail.yahoo.com"}
What is this window? What does it appear?

What I have tried:

How to sign in and sign out from Yahoo account

推荐答案


这篇关于退出表格雅虎帐户的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-25 04:02