Powershell open browser tab and get process id to close later?

Kdes

Well-Known Member
Joined
Aug 21, 2007
Messages
158
Reaction score
3
Good Day

We have a website that we need to open and let the page run some ajax posts. We would like to automate the process. Ie open the website wait 40 seconds then close that tab/browser instance.
The url changes dynamically.

The idea would be get the url, open firefox/chrome get process id close after 40 seconds.

However when i try get the process id, im getting different Ids as the ones the tabs run in.

For example;
$TheID = Start-Process "C:\Program Files\Mozilla Firefox\firefox.exe" '-new-window http://www.google.co.za' -PassThru

But the ID is not any of the IDs found in task manager.

Anyone by chance know how i close the correct tab after opening with powershell?
Maybe there is another way i can do this?

Thanks
 
Hey man,
why dont you use normal bat script, I dont have firefox installed but I think the idea will be the same.
cmd
start chrome www.google.co.za
timeout 40
taskkill /im chrome.exe /f
 
Top
Sign up to the MyBroadband newsletter
X