none
how do I access navigate to url via hyperlink using HTMLDocument? RRS feed

  • Question

  • I have used the code below to access a page with frames and then to access links within the frames. There is one link in particular that I want to navigate to without the user clicking it. I can't simply use webBrowser.navigate(url); I get redirected back to the main page with frames. Is it possible to use the HTMLDocument DOM to programmatically click the link and access the page?

     

    string linkNeeded = null;

    HtmlWindow currentWindow=myWebBrowser3.Document.Window;

    foreach (HtmlWindow frame in currentWindow.Frames)

    {

    finalFrame = frame.Url.ToString();

    frameArray.Add(finalFrame);

    listBox1.Items.Add(finalFrame);

    //label2.Text = frameCount.ToString();

    //frameCount++;

    foreach (HtmlElement linkElem in frame.Document.Links)

    {

    frameLinksHash.Add(linkElem.GetAttribute("HREF"),"Url");

    }

    linkNeeded = frameLinksHash.ContainsKey("http://10.170.8.133:8080/OvisDashboard/jsp/StatusWorkspaceView.jsp");

    }

    }

     

     

     

    Tuesday, June 5, 2007 5:46 PM