Network Automation Software We are currently migrating this forum
over to our HelpSystems domain. Please
post all new threads in our new
HelpSystems Community Portal.
Post to the HelpSystems Forum
You are not currently logged on. You must be logged on in order to post. Log on
Or Create a new account
AutoMate Discussion
Decrease font size
Increase font size
Topic Title: Using BrowserSession across tasks
Topic Summary: in downstream task, "BrowserSession1" is unrecognized
Created On: 03/31/2014 02:57 PM
Status: Read Only
Linear : Threading : Single : Branch
Search Topic Search Topic
Topic Tools Topic Tools
View similar topics View similar topics
View topic in raw text format. Print this topic.
Answer This question was answered by JohnScott, on Wednesday, April 2, 2014 2:02 PM

Answer:
Hmmm. So this is shaping up to be a version compatibility issue. When I import and run your workflow, it fails in exactly the same place and manner that mine does. It fails at the first navigate step in Task 2 (Step 5 in the WF I sent, that navigate to the forum thread). when yours fails, the IE window with Google is up as the only IE window open, with only one tab in that window.

I'm running this on:
Win Svr 2003 SE sp2
BPA 8.0.1.10
IE 8.0.6001.18702, update versions 0

Let's call it quits here, Jean. I'll just stop trying to get this to work on my current version, re-factor my process to do it all in one task (as I've had to in previous WFs), and plan to try again when I am able to upgrade to BPA v9. Thank you for flogging this dead horse with me.
 03/31/2014 02:57 PM
User is offline View Users Profile Print this message

Author Icon
JohnScott
Artisan (200-499)

Posts: 231
Joined: 10/27/2010

I'm trying to split parts of some web-site navigation between two Tasks. I'm trying to use one Task to log in to the site (which I can then reuse in other workflows), and then a second Task to do a particular manipulation on that site.

When I put the Web Browser/Navigate step in the second Task, it fails with error 'Session "BrowserSession1" not found.' I take this to mean that the session object has not survived the Task that originally created it, or that the name alone is not sufficient to get back to it.

I've tried assigning %BrowserSession1% to a shared variable, but that errored out with the error that BrowserSession1 does not exist as a variable or function.

Am I trying to do something that is completely unsupported/impossible, or am I overlooking some other way to do this?

 Category Survey
AutoMate BPA Server 8 version: 8.0.1
Windows version: Windows 2003 R2
 03/31/2014 03:19 PM
User is offline View Users Profile Print this message

Author Icon
Valentineo McGowan
HelpSystems

Posts: 766
Joined: 09/03/2013

Hello John,

The session is created when using the Web Browser Open Activity or the Create session Activity.
Web Browser - Open:
http://www.networkautomation.c...eb_Browser_-_Open.htm
The objects obtained within the session are held in virtual memory.

Therefore it would be best practice to use the same task in multiple Workflows if you would not want to rebuild the same task again and again from scratch.



 Category Survey


-------------------------

Valentineo McGowan | Technical Consultant
AutoMate | Division of HelpSystems
HelpSystems, LLC | T: +1 213.738.6966 | F: +1.213.738.7665
 04/01/2014 09:38 AM
User is offline View Users Profile Print this message

Author Icon
JohnScott
Artisan (200-499)

Posts: 231
Joined: 10/27/2010

Valentineo, you don't seem to have read my post carefully. You're encouraging me to do exactly what I'm trying to do. My point is that when I try to do what you're recommending, it doesn't work.

How can I get a step in Task2 to reference the same "BrowserSession1" that was created by a step in Task1?

 Category Survey
AutoMate BPA Server 8 version: 8.0.1
Windows version: Windows 2003 R2
 04/01/2014 10:42 AM
User is offline View Users Profile Print this message

Author Icon
Valentineo McGowan
HelpSystems

Posts: 766
Joined: 09/03/2013

Hello John,

My apologies, perhaps I was not clear. You cannot 'split web navigation' between two tasks. The steps that you used within the first task will have to exist in the 2nd task. You cannot access a previous browser session that has ended or has been closed.
It also may be advisable to either have ALL the interactivity task place within one task as well.
Was there a specific reason you were attempting to divide the web navigation interactive actions across two separate tasks?

 Category Survey


-------------------------

Valentineo McGowan | Technical Consultant
AutoMate | Division of HelpSystems
HelpSystems, LLC | T: +1 213.738.6966 | F: +1.213.738.7665
 04/01/2014 11:00 AM
User is offline View Users Profile Print this message

Author Icon
JohnScott
Artisan (200-499)

Posts: 231
Joined: 10/27/2010

Thanks for clarifying, Valentineo. I will give up on what I was trying to do, and reorganize my code so that all interactions to a single site are in a single task.

The reason I was trying to split things up was that I have two workflows that both need to log in to the same web site. Once they are logged in, they need to navigate to different internal pages and do different things. The two workflows also need to execute at different times of day. I thought I would embrace the reusability of Repository tasks by having one task that logs in to the site.. Both workflows could include that task, then follow it with separate tasks that do the different actions within the session established by the reusable task.

I continue to stumble a bit on your phrasing of "a previous browser session that has ended or has been closed". These workflows log in to the console on the AutoMate screen. The task that logs in to the site leaves the browser window undisturbed in the machine session. So from IE's point of view, the session has not changed. It is only the Task that has ended. That's why I expected the object pointed to by the name "BrowserSession1" to survive, or for it to have some object manifestation that could be assigned to a shared variable that I could use in the next Task.

Never mind. You have told me that N.A. says I have to do it in the only way I have found to work, so I'll just do it that way (with everything in a single task).

 Category Survey
AutoMate BPA Server 8 version: 8.0.1
Windows version: Windows 2003 R2
 04/01/2014 11:42 AM
User is offline View Users Profile Print this message

Author Icon
JeanDelfosse
Supreme Guru (1000+)

Posts: 8883
Joined: 03/30/2005

John,
let me try intervening.
You can have the first task open the IE browser window , logon and leave it open. It can pass the window handle to the workflow thru a shared variable.
In the second task you can create a session that recuperates that window by that handle, and keep going with this new session. (step below)
The session in the second task will not be the same as the one in the first task, but I don't think this will be a problem for you, since you can now operate on the second session on the very same window.
Even if both sessions are identically named BrowserSession1 they will in fact be different, since the first one will have been closed in the first task.

This way you achieve your goal, don't you ?

 Category Survey
AutoMate BPA Server 8 version:
Windows version:



Task Steps: (Right click, Select All, Copy to copy to the clipboard. Steps can then be pasted into the AutoMate Task Builder)


-------------------------
Jean Delfosse - Automate Beta Tester
Win7 Pro 64 bits -Win XP Pro SP3 32 bits - AM8, AM7, BPA10, BPA9, BPA8, BPA7, AM6 Enterprise, AM4
 04/01/2014 12:25 PM
User is offline View Users Profile Print this message

Author Icon
JohnScott
Artisan (200-499)

Posts: 231
Joined: 10/27/2010

Jean, that sounds like exactly what I was asking for when I asked if I was overlooking some other way to do this. The thing you suggest displays in the Web Browser action dialog as "Create Session", and I missed recognizing this as a way to make for the new Task a Session object linked to an existing web brower window.

Before we sound the trumpets, though, I tried this. The Create Session/Attach step executed successfully. But then, at the very next step, when I tried to navigate to a new URL in that BrowserSession1, the task failed with error "Browser is not available."

I've confirmed that the shared variable I used to convey the window handle from Task1 to Task2 has a plausible value in it (that differs from the initial value).

The "Browser is not available" error makes it sound like the re-attachment was not as successful as we'd like. Any ideas?

 Category Survey
AutoMate BPA Server 8 version: 8.0.1
Windows version: Windows 2003 R2
 04/01/2014 01:16 PM
User is offline View Users Profile Print this message

Author Icon
JeanDelfosse
Supreme Guru (1000+)

Posts: 8883
Joined: 03/30/2005

For test purpose I have made the steps below where I first create an IE window,
then create a session with the handle value of that existing IE window, then navigate twice in a row successfully.
I did not use a shared var for this test to make it easy. But it would work the exact same way.
If you run these steps, does it work ?

For me it does with the following "output" in TB (French style, sorry !)

[Main](Étape 0) Tâche démarrée.
[Main](Étape 1) Création d'une variable "wh"...
[Main](Étape 2) Démarrage de l'activité "Exécuter...
[Main](Étape 2) Démarrage d'un processus C:\Program Files (x86)\Internet Explorer\IEXPLORE.EXE...
[Main](Étape 2) Activité "Exécuter terminée
[Main](Étape 3) Démarrage de l'activité "Window : Wait For Window"...
[Main](Étape 3) Waiting for window(s) to open...
[Main](Étape 3) Looking for matching windows...
[Main](Étape 3) Mise à niveau de la variable "wh"...
[Main](Étape 3) Activité "Window terminée : Wait For Window".
[Main](Étape 4) Démarrage de l'activité "Navigateur Web : Créer une session"...
[Main](Étape 4) Activité "Navigateur Web terminée : Créer une session".
[Main](Étape 5) Début de Mettre la tâche en pause pour 5 seconds...
[Main](Étape 5) Fin de Mettre la tâche en pause pour 5 seconds.
[Main](Étape 6) Démarrage de l'activité "Navigateur Web : Naviguez jusqu'à une page."...
[Main](Étape 6) Navigation vers "http://forums.networkautomatio...nterthread=y#68772"...
[Main](Étape 6) Attente que le navigateur soit prêt...
[Main](Étape 6) Activité "Navigateur Web terminée : Naviguez jusqu'à une page.".
[Main](Étape 7) Début de Mettre la tâche en pause pour 5 seconds...
[Main](Étape 7) Fin de Mettre la tâche en pause pour 5 seconds.
[Main](Étape 8) Démarrage de l'activité "Navigateur Web : Naviguez jusqu'à une page."...
[Main](Étape 8) Navigation vers "www.networkautomation.com"...
[Main](Étape 8) Attente que le navigateur soit prêt...
[Main](Étape 8) Activité "Navigateur Web terminée : Naviguez jusqu'à une page.".
[Main](Étape 8) Tâche terminée.

 Category Survey
AutoMate BPA Server 8 version:
Windows version:



Task Steps: (Right click, Select All, Copy to copy to the clipboard. Steps can then be pasted into the AutoMate Task Builder)


-------------------------
Jean Delfosse - Automate Beta Tester
Win7 Pro 64 bits -Win XP Pro SP3 32 bits - AM8, AM7, BPA10, BPA9, BPA8, BPA7, AM6 Enterprise, AM4
 04/01/2014 02:05 PM
User is offline View Users Profile Print this message

Author Icon
JohnScott
Artisan (200-499)

Posts: 231
Joined: 10/27/2010

Jean, I'm assume the code you offer works, but it's not what I'm trying to do. The code you offer attaches a session to a browser window opened within the same Task. I'm trying to attach a session to a browser window that was opened in a preceding task.

I have boiled my approach down to its essentials and attached a demonstration workflow.
(1) The "Establish Session" task uses a Web Browser/Open step to open an IE window and navigate to one page at a site. It puts the window handle into a shared variable.
(2) Then the "Navigate in Session" task uses the shared variable handle with a Web Browser/Create Session step to try to link a session to the existing window. The Web Browser/Navigate step that follows errors out because the "Browser is not available".

 Category Survey
AutoMate BPA Server 8 version: 8.0.1
Windows version: Windows 2003 R2





Edited: 04/01/2014 at 03:22 PM by JohnScott
 04/02/2014 05:53 AM
User is offline View Users Profile Print this message

Author Icon
JeanDelfosse
Supreme Guru (1000+)

Posts: 8883
Joined: 03/30/2005

John,
I do understand what you mean, and my sample task was just to show how one could in a second task open a browser session on an IE that was previously opened in a former first task.
I should have been more clear. Sorry. See below a more explicit version.

Tell me if you can exercise it.

 Category Survey
AutoMate BPA Server 8 version:
Windows version:



Task Steps: (Right click, Select All, Copy to copy to the clipboard. Steps can then be pasted into the AutoMate Task Builder)


-------------------------
Jean Delfosse - Automate Beta Tester
Win7 Pro 64 bits -Win XP Pro SP3 32 bits - AM8, AM7, BPA10, BPA9, BPA8, BPA7, AM6 Enterprise, AM4
 04/02/2014 10:06 AM
User is offline View Users Profile Print this message

Author Icon
JohnScott
Artisan (200-499)

Posts: 231
Joined: 10/27/2010

Jean, merci beaucoup for your patience with my denseness in this, for spelling out to me in greater detail what you were trying to show.

When I try this code with my default workflow/task properties, so that it runs in the background, the first task doesn't complete because the window is never opened in the foreground console.

When I alter the properties to the ones I've been using with my efforts, to logon to the console, then Task2 fails in the same place and the same way as my efforts have. (I've attached the exported workflow so you can test it on your system.) The shared variable gets a believable value for the window handle, and the Create Session/Attach step completes without error, but the navigate step fails because "Browser is not available."

 Category Survey
