Forum Discussion

arybalka's avatar
arybalka
Occasional Contributor
7 years ago
Solved

How to?/back browser button(JavaScript/Chrome)

Hi every one,

I can not find how to use back browser button.(JavaScript/Chrome)

I am looking for something like:

 

var page = Sys.Browser().Page("*");

page.back()//doesn't exist - just example 

OR

Browsers.Item(btChrome).back()//doesn't exist - just example 

 

Thanks

 

 

  • Instead of attempting a custom action or looking for a particular method, use the Keys method on the page object and send

     

    Aliases.browser.myPage.Keys(~[Left])

    I'm not entirely certain but I think this keystroke combination is supported by all browser types.

8 Replies

  • tristaanogre's avatar
    tristaanogre
    Esteemed Contributor

    Instead of attempting a custom action or looking for a particular method, use the Keys method on the page object and send

     

    Aliases.browser.myPage.Keys(~[Left])

    I'm not entirely certain but I think this keystroke combination is supported by all browser types.

    • arybalka's avatar
      arybalka
      Occasional Contributor

      Thanks Robert,

      I tried:

      .........

      var page = Sys.Browser().Page("*");
      page.Keys("[Left]");//Log:Keyboard input. Normal 13:06:06
      page.Keys("[Left]");//Log:Keyboard input. Normal 13:06:06
      page.Keys("[Left]");//Log:Keyboard input. Normal 13:06:06

       

      But I am still on the same page(((((

  • DexBhp's avatar
    DexBhp
    Senior Member

    I have a better solution that is probably more what you are looking for,

     

    //Navigates to the previous item in the history list.
    var pageObj = Aliases.browser.Page("*");
    pageObj.contentDocument.Script.eval("history.back()");
    Delay(1000);

     

    I really don't understand why there isn't a function implemented in test complete to do this natively.

    • arybalka's avatar
      arybalka
      Occasional Contributor

      Thanks DexBhp, I changed the tool for automation, so I can't confirm your approach.

      Sorry, I hope it will help to some body