Hi,
I have been trying to view webpage in webusercontrol(WPF).I would like to auto populate the username and password values.please find the code that am using below it gives me an error.Help me in getting code for this scenario.
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
}
private void Window_Loaded(object sender, RoutedEventArgs e)
{
webBrowser1.Navigate("https://mail.google.com");
webBrowser1.Unloaded +=new RoutedEventHandler(webBrowser1_Unloaded);
}
public void webBrowser1_Unloaded(object sender, RoutedEventArgs e)
{
HTMLDocument doc = (HTMLDocument)webBrowser1.Document;
IHTMLElementCollection theElementCollection = doc.getElementsByTagName("Input");
foreach (IHTMLElement curElement in theElementCollection)
{
string uiAuto = curElement.getAttribute("Passwd");
if (string.IsNullOrEmpty(uiAuto))
{
curElement.setAttribute("Passwd", "test");
}
}
}