Big list of selenium options + injecting cookies for testing

Use these options as you need!

import csv
import random
import time
from selenium.webdriver.chrome.options import Options
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.common.exceptions import NoSuchElementException
import pickle


option = Options()
# option.add_argument("headless")

# option.add_argument("window-size=1980,960")
# option.add_argument("screenshot")
# option.add_argument(
#     "user-agent=Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36")
# option.add_argument("--enable-javascript")
# option.add_argument("--disable-infobars")
# option.add_argument("start-maximized")
# option.add_argument("--disable-extensions")

# option.add_argument("--start-maximized")
# option.add_argument("--disable-dev-shm-usage")
# option.add_argument("disable-gpu")
# option.add_argument("--no-sandbox")
# option.add_argument("--remote-debugging-port=9222")
# option.add_argument("-ignore-certificate-errors")
# option.add_argument("--proxy-server='direct://'")
# option.add_argument("--proxy-bypass-list=*")
# option.add_argument("--allow-running-insecure-content")
# option.add_argument(r"--user-data-dir=C:\Users\USERNAME\AppData\Local\Google\Chrome\User Data")

driver_live = webdriver.Chrome(options=option, executable_path=r"PATH TO chromedriver.exe")
# print(driver_live.get_cookies())
# cookies = pickle.load(open("cookies.pkl", "rb"))
# print(cookies)
# for cookie in cookies:
#     driver_live.add_cookie(cookie)
driver_live.get("URL_HERE")

SNAPPED!

Comments

Popular posts from this blog

Append to a json file python

Setup Mailhog mail server on Ubuntu