[FIX] script selenium: support snap firefox for Ubuntu
This commit is contained in:
parent
621670e7c9
commit
273763a4fb
1 changed files with 11 additions and 4 deletions
|
|
@ -13,6 +13,7 @@ import sys
|
||||||
import tempfile
|
import tempfile
|
||||||
import time
|
import time
|
||||||
import tkinter as tk
|
import tkinter as tk
|
||||||
|
from pathlib import Path
|
||||||
from tkinter import filedialog
|
from tkinter import filedialog
|
||||||
|
|
||||||
from pykeepass import PyKeePass
|
from pykeepass import PyKeePass
|
||||||
|
|
@ -226,10 +227,16 @@ class SeleniumLib(object):
|
||||||
self.config.firefox_binary_path
|
self.config.firefox_binary_path
|
||||||
)
|
)
|
||||||
elif not self.config.use_network:
|
elif not self.config.use_network:
|
||||||
status_location = subprocess.check_output(
|
# test snap firefox for Ubuntu first
|
||||||
["which", "firefox"], text=True
|
snap_firefox_path = "/snap/bin/firefox"
|
||||||
).strip()
|
firefox_path_exist = Path(snap_firefox_path).exists()
|
||||||
firefox_options.binary_location = status_location
|
if firefox_path_exist:
|
||||||
|
firefox_options.binary_location = snap_firefox_path
|
||||||
|
else:
|
||||||
|
status_location = subprocess.check_output(
|
||||||
|
["which", "firefox"], text=True
|
||||||
|
).strip()
|
||||||
|
firefox_options.binary_location = status_location
|
||||||
|
|
||||||
firefox_profile = webdriver.FirefoxProfile()
|
firefox_profile = webdriver.FirefoxProfile()
|
||||||
firefox_profile.set_preference(
|
firefox_profile.set_preference(
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue