Click here to Skip to main content
15,894,460 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am trying to access the html element inside an iframe but it doesnt work.


C#
HtmlWindow hwMain = webBrowser1.Document.Window.Frames[0];
            HtmlElementCollection eleCaptcha = hwMain.Document.GetElementsByTagName("iframe");

            foreach (HtmlElement he in eleCaptcha)
            {
                if (he.GetAttribute("name").Equals("VerifyimageFrame"))
                {
                    writeLogs(he.OuterHtml != null ? he.OuterHtml.ToString() : "Can't Find Element!");
                    he.Focus();
                    //Clipboard.SetImage(he);
                    HtmlElementCollection o = he.Document.Body.GetElementsByTagName("img");
                    foreach (HtmlElement he1 in o)
                    {
                        if (he1.GetAttribute("title").Equals("Refresh verification code"))
                        {
                            writeLogs(he1.OuterHtml != null ? he1.OuterHtml.ToString() : "Can't Find Element!");

                        }
                        else
                        {
                            MessageBox.Show("null");
                        }
                    }
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900