AutoMate BPA Server 8 version: 8.0.1
Windows version: Windows 2003 R2



 04/02/2014 12:06 PM
User is offline View Users Profile Print this message

Author Icon
JeanDelfosse
Supreme Guru (1000+)

Posts: 8883
Joined: 03/30/2005

John,
I imported your ampkg in my BPA8 and it works nicely here.
I have added message boxes at the end of task1 and at the beginning of task2 to check the window handle (attached ampkg), and everything is as I expected.

My versions:
Win 7 Pro 64 bits SP1
BPA 8.0.1.10
IE 9.0.8112 Update level 9.0.25
What about yours ?

I have no other IE window open while running the workflow, and there is only one single tab in the browser, the one this WF opens.

I don't know what else I can try to help you.

The message you get "Browser is not available." (BTW, on which step ?) would mean that either the window gets closed or is altered by another process. Can you watch it while the workflow runs, and see if/when it fails to follow the sequence Google/forum/NA front page ?

I am unsure the problem does not lie in the "background" operation you specify.
Could you try running it with a user session ?

 Category Survey
AutoMate BPA Server 8 version:
Windows version:





-------------------------
Jean Delfosse - Automate Beta Tester
Win7 Pro 64 bits -Win XP Pro SP3 32 bits - AM8, AM7, BPA10, BPA9, BPA8, BPA7, AM6 Enterprise, AM4


