Link to home
Start Free TrialLog in
Avatar of deanlee17
deanlee17

asked on

Order code executes

Hi guys,

I have the following on 2 different button clicks:

Button1:

WebBrowser_Sourcing_BrokerForum_Enquiry.Navigate(new Uri(" http://www.brokerforum.com/iris-parts-search.authenticated-en.jsa"));

Open in new window


Button2:

 try
            {


                var htmlDoc1 = (HTMLDocument)WebBrowser_Sourcing_BrokerForum_Enquiry.Document;


                var UsernameTextBox = (mshtml.HTMLInputElement)htmlDoc1.all.item("Session_Username", 0);
                UsernameTextBox.value = "XXXX";

                var PasswordTextBox = (mshtml.HTMLInputElement)htmlDoc1.all.item("Session_Password", 0);
                PasswordTextBox.value = "XXXX";



                foreach (mshtml.HTMLInputElement HTMLI in ((mshtml.HTMLDocument)WebBrowser_Sourcing_BrokerForum_Enquiry.Document).getElementsByTagName("input"))
                {

                    if (HTMLI.getAttribute("type").Equals("image"))
                    {
                        if (HTMLI.src == "http://www.brokerforum.com/tbf/img/login-button-en.png")
                        {

                            HTMLI.click();
                            return;
                        }
                    }


                }
            }

            catch (Exception) { }

Open in new window


This all works fine. But when I combine the 2 into a 'loaded' grid event the login never occurs. Why do they work separately on buttons but not when combined? Is it the order the code is executing?

Thanks,
Dean
Avatar of Ess Kay
Ess Kay
Flag of United States of America image

have you tried debugging it?

Set up a breakpoint, and see if they even get called in the first place
Avatar of deanlee17
deanlee17

ASKER

It does indeed.
ASKER CERTIFIED SOLUTION
Avatar of Ess Kay
Ess Kay
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Nice idea, but it doesn't change anything.