none
Website cant able to login via c# automated code in IE10 RRS feed

  • Question

  • i Have created a web automation to extract some information but it works fine for IE8 but unable to login in IE 10 and IE 11

    Here is the Code

    code is written in c# windows application

    visual studio 2010

    Windows7

    //code starts

    SHDocVw.InternetExplorer ie = null;
    ie = new SHDocVw.InternetExplorer();
                    ie.Visible = true;
        
        ie.Navigate("websiteURL");
        while (ie.ReadyState != SHDocVw.tagREADYSTATE.READYSTATE_COMPLETE)
                    {
                        System.Windows.Forms.Application.DoEvents();
                    }

                    doc = ie.Document;
                    while (doc.readyState != "complete")
                    {
                        Application.DoEvents();
                    }

    doc = ie.Document;
                        while (doc.readyState != "complete")
                        {
                            Application.DoEvents();
                        }

                       

               

                  
                    collection = doc.getElementsByTagName("INPUT");

                    foreach (mshtml.IHTMLElement elem in collection)
                    {
                        if (elem.getAttribute("id") != null)
                        {
                            if (elem.getAttribute("id").Equals("user-id")) // IE 8
                        
                            {
                               
                               elem.setAttribute("value", "1234567"); 
                                                   
                              
                            }
                            else if (elem.getAttribute("id").Equals("user-password")) //IE 8
                         
                            {
                               
                                    elem.setAttribute("value", "abcdefg");// for Englewood
                               
                               
                            }
                        }


                    }


                    collection = doc.getElementsByTagName("A");
                    foreach (mshtml.IHTMLElement elem in collection)
                    {
                        a = elem as MSHTML.HTMLAnchorElement;
                        if (a.innerText != null && a.id != null)
                        {
                           
                            if (a.id.ToString().Trim().Equals("lnkLandingPageLogin"))
                           
                            {
                                a.click();
                                break;
                            }
                        }
                    }

    This works fine For IE8 and I am able to login but in IE10 I am unable to login and also cannot able to enter login name and password Via this code..

    at debug time code goes to all element but data does not enter in login field

    Thursday, December 4, 2014 12:05 PM

All replies

  • Hi Imran,

    Please post questions about IE automation and extensions to

    MSDN IE Extension Development forum

    Please post questions about html, css and scripting for website development to

    IE Web Development forum has moved to stack-overflow

    If possible include links to your website or a publicly accessible mashup that shows the issue with your questions.

    Questions regarding Internet Explorer 8, 9 and 10 and Internet Explorer 11 for the IT Pro Audience. Topics covered are: Installation, Deployment, Configuration, Security, Group Policy, Management questions. If you are a consumer looking for answers or to raise a question, it's highly recommended you head on over to http://answers.microsoft.com

    thx for your understanding.

    Regards.


    Rob^_^

    Thursday, December 4, 2014 11:43 PM