Edited: 04/02/2014 at 12:14 PM by JeanDelfosse
 04/02/2014 02:02 PM
User is offline View Users Profile Print this message

Author Icon
JohnScott
Artisan (200-499)

Posts: 231
Joined: 10/27/2010

Answer Answer
Hmmm. So this is shaping up to be a version compatibility issue. When I import and run your workflow, it fails in exactly the same place and manner that mine does. It fails at the first navigate step in Task 2 (Step 5 in the WF I sent, that navigate to the forum thread). when yours fails, the IE window with Google is up as the only IE window open, with only one tab in that window.

I'm running this on:
Win Svr 2003 SE sp2
BPA 8.0.1.10
IE 8.0.6001.18702, update versions 0

Let's call it quits here, Jean. I'll just stop trying to get this to work on my current version, re-factor my process to do it all in one task (as I've had to in previous WFs), and plan to try again when I am able to upgrade to BPA v9. Thank you for flogging this dead horse with me.

 Category Survey
AutoMate BPA Server 8 version: 8.0.1
Windows version: Windows 2003 R2
 04/02/2014 06:32 PM
User is offline View Users Profile Print this message

Author Icon
JeanDelfosse
Supreme Guru (1000+)

Posts: 8883
Joined: 03/30/2005

That's a pity, John.
I cannot figure out what differs from your situation and mine while we are running the very same workflow.
I also made my tests on BPA8. and I'm unsure BPA9 would help. The problem is elsewhere.
I'm really sorry not having been able to resolve it to your advantage.

 Category Survey
AutoMate BPA Server 8 version:
Windows version:


-------------------------
Jean Delfosse - Automate Beta Tester
Win7 Pro 64 bits -Win XP Pro SP3 32 bits - AM8, AM7, BPA10, BPA9, BPA8, BPA7, AM6 Enterprise, AM4
 04/03/2014 06:57 AM
User is offline View Users Profile Print this message

Author Icon
Leonard Amabile
HelpSystems

Posts: 5454
Joined: 05/15/2007

Hi John,

There have been a lot of corrections in BPA 8 since the version that you are currently running. You may want to update to the latest version, v8.0.9 and see if the problem persists. I tested your same workflow in v8.0.9 and was able to complete the workflow successfully.




 Category Survey
AutoMate BPA Server 8 version:
Windows version:


-------------------------

Leonard Amabile | Director, Cross Platform Support
AutoMate | InterMapper | Skybot | Divisions of HelpSystems
T: +1.213.738.1700 | F: +1.213.738.7665
 04/03/2014 09:07 AM
User is offline View Users Profile Print this message

Author Icon
JeanDelfosse
Supreme Guru (1000+)

Posts: 8883
Joined: 03/30/2005

Leonard,
I have it working OK with 8.0.1.10, the exact same version as John's.
But maybe the web browser action was later enhanced a bit and have better compatibility with IE8 ?

 Category Survey
AutoMate BPA Server 8 version:
Windows version:


-------------------------
Jean Delfosse - Automate Beta Tester
Win7 Pro 64 bits -Win XP Pro SP3 32 bits - AM8, AM7, BPA10, BPA9, BPA8, BPA7, AM6 Enterprise, AM4
Statistics
18258 users are registered to the AutoMate Discussion forum.
There are currently 0 users logged in.
The most users ever online was 5551 on 01/08/2018 at 11:11 AM.
There are currently 2074 guests browsing this forum, which makes a total of 2074 users using this forum.

FuseTalk Enterprise Edition v4.0 - © 1999-2020 FuseTalk Inc. All rights reserved.

Sitemap Network Automation Software Blog