[py] Handle first/always match better when it hits lists/dicts. Fixes
@@ -45,10 +45,10 @@ from selenium.common.exceptions import (InvalidArgumentException,
NoSuchCookieException)
from selenium.webdriver.common.by import By
from selenium.webdriver.common.options import BaseOptions
+from selenium.webdriver.common.print_page_options import PrintOptions
from selenium.webdriver.common.timeouts import Timeouts
from selenium.webdriver.common.html5.application_cache import ApplicationCache
from selenium.webdriver.support.relative_locator import RelativeBy
-from selenium.webdriver.common.print_page_options import PrintOptions
_W3C_CAPABILITY_NAMES = frozenset([
@@ -70,6 +70,7 @@ _OSS_W3C_CONVERSION = {
'platform': 'platformName'
}
+
devtools = None
@@ -126,15 +127,23 @@ def create_matches(options: List[BaseOptions]) -> Dict:
for opt in options:
opts.append(opt.to_capabilities())
opts_size = len(opts)
- samesies = set()
+ samesies = {}
+
+ # Can not use bitwise operations on the dicts or lists due to
+ # https://bugs.python.org/issue38210
for i in range(opts_size):
min_index = i
if i + 1 < opts_size:
- samesies.update(opts[min_index].items() & opts[i + 1].items())
+ first_keys = opts[min_index].keys()
+
+ for kys in first_keys:
+ if kys in opts[i + 1].keys():
+ if opts[min_index][kys] == opts[i + 1][kys]:
+ samesies.update({kys: opts[min_index][kys]})
always = {}
- for i in samesies:
- always[i[0]] = i[1]
+ for k, v in samesies.items():
+ always[k] = v
for i in opts:
for k in always.keys():
