locked
How to refresh the browser in a coded ui test RRS feed

  • Question

  • My application is up and running in IE 9 but sometimes not everything loads properly on the page and it causes my coded ui test to fail.  So I want to add code to my coded ui test to refresh (F5) the browser when this happens.  Using VS2010.  How can I do this?
    Friday, January 25, 2013 3:26 PM

Answers

  • Hi a123Sean123,

    If you want to just refresh the page, you can use the following code immediately after the line where

    browser navigates to particular url.

    Keyboard.SendKeys("{F5}");

    However, if you are still hitting the problem of controls not getting loaded properly,

    try waiting for sometime after the page navigation happens with below code.

    Playback.Wait(5000); //waits 5 seconds after its previous line got executed.


    S Pavan

    Monday, January 28, 2013 2:53 PM

All replies

  • Hi a123Sean123,

    Welcome to the MSDN forum!

    Since the coded UI tests playback the action recorded by the recorder, so if you want to refresh your page, one idea is that you would make your app could be updated, for example, you could make sure that your app have a control, it could update the page when you click it. Another workaround is that you could click the control for refresh in your browser, for example, you could get this control in the IE under View->Refresh, you could record the action to click this control in your coded UI test.

    Best Regards,


    Jack Zhai [MSFT]
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Sunday, January 27, 2013 3:06 AM
  • Hi a123Sean123,

    If you want to just refresh the page, you can use the following code immediately after the line where

    browser navigates to particular url.

    Keyboard.SendKeys("{F5}");

    However, if you are still hitting the problem of controls not getting loaded properly,

    try waiting for sometime after the page navigation happens with below code.

    Playback.Wait(5000); //waits 5 seconds after its previous line got executed.


    S Pavan

    Monday, January 28, 2013 2:53 PM