Internet explorer starts as a hidden background process with no visible window through Powershell script from Octopus

execution

(sohil) #1

We are running a Powershell script through Octopus where the script launches an instance of IE.
Basically my requirement is i want to launch an IE window and open an url through it , after which it will perform automated clicks and launch a file upload dialog. We are the using SendKeys to input the filename to the dialog window. The powershell script works does this fine when run locally.
However when we run it through Octopus the script gets stuck at the point where the upload dialog is clicked. We read some old blogs where it mentions the Octopus opens the GUI window in IE under background or hidden mode so the window isnt detected by the SendKeys function. Please let us know if there is a way around to make sure the IE window is run in Foreground and visible. We tried running the tentacle under local system account and checked the ‘Allow service to interact with the dekstop’ in the Tentacle service but still no luck.

Below is a small snippet of what we are doing.

$ie = New-Object -Com InternetExplorer.Application
$ie.Navigate(“http://www.google.com”)
$ie.Visible = $true

Please help us with this issue or a possible solution to get it implemented through Octopus.


(Henrik Andersson) #2

Hi,

Thanks for getting in touch.

You would have to run the Tentacle service in an interactive session, i.e. starting the Tentacle service from the console instead of running it as a Windows Service.

I hope that helps.

Thank you and kind regards,
Henrik


(sohil) #3

Thank you for the quick response Henrik. In our current setup we have configured one tentacle on the server and whenever we create a new release on Octopus dashboard and deploy, the script is ran on the server through the tentacle.
Are you suggesting we call the tentacle.exe command line the from within the Octopus step and have it run through the service? If possible please send us an elaboration or a quick example of how we can use the tentacle command line to start the powershell script.

Regards,
Sohil


(Henrik Andersson) #4

Hi Sohil,

On the server that you have installed your Tentacle on, instead of running the Windows Service, open a command prompt and execute the following command: "<PathToYourTentacleInstallFolder>\Tentacle.exe" run --console this will run the Tentacle in an interactive session.

I hope that helps.

Thank you and kind regards,
Henrik


(sohil) #5

Hi Henrik,

Thanks a lot for your valuable help in getting this implemented. I tried this out today and it worked as expected , these are the steps i followed.

  • I stopped the tentacle windows service manually on the target server and launched the tentacle.exe as you mentioned above. Then i started the deployment from Octopus dashboard, this time it launched the IE window in my session (as i was logged into that server) and the file dialog window was detected by Sendkeys and the upload was completed.

However I want it to be automated through Octopus dashboard, we can stop the tentacle windows service from within the octopus step and in next step launch the tentacle.exe cmd line. Now here the issue is if we stop the tentacle it would fail at the 1st step before going on the next step to launch the tentacle.exe. It also can’t start the tentacle.exe in cmd line, before the windows service is stopped. So its like a catch 22 situation.

Could you please suggest a way on how we can go ahead in this situation or any alternative approach path would be really helpful here. Please let me know if you need more clear details on the problem.

Thanks in advance.


(Henrik Andersson) #6

Hi Sohil,

Good to hear that the manual way worked as expected. Now, the problem is that you’re again wanting to launch an interactive session from a non-interactive session which isn’t going to work.

A solution I’ve seen in cases like these is to create a scheduled task that launches the application they want to run in an interactive session and then execute that scheduled task using a PowerShell script in Octopus.

This could possibly work for you, but you’d have to:

  • Install another Tentacle instance on the server that would be used for launching IE
  • Have a health check step that runs after the scheduled task has started the Tentacle so that it gets included in your deployment that is running.

I hope that helps.

Thank you and kind regards,
Henrik


(sohil) #7

Thanks a lot Henrik, I would definitely give a try for both and check if it works out.
Cheers!


(system) #8

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.