I have the following script for logging in to salesforce on IE. I want to login using chrome or firefox. If I need a completely new script I will use it.
$username = "[email protected]"
$password = "Mypassword"
$ie = New-Object -com InternetExplorer.Application
$ie.visible=$true
$ie.navigate("https://login.salesforce.com")
while ($ie.Busy -eq $true)
{
Start-Sleep -Milliseconds 1000;
}
$ie.document.getElementById("username").value= "$username
$ie.document.getElementById("password").value = "$password"
$login = $ie.document.getElementsByClassName("button r4 wide primary") | Select-Object -first 1
$login.click()
This is evil, if you want systematic access and automation you should look into proper REST or SOAP API access, with OAuth2 flows. There's even a flow where you don't share password, the trust is established by signing a request with certificate that was earlier uploaded to SF and the user preauthorised...
This should never be part of any serious deliverable. If this gets hacked - your company / client can sue for damages.
If you really need it you can use simple GET like https://login.salesforce.com/[email protected]&pw=hunter2, no need for fancy scripting. In Setup -> Login History you'll see that the method was GET instead of POST (submitting the real form). I don't think it's officially supported, they could change it anytime. It'd pass your password plaintext over the web...
Edit: Check what your company signed. For example the Master Service Agreement https://a.sfdcstatic.com/content/dam/www/ocms-backup/assets/pdf/misc/salesforce_MSA.pdf
(…)the Service or Content may not be accessed by more than that number of Users, (b) a User’s password may not be shared with any other individual(…)