Forum Discussion

JamieBrydges's avatar
JamieBrydges
New Contributor
8 years ago

How do you wait for a page to load in TestLeft?

Hi,

I'm using TestLeft with visual studio C#.  I need to get my code to wait for the web page to load.  I don't want to use hard delays (e.g.  Thread.Sleep(2000) ).   Does anybody have any examples of how to do this?

 

Thanks,

Jamie.

1 Reply

  • JuliaBernikova's avatar
    JuliaBernikova
    SmartBear Alumni (Retired)

    Hi Jamie,

     

    You can use the IWebPage.Wait method. Here is a simple example:

     

    IWebPage page = Driver.Find<IWebBrowser>(new WebBrowserPattern()
    {
    ObjectIdentifier = "chrome"
    }).Find<IWebPage>(new WebPagePattern()
    {
    URL = "https://community.smartbear.com/t5/TestLeft/How-do-you-wait-for-a-page-to-load-in" +
    "-TestLeft/m-p/119673",
    ObjectGroupIndex = 0
    });
    /*...*/
    page.Wait(1000);