Forum Discussion
AlexKaras
11 years agoChampion Level 3
> Can I get a simple answer to the question that I asked?
I'm afraid that this will be not easy because it is not clear what you are asking for.
In the initial post you asked:
> What is wrong with the attached syntax?
And did not mention (even after you was asked) what line gives an error.
> What is the correct vbscript to use the Back button?
This was answered by Ryan: Sys.Browser("chrome").BrowserWindow(0).Keys("[BS]")
Quite correct vbscript.
> How can I use the Browser Back function or Page.GoBack when the Page URL is unknown (because it can be one of many possibilities) ?
Why page URL is not known? As you was able to get to the initial page you already know its URL (if not, than just read url property of the page object, e.g.: strURL = Aliases.browser.page.URL).
So, unless it is not required by site functionality or some other requirements (but you did not mention this, so we may only guess) I see no reason to use the Back navigation.
Personally I would use the UI-less aproach I provided the link to previously.
If you still like UI way, why not to store initial URL in the variable and navigate to this initial address every time after you clicked the link?
Note, that after you navigated forth and back, the initial page is reloaded and thus is recreated in the browser, thus invalidating all objects that you've got in your code. This means that you:
a) Will need to obtain them a-new; and;
b) Somehow keep the track of the already clicked links in order not to click them for the second time.
The above two points are another good reason to consider the UI-less approach.
And finally, haven't you tried what was suggested by Ryan (or whatever shortcut initiates back navigation in IE and other browsers)? It should work technically but remember about invalidated objects been found previously.
I'm afraid that this will be not easy because it is not clear what you are asking for.
In the initial post you asked:
> What is wrong with the attached syntax?
And did not mention (even after you was asked) what line gives an error.
> What is the correct vbscript to use the Back button?
This was answered by Ryan: Sys.Browser("chrome").BrowserWindow(0).Keys("[BS]")
Quite correct vbscript.
> How can I use the Browser Back function or Page.GoBack when the Page URL is unknown (because it can be one of many possibilities) ?
Why page URL is not known? As you was able to get to the initial page you already know its URL (if not, than just read url property of the page object, e.g.: strURL = Aliases.browser.page.URL).
So, unless it is not required by site functionality or some other requirements (but you did not mention this, so we may only guess) I see no reason to use the Back navigation.
Personally I would use the UI-less aproach I provided the link to previously.
If you still like UI way, why not to store initial URL in the variable and navigate to this initial address every time after you clicked the link?
Note, that after you navigated forth and back, the initial page is reloaded and thus is recreated in the browser, thus invalidating all objects that you've got in your code. This means that you:
a) Will need to obtain them a-new; and;
b) Somehow keep the track of the already clicked links in order not to click them for the second time.
The above two points are another good reason to consider the UI-less approach.
And finally, haven't you tried what was suggested by Ryan (or whatever shortcut initiates back navigation in IE and other browsers)? It should work technically but remember about invalidated objects been found previously.
Related Content
Recent Discussions
- 7 hours agoSvetaG