Problems with webdocument.Navigate()

Ask general questions here.
Todor
Posts: 66
Joined: Mon Jul 25, 2011 11:28 am

Problems with webdocument.Navigate()

Post by Todor » Wed Oct 12, 2011 11:48 am

Hey :)
I have a problem with webdocument.Navigate(). I want to refresh a webpage until the Email i sent before is shown on the page. Here is my Code:

Code: Select all

private void LookForEntry()
        {
        	bool IsFound = false;
        	int counter = 0;
        	
        	Delay.Duration(1000);
        	webDocument.Navigate( Website + "/Lists/Tickets/AllItems.aspx");
        	webDocument.WaitForDocumentLoaded();
        	Delay.Duration(1000);
        	
        	try
        	{
        		Delay.Duration(1500);
        		BodyTag x = "/dom/body/";
        		((ATag)x.FindSingle(".//a[@innertext='" + Subject + "']")).Click();
        		IsFound = true;
        	}
        	catch (Exception ex)
        	{
        		if (counter <= 9)
        		{
        			counter++;
        			Report.Log(ReportLevel.Info, "" + ex.ToString() + "");
        			LookForEntry();
        		}
        		else if (counter == 10)
        		{
        			throw new Exception("Es wurde leider nichts gefunden!");
        		}
        	}
        	
        	if (IsFound == true)
        	{
        		SendReply();
        	}
        	    	
        }
I dont know why but the webDocument.Navigate( Website + "/Lists/Tickets/AllItems.aspx"); in the fifth row doesnt refresh the webpage it just opens a new tab in the IE. What am i missing here?

User avatar
Support Team
Site Admin
Site Admin
Posts: 11709
Joined: Fri Jul 07, 2006 4:30 pm
Location: Graz, Austria

Re: Problems with webdocument.Navigate()

Post by Support Team » Wed Oct 12, 2011 1:25 pm

Hi,

I tried it by myself but haven't had this issue with WebDocument.Navigate.
If you just want to reload your page you can use following code instead:
webDocument.ExecuteScript("location.reload()");
Kind regards,
Tobias
Support Team
.
Image

Todor
Posts: 66
Joined: Mon Jul 25, 2011 11:28 am

Re: Problems with webdocument.Navigate()

Post by Todor » Wed Oct 12, 2011 2:02 pm

That did the trick, thanks very much. :)