How to?/back browser button(JavaScript/Chrome)
SOLVED- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
Solved! Go to Solution.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
Robert Martin
[Hall of Fame]
Please consider giving a Kudo if I write good stuff
----
Why automate? I do automated testing because there's only so much a human being can do and remain healthy. Sleep is a requirement. So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.
Mysterious Gremlin Master
Vegas Thrill Rider
Extensions available
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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(((((
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
OMG
)))))
Alt+Left
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Yup... That's what the ~ character is for. 😉
Robert Martin
[Hall of Fame]
Please consider giving a Kudo if I write good stuff
----
Why automate? I do automated testing because there's only so much a human being can do and remain healthy. Sleep is a requirement. So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.
Mysterious Gremlin Master
Vegas Thrill Rider
Extensions available
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
So in my case the syntaxe is:
var page = Sys.Browser().Page("*");
page.Keys("~[Left]");
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
Additionally you can call this method:
page = Aliases.browser.yourPageObject; //OR page = Sys.Browser().Page("*");
page.window.history.back();
as well as:
page.window.history.forward();
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks DexBhp, I changed the tool for automation, so I can't confirm your approach.
Sorry, I hope it will help to some body
