Browse Source
Merge pull request #100 from weskerfoot/configure-chrome-location
add option to pass path to chrome binary
pull/102/head
Wesley Kerfoot
5 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with
18 additions and
4 deletions
-
deletefb/deletefb.py
-
deletefb/tools/chrome_driver.py
-
deletefb/tools/login.py
|
@ -89,6 +89,16 @@ def run_delete(): |
|
|
help="The year(s) you want posts deleted." |
|
|
help="The year(s) you want posts deleted." |
|
|
) |
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
parser.add_argument( |
|
|
|
|
|
"-B", |
|
|
|
|
|
"--chromebin", |
|
|
|
|
|
required=False, |
|
|
|
|
|
default=False, |
|
|
|
|
|
dest="chromebin", |
|
|
|
|
|
type=str, |
|
|
|
|
|
help="Optional path to the Google Chrome (or Chromium) binary" |
|
|
|
|
|
) |
|
|
|
|
|
|
|
|
args = parser.parse_args() |
|
|
args = parser.parse_args() |
|
|
|
|
|
|
|
|
settings["ARCHIVE"] = not args.archive_off |
|
|
settings["ARCHIVE"] = not args.archive_off |
|
@ -102,7 +112,8 @@ def run_delete(): |
|
|
user_email_address=args.email, |
|
|
user_email_address=args.email, |
|
|
user_password=args_user_password, |
|
|
user_password=args_user_password, |
|
|
is_headless=args.is_headless, |
|
|
is_headless=args.is_headless, |
|
|
two_factor_token=args.two_factor_token |
|
|
two_factor_token=args.two_factor_token, |
|
|
|
|
|
chrome_binary_path=args.chromebin |
|
|
) |
|
|
) |
|
|
|
|
|
|
|
|
if args.mode == "wall": |
|
|
if args.mode == "wall": |
|
|
|
@ -51,7 +51,6 @@ def setup_selenium(driver_path, options): |
|
|
# Configures selenium to use a custom path |
|
|
# Configures selenium to use a custom path |
|
|
return webdriver.Chrome(executable_path=driver_path, options=options) |
|
|
return webdriver.Chrome(executable_path=driver_path, options=options) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def get_webdriver(): |
|
|
def get_webdriver(): |
|
|
""" |
|
|
""" |
|
|
Ensure a webdriver is available |
|
|
Ensure a webdriver is available |
|
|
|
@ -5,11 +5,11 @@ import time |
|
|
|
|
|
|
|
|
from .chrome_driver import get_webdriver, setup_selenium |
|
|
from .chrome_driver import get_webdriver, setup_selenium |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def login(user_email_address, |
|
|
def login(user_email_address, |
|
|
user_password, |
|
|
user_password, |
|
|
is_headless, |
|
|
is_headless, |
|
|
two_factor_token): |
|
|
two_factor_token, |
|
|
|
|
|
chrome_binary_path=None): |
|
|
""" |
|
|
""" |
|
|
Attempts to log into Facebook |
|
|
Attempts to log into Facebook |
|
|
Returns a driver object |
|
|
Returns a driver object |
|
@ -27,6 +27,10 @@ def login(user_email_address, |
|
|
chrome_options = Options() |
|
|
chrome_options = Options() |
|
|
prefs = {"profile.default_content_setting_values.notifications": 2, 'disk-cache-size': 4096} |
|
|
prefs = {"profile.default_content_setting_values.notifications": 2, 'disk-cache-size': 4096} |
|
|
chrome_options.add_experimental_option("prefs", prefs) |
|
|
chrome_options.add_experimental_option("prefs", prefs) |
|
|
|
|
|
|
|
|
|
|
|
if chrome_binary_path: |
|
|
|
|
|
chrome_options.binary_location = chrome_binary_path |
|
|
|
|
|
|
|
|
chrome_options.add_argument("start-maximized") |
|
|
chrome_options.add_argument("start-maximized") |
|
|
|
|
|
|
|
|
if is_headless: |
|
|
if is_headless: |
|
|