Add option to enable WebGL and 3D APIs
This commit is contained in:
parent
554cd02f96
commit
349d6bfa80
|
@ -362,6 +362,7 @@ def _set_chrome_options(
|
|||
guest_mode,
|
||||
devtools,
|
||||
remote_debug,
|
||||
enable_3d_apis,
|
||||
swiftshader,
|
||||
ad_block_on,
|
||||
block_images,
|
||||
|
@ -630,6 +631,7 @@ def _set_chrome_options(
|
|||
chrome_options.add_argument("--disable-prompt-on-repost")
|
||||
chrome_options.add_argument("--dns-prefetch-disable")
|
||||
chrome_options.add_argument("--disable-translate")
|
||||
if not enable_3d_apis:
|
||||
chrome_options.add_argument("--disable-3d-apis")
|
||||
if (
|
||||
is_using_uc(undetectable, browser_name)
|
||||
|
@ -904,6 +906,7 @@ def get_driver(
|
|||
guest_mode=False,
|
||||
devtools=False,
|
||||
remote_debug=False,
|
||||
enable_3d_apis=False,
|
||||
swiftshader=False,
|
||||
ad_block_on=False,
|
||||
block_images=False,
|
||||
|
@ -1068,6 +1071,7 @@ def get_driver(
|
|||
guest_mode,
|
||||
devtools,
|
||||
remote_debug,
|
||||
enable_3d_apis,
|
||||
swiftshader,
|
||||
ad_block_on,
|
||||
block_images,
|
||||
|
@ -1114,6 +1118,7 @@ def get_driver(
|
|||
guest_mode,
|
||||
devtools,
|
||||
remote_debug,
|
||||
enable_3d_apis,
|
||||
swiftshader,
|
||||
ad_block_on,
|
||||
block_images,
|
||||
|
@ -1164,6 +1169,7 @@ def get_remote_driver(
|
|||
guest_mode,
|
||||
devtools,
|
||||
remote_debug,
|
||||
enable_3d_apis,
|
||||
swiftshader,
|
||||
ad_block_on,
|
||||
block_images,
|
||||
|
@ -1264,6 +1270,7 @@ def get_remote_driver(
|
|||
guest_mode,
|
||||
devtools,
|
||||
remote_debug,
|
||||
enable_3d_apis,
|
||||
swiftshader,
|
||||
ad_block_on,
|
||||
block_images,
|
||||
|
@ -1493,6 +1500,7 @@ def get_remote_driver(
|
|||
guest_mode,
|
||||
devtools,
|
||||
remote_debug,
|
||||
enable_3d_apis,
|
||||
swiftshader,
|
||||
ad_block_on,
|
||||
block_images,
|
||||
|
@ -1688,6 +1696,7 @@ def get_local_driver(
|
|||
guest_mode,
|
||||
devtools,
|
||||
remote_debug,
|
||||
enable_3d_apis,
|
||||
swiftshader,
|
||||
ad_block_on,
|
||||
block_images,
|
||||
|
@ -2040,6 +2049,7 @@ def get_local_driver(
|
|||
edge_options.add_argument("--dom-automation")
|
||||
edge_options.add_argument("--disable-hang-monitor")
|
||||
edge_options.add_argument("--disable-prompt-on-repost")
|
||||
if not enable_3d_apis:
|
||||
edge_options.add_argument("--disable-3d-apis")
|
||||
if (
|
||||
selenium4_or_newer
|
||||
|
@ -2288,6 +2298,7 @@ def get_local_driver(
|
|||
guest_mode,
|
||||
devtools,
|
||||
remote_debug,
|
||||
enable_3d_apis,
|
||||
swiftshader,
|
||||
ad_block_on,
|
||||
block_images,
|
||||
|
@ -2351,6 +2362,7 @@ def get_local_driver(
|
|||
guest_mode,
|
||||
devtools,
|
||||
remote_debug,
|
||||
enable_3d_apis,
|
||||
swiftshader,
|
||||
ad_block_on,
|
||||
block_images,
|
||||
|
@ -2732,6 +2744,7 @@ def get_local_driver(
|
|||
guest_mode,
|
||||
devtools,
|
||||
remote_debug,
|
||||
enable_3d_apis,
|
||||
swiftshader,
|
||||
ad_block_on,
|
||||
block_images,
|
||||
|
|
|
@ -3189,6 +3189,7 @@ class BaseCase(unittest.TestCase):
|
|||
guest_mode=None,
|
||||
devtools=None,
|
||||
remote_debug=None,
|
||||
enable_3d_apis=None,
|
||||
swiftshader=None,
|
||||
ad_block_on=None,
|
||||
block_images=None,
|
||||
|
@ -3238,6 +3239,7 @@ class BaseCase(unittest.TestCase):
|
|||
guest - the option to enable Chrome's Guest mode (Chrome)
|
||||
devtools - the option to open Chrome's DevTools on start (Chrome)
|
||||
remote_debug - the option to enable Chrome's Remote Debugger
|
||||
enable_3d_apis - the option to enable WebGL and 3D APIs (Chrome)
|
||||
swiftshader - the option to use Chrome's swiftshader (Chrome-only)
|
||||
ad_block_on - the option to block ads from loading (Chromium-only)
|
||||
block_images - the option to block images from loading (Chrome)
|
||||
|
@ -3341,6 +3343,8 @@ class BaseCase(unittest.TestCase):
|
|||
devtools = self.devtools
|
||||
if remote_debug is None:
|
||||
remote_debug = self.remote_debug
|
||||
if enable_3d_apis is None:
|
||||
enable_3d_apis = self.enable_3d_apis
|
||||
if swiftshader is None:
|
||||
swiftshader = self.swiftshader
|
||||
if ad_block_on is None:
|
||||
|
@ -3416,6 +3420,7 @@ class BaseCase(unittest.TestCase):
|
|||
guest_mode=guest_mode,
|
||||
devtools=devtools,
|
||||
remote_debug=remote_debug,
|
||||
enable_3d_apis=enable_3d_apis,
|
||||
swiftshader=swiftshader,
|
||||
ad_block_on=ad_block_on,
|
||||
block_images=block_images,
|
||||
|
@ -12777,6 +12782,7 @@ class BaseCase(unittest.TestCase):
|
|||
self.dash_lock = fasteners.InterProcessLock(
|
||||
constants.Dashboard.LOCKFILE
|
||||
)
|
||||
self.enable_3d_apis = sb_config.enable_3d_apis
|
||||
self.swiftshader = sb_config.swiftshader
|
||||
self.user_data_dir = sb_config.user_data_dir
|
||||
self.extension_zip = sb_config.extension_zip
|
||||
|
@ -13057,6 +13063,7 @@ class BaseCase(unittest.TestCase):
|
|||
guest_mode=self.guest_mode,
|
||||
devtools=self.devtools,
|
||||
remote_debug=self.remote_debug,
|
||||
enable_3d_apis=self.enable_3d_apis,
|
||||
swiftshader=self.swiftshader,
|
||||
ad_block_on=self.ad_block_on,
|
||||
block_images=self.block_images,
|
||||
|
|
|
@ -56,6 +56,7 @@ def Driver(
|
|||
guest_mode=None, # Enable Chromium's Guest mode.
|
||||
devtools=None, # Open Chromium's DevTools when the browser opens.
|
||||
remote_debug=None, # Enable Chrome's Debugger on "http://localhost:9222".
|
||||
enable_3d_apis=None, # Enable WebGL and 3D APIs.
|
||||
swiftshader=None, # Use Chrome's "--use-gl=swiftshader" feature.
|
||||
ad_block_on=None, # Block some types of display ads from loading.
|
||||
block_images=None, # Block images from loading during tests.
|
||||
|
@ -299,32 +300,37 @@ def Driver(
|
|||
elif "--pls=none" in sys_argv or '--pls="none"' in sys_argv:
|
||||
page_load_strategy = "none"
|
||||
if block_images is None:
|
||||
if "--block-images" in sys_argv:
|
||||
if "--block-images" in sys_argv or "--block_images" in sys_argv:
|
||||
block_images = True
|
||||
else:
|
||||
block_images = False
|
||||
if do_not_track is None:
|
||||
if "--do-not-track" in sys_argv:
|
||||
if "--do-not-track" in sys_argv or "--do_not_track" in sys_argv:
|
||||
do_not_track = True
|
||||
else:
|
||||
do_not_track = False
|
||||
if external_pdf is None:
|
||||
if "--external-pdf" in sys_argv:
|
||||
if "--external-pdf" in sys_argv or "--external_pdf" in sys_argv:
|
||||
external_pdf = True
|
||||
else:
|
||||
external_pdf = False
|
||||
if remote_debug is None:
|
||||
if "--remote-debug" in sys_argv:
|
||||
if "--remote-debug" in sys_argv or "--remote_debug" in sys_argv:
|
||||
remote_debug = True
|
||||
else:
|
||||
remote_debug = False
|
||||
if enable_3d_apis is None:
|
||||
if "--enable-3d-apis" in sys_argv or "--enable_3d_apis" in sys_argv:
|
||||
enable_3d_apis = True
|
||||
else:
|
||||
enable_3d_apis = False
|
||||
if swiftshader is None:
|
||||
if "--swiftshader" in sys_argv:
|
||||
swiftshader = True
|
||||
else:
|
||||
swiftshader = False
|
||||
if ad_block_on is None:
|
||||
if "--ad-block" in sys_argv:
|
||||
if "--ad-block" in sys_argv or "--ad_block" in sys_argv:
|
||||
ad_block_on = True
|
||||
else:
|
||||
ad_block_on = False
|
||||
|
@ -362,6 +368,7 @@ def Driver(
|
|||
guest_mode=guest_mode,
|
||||
devtools=devtools,
|
||||
remote_debug=remote_debug,
|
||||
enable_3d_apis=enable_3d_apis,
|
||||
swiftshader=swiftshader,
|
||||
ad_block_on=ad_block_on,
|
||||
block_images=block_images,
|
||||
|
|
|
@ -96,6 +96,7 @@ def pytest_addoption(parser):
|
|||
--final-debug (Enter Debug Mode after each test ends. Don't use with CI!)
|
||||
--dashboard (Enable the SeleniumBase Dashboard. Saved at: dashboard.html)
|
||||
--dash-title=STRING (Set the title shown for the generated dashboard.)
|
||||
--enable-3d-apis (Enables WebGL and 3D APIs.)
|
||||
--swiftshader (Use Chrome's "--use-gl=swiftshader" feature.)
|
||||
--incognito (Enable Chrome's Incognito mode.)
|
||||
--guest (Enable Chrome's Guest mode.)
|
||||
|
@ -980,6 +981,14 @@ def pytest_addoption(parser):
|
|||
default=None,
|
||||
help="Set the title shown for the generated dashboard.",
|
||||
)
|
||||
parser.addoption(
|
||||
"--enable_3d_apis",
|
||||
"--enable-3d-apis",
|
||||
action="store_true",
|
||||
dest="enable_3d_apis",
|
||||
default=False,
|
||||
help="""Using this enables WebGL and 3D APIs.""",
|
||||
)
|
||||
parser.addoption(
|
||||
"--swiftshader",
|
||||
action="store_true",
|
||||
|
@ -1393,6 +1402,7 @@ def pytest_configure(config):
|
|||
sb_config.final_debug = config.getoption("final_debug")
|
||||
sb_config.dashboard = config.getoption("dashboard")
|
||||
sb_config.dash_title = config.getoption("dash_title")
|
||||
sb_config.enable_3d_apis = config.getoption("enable_3d_apis")
|
||||
sb_config.swiftshader = config.getoption("swiftshader")
|
||||
sb_config.incognito = config.getoption("incognito")
|
||||
sb_config.guest_mode = config.getoption("guest_mode")
|
||||
|
|
|
@ -50,6 +50,7 @@ def SB(
|
|||
guest_mode=None, # Enable Chromium's Guest mode.
|
||||
devtools=None, # Open Chromium's DevTools when the browser opens.
|
||||
remote_debug=None, # Enable Chrome's Debugger on "http://localhost:9222".
|
||||
enable_3d_apis=None, # Enable WebGL and 3D APIs.
|
||||
swiftshader=None, # Use Chrome's "--use-gl=swiftshader" feature.
|
||||
ad_block_on=None, # Block some types of display ads from loading.
|
||||
block_images=None, # Block images from loading during tests.
|
||||
|
@ -470,32 +471,37 @@ def SB(
|
|||
elif "--demo" in sys_argv:
|
||||
demo_mode = True
|
||||
if block_images is None:
|
||||
if "--block-images" in sys_argv:
|
||||
if "--block-images" in sys_argv or "--block_images" in sys_argv:
|
||||
block_images = True
|
||||
else:
|
||||
block_images = False
|
||||
if do_not_track is None:
|
||||
if "--do-not-track" in sys_argv:
|
||||
if "--do-not-track" in sys_argv or "--do_not_track" in sys_argv:
|
||||
do_not_track = True
|
||||
else:
|
||||
do_not_track = False
|
||||
if external_pdf is None:
|
||||
if "--external-pdf" in sys_argv:
|
||||
if "--external-pdf" in sys_argv or "--external_pdf" in sys_argv:
|
||||
external_pdf = True
|
||||
else:
|
||||
external_pdf = False
|
||||
if remote_debug is None:
|
||||
if "--remote-debug" in sys_argv:
|
||||
if "--remote-debug" in sys_argv or "--remote_debug" in sys_argv:
|
||||
remote_debug = True
|
||||
else:
|
||||
remote_debug = False
|
||||
if enable_3d_apis is None:
|
||||
if "--enable-3d-apis" in sys_argv or "--enable_3d_apis" in sys_argv:
|
||||
enable_3d_apis = True
|
||||
else:
|
||||
enable_3d_apis = False
|
||||
if swiftshader is None:
|
||||
if "--swiftshader" in sys_argv:
|
||||
swiftshader = True
|
||||
else:
|
||||
swiftshader = False
|
||||
if ad_block_on is None:
|
||||
if "--ad-block" in sys_argv:
|
||||
if "--ad-block" in sys_argv or "--ad_block" in sys_argv:
|
||||
ad_block_on = True
|
||||
else:
|
||||
ad_block_on = False
|
||||
|
@ -602,6 +608,7 @@ def SB(
|
|||
sb_config.proxy_string = proxy_string
|
||||
sb_config.proxy_bypass_list = proxy_bypass_list
|
||||
sb_config.proxy_pac_url = proxy_pac_url
|
||||
sb_config.enable_3d_apis = enable_3d_apis
|
||||
sb_config.swiftshader = swiftshader
|
||||
sb_config.ad_block_on = ad_block_on
|
||||
sb_config.highlights = highlights
|
||||
|
@ -694,6 +701,7 @@ def SB(
|
|||
sb.proxy_string = sb_config.proxy_string
|
||||
sb.proxy_bypass_list = sb_config.proxy_bypass_list
|
||||
sb.proxy_pac_url = sb_config.proxy_pac_url
|
||||
sb.enable_3d_apis = sb_config.enable_3d_apis
|
||||
sb.swiftshader = sb_config.swiftshader
|
||||
sb.ad_block_on = sb_config.ad_block_on
|
||||
sb.highlights = sb_config.highlights
|
||||
|
|
|
@ -72,6 +72,7 @@ class SeleniumBrowser(Plugin):
|
|||
--uc-sub | --uc-subprocess (Use undetected-chromedriver as a subprocess.)
|
||||
--remote-debug (Enable Chrome's Remote Debugger on http://localhost:9222)
|
||||
--final-debug (Enter Debug Mode after each test ends. Don't use with CI!)
|
||||
--enable-3d-apis (Enables WebGL and 3D APIs.)
|
||||
--swiftshader (Use Chrome's "--use-gl=swiftshader" feature.)
|
||||
--incognito (Enable Chrome's Incognito mode.)
|
||||
--guest (Enable Chrome's Guest mode.)
|
||||
|
@ -685,6 +686,14 @@ class SeleniumBrowser(Plugin):
|
|||
If using both "--final-debug" and "--pdb" together,
|
||||
then Debug Mode will activate twice on failures.""",
|
||||
)
|
||||
parser.add_option(
|
||||
"--enable_3d_apis",
|
||||
"--enable-3d-apis",
|
||||
action="store_true",
|
||||
dest="enable_3d_apis",
|
||||
default=False,
|
||||
help="""Using this enables WebGL and 3D APIs.""",
|
||||
)
|
||||
parser.add_option(
|
||||
"--swiftshader",
|
||||
action="store_true",
|
||||
|
@ -923,6 +932,7 @@ class SeleniumBrowser(Plugin):
|
|||
test.test.disable_gpu = self.options.disable_gpu
|
||||
test.test.remote_debug = self.options.remote_debug
|
||||
test.test._final_debug = self.options.final_debug
|
||||
test.test.enable_3d_apis = self.options.enable_3d_apis
|
||||
test.test.swiftshader = self.options.swiftshader
|
||||
test.test.incognito = self.options.incognito
|
||||
test.test.guest_mode = self.options.guest_mode
|
||||
|
|
Loading…
Reference in New Issue