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