Link to home
Start Free TrialLog in
Avatar of janhoedt
janhoedt

asked on

Powershell: auto login website (Chrome and/or Edge Chromium)

Hi,

I d need to autologon to a website (Chrome and/or Edge Chromium) via Powershell. I probably need to detect the login textbox, password textbox and button to submit(?) 
Please advise how to approach this.

J
Avatar of David Favor
David Favor
Flag of United States of America image

If this is for testing purposes, better to use a headless browser (no display) like PhantomJS or Selenium.

You can search - site:https://chrome.google.com/webstore auto login - for many options.

Caveat: Many of these options store passwords in remote sites. Many of these sites are run by criminal organizations, making their money by reselling your login data.

Tip: Avoid auto-logins, if privacy is important to you... and never/ever/ever auto-login to accounts - bank/brokerage/PayPal/Stripe/etc... as your account(s) will very likely be drained at some point.

Tip: Also be very careful, as some auto-login code asks questions, to trick you into allowing an extension to have escalated privileges, so the extension records/saves/sells all login data, each time you login a new site.
Avatar of janhoedt
janhoedt

ASKER

Thanks, but after all it needs to be Edge Chromium, not Chrome. So the option you gave won't work for me.
Also, I asked for Powershell, you give a plugin. A plugin is not usable for Powershell. I'd need a generic script which I can use to autologin (it's for automating software install, for autologin there are many safe options like LastPass btw), not a plugin.
The only way to automate browser nowadays is using Web Driver. This is implemented in Selenium and derivates.

For a software installation use curl or PS/.NET classes to directly download it. Any other kind of automation makes imho no sense, but you can tell us about your context.
For using WebDriver to get full control, you need to download the correct release from https://developer.microsoft.com/en-us/microsoft-edge/tools/webdriver/, and then best use the module described at https://github.com/adamdriscoll/selenium-powershell.
Note that I had to extract the msedgedriver.exe as MicrosoftWebDriver.exe in a folder contained in PATH, and the starturl parameter does not work for me when calling Start-SeEdge.
Having said that, using Invoke-WebRequest wherever possible is the better choice.
Ok, so how do I use the Invoke-WebRequest then for passwords? 
ASKER CERTIFIED SOLUTION
Avatar of Qlemo
Qlemo
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial