Skip to content

Instantly share code, notes, and snippets.

@PrateekKumarSingh
Created February 5, 2018 14:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save PrateekKumarSingh/6ebb2f8889a75c973c51ccfb74082c22 to your computer and use it in GitHub Desktop.
Save PrateekKumarSingh/6ebb2f8889a75c973c51ccfb74082c22 to your computer and use it in GitHub Desktop.
# Create an Internet Explorer object
$ie = New-Object -ComObject 'internetExplorer.Application'
$ie.Visible= $true # Make it visible
# Open all websites
$ie.Navigate("www.linkedin.com")
# Navigate2() function to open in new tab in the same IE window
$ie.Navigate2("www.facebook.com",0x1000)
$ie.Navigate2("www.gmail.com",0x1000)
$ie.Navigate2("login.live.com/",0x1000)
# Script to wait till webpage is downloaded into the browsers.
while ($ie.Busy -eq $true){Start-Sleep -seconds 4;}
# Feed in your credentials to the input fields on the web page
$usernamefield = $ie.Document.getElementByID('session_key-Login')
$usernamefield.value = 'YouEmailAddress@gmail.com'
$passwordfield = $ie.Document.getElementByID('Session_password-login')
$passwordfield.value = 'YouP@ssword'
$link=$ie.Document.getElementByID('signin')
$link.click()
# Facebook Login
# To Identify the Facebook window among the existing IE tabs.
$ie = (New-Object -COM "Shell.Application").Windows() |
?{$_.locationname -like '*facebook*'}
If($ie.Document -eq $null){ $ie.Refresh()}
while ($ie.Busy -eq $true){Start-Sleep -seconds 1}
# Feed in your credentials to input fields on the web page
$usernamefield = $ie.Document.getElementByID('email')
$usernamefield.value = 'YouEmailAddress@gmail.com'
$passwordfield = $ie.Document.getElementByID('pass')
$passwordfield.value = 'YouP@ssword'
$Link=$ie.Document.getElementByID("u_0_n")
$Link.click()
# Gmail Login
# To Identify the Gmail window among the existing IE tabs.
$ie = (New-Object -COM "Shell.Application").Windows() | ?{$_.locationname -like '*gmail*'}
If($ie.Document -eq $null){ $ie.Refresh()}
while ($ie.Busy -eq $true){Start-Sleep -seconds 1; echo 'loading gmail tab...'}
# Feed in your credentials to input fields on the web page
$usernamefield = $ie.Document.getElementByID('email')
$usernamefield.value = 'YouEmailAddress@gmail.com'
$passwordfield = $ie.Document.getElementByID('passwd')
$passwordfield.value = 'YouP@ssword'
$Link=$ie.Document.getElementByID('signin')
$Link.click()
# Microsoft Live Log In
# To Identify the Microsoft Live window among the existing IE tabs.
$ie = (New-Object -COM "Shell.Application").Windows() | ?{$_.locationname -like '*microsoft*'}
If($ie.Document -eq $null){ $ie.Refresh()}
while ($ie.Busy -eq $true){Start-Sleep -seconds 1; echo 'loading Live.com '}
# Feed in your credentials to input fields on the web page
$usernamefield = $ie.Document.getElementByID('i0116')
$usernamefield.value = 'YouEmailAddress@gmail.com'
$passwordfield = $ie.Document.getElementByID('i0118')
$passwordfield.value = 'YouP@ssword'
$Link=$ie.Document.getElementByID('idSIButton9')
$Link.click()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment