Skip to content

KevArellano/Python-Web-Browser-Automation

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Python - Web Browser Automation

  • This script was made to open web browser tabs in incognito/private mode.

Requirements

Instructions

  1. Install dependencies.
  2. Create the script.
  3. Run and test.

1. Install dependencies.

  • Navigate to folder location where the script will be held. Here you can also navigate in your "File Explorer", right click, select "New" and click on "Text Document". Rename the file anything you wish, but make sure to change the extention file to ".py". In this tutorial we will call it "Web Browser Automation.py".
PS > CD '.\Documents\Python\Web Browser\'

2. Create the script.

  1. Import all dependencies that were installed in the beginning.
import webbrowser
  • We'll go ahead and start an array called "links" and with the variables of links we want to open up.
links = [
	"web.whatsapp.com/",
	"mail.protonmail.com/inbox"
	]
  • Here we will assign "links_length" to be the length of our "links" array to make it easier to add/delete links.
links_length = len(links)
  • The following is using FireFox and Google Chrome web browsers. You can apply to any web browser by following the ".exe" file saved on your computer. Please note that to open incognito/private tabs, you will have to include the end extention. If you desire to open up normal tabs just get rid of anything after "--".
firefox = "C:/Program Files/Mozilla Firefox/firefox.exe %s --private"
#google = "C:/Program Files (x86)/Google/Chrome/Application/chrome.exe %s --incognito"
  • Below is the loop that grabs the aforementioned "links_length" and runs through the array called "links". Lastly you get the web browser file and open up the links above.
for links_length in links:
	webbrowser.getfirefox ).open_newlinks_length )
	#webbrowser.get( google ).open_new( links_length )
  • Full code.
import webbrowser

links = [
	"web.whatsapp.com/",
	"mail.protonmail.com/inbox"
	]
links_length = len(links)

firefox = "C:/Program Files/Mozilla Firefox/firefox.exe %s --private"
#google = "C:/Program Files (x86)/Google/Chrome/Application/chrome.exe %s --incognito"

for links_length in links:
	webbrowser.getfirefox ).open_newlinks_length )
	#webbrowser.get( google ).open_new( links_length )

3. Run and test.

  • Always want to test it to make sure it's in working order.
PS > py '.\Web Browser Automation.py'

About

This script was made to open web browser tabs in incognito/private mode.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages