1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

C#: How to login to Twitter through webbrowser?

Discussion in 'C, C++, C#' started by kytro360, Nov 14, 2011.

Tags:
  1. kytro360

    kytro360 Power Member

    Joined:
    Jan 12, 2010
    Messages:
    703
    Likes Received:
    732
    Hello, does anyone have some working code to login to Twitter with the webbrowser in C#?

    I have some code that should work, I have the right ID's and everything (I used Firebug) but when I start my code nothing happens.

    If you guys can help it would be awesome!

    Its funny I can code it to login in through httpwebrequests but Twitter doesnt want to work with the webbrowser :/
     
  2. weedsmoker

    weedsmoker Junior Member

    Joined:
    May 2, 2011
    Messages:
    190
    Likes Received:
    79
    Well, i started learning C# today so i don't know if this will help you, but when i coded twitter bot in python, i've always accessed mobile version of twitter because it is a lot easier to automate. I've tried now to login mobile version using C# with success.

    Code:
    webBrowser1.Navigate("https://mobile.twitter.com/session/new");
    webBrowser1.Document.All["username"].SetAttribute("value","username");
    webBrowser1.Document.All["password"].SetAttribute("value","password");
    webBrowser1.Document.GetElementById("signupbutton").InvokeMember("click");