Skip to content

Commit be53047

Browse files
committed
fix: merge conflicts, flake8 issues
1 parent a0edf19 commit be53047

File tree

3 files changed

+20
-9
lines changed

3 files changed

+20
-9
lines changed

autowebcompat/utils.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,14 @@
66
import subprocess
77
import sys
88
import threading
9-
import sys
109

11-
import numpy as np
12-
from PIL import Image
1310
import keras
1411
from keras.preprocessing.image import ImageDataGenerator
1512
from keras.preprocessing.image import img_to_array
1613
from keras.preprocessing.image import load_img
17-
import numpy as np
1814
from tensorflow.python.client import device_lib
15+
from PIL import Image
16+
import numpy as np
1917

2018

2119
def get_bugs():
@@ -253,6 +251,7 @@ def get_browser_bin():
253251
chrome_bin = nightly_bin = None
254252
return chrome_bin, nightly_bin
255253

254+
256255
def get_all_model_summary(model, model_summary):
257256
line = []
258257
model.summary(print_fn=lambda x: line.append(x + '\n'))

collect.py

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,7 @@
88

99
from PIL import Image
1010
from lxml import etree
11-
from selenium import webdriver
12-
from selenium.common.exceptions import NoAlertPresentException
1311
from selenium.common.exceptions import NoSuchElementException
14-
from selenium.common.exceptions import NoSuchWindowException
1512
from selenium.common.exceptions import TimeoutException
1613

1714
from autowebcompat import utils
@@ -98,6 +95,22 @@ def get_elements_with_properties(driver, elem_properties, children):
9895
return elems_with_same_properties
9996

10097

98+
def get_element_properties(driver, child):
99+
child_properties = driver.execute_script("""
100+
let elem_properties = {
101+
tag: '',
102+
attributes: {},
103+
};
104+
for (let i = 0; i < arguments[0].attributes.length; i++) {
105+
elem_properties.attributes[arguments[0].attributes[i].name] = arguments[0].attributes[i].value;
106+
}
107+
elem_properties.tag = arguments[0].tagName;
108+
return elem_properties;
109+
""", child)
110+
111+
return child_properties
112+
113+
101114
def was_visited(current_path, visited_paths, elem_properties):
102115
current_path_elements = [element for element, _, _ in current_path]
103116
current_path_elements.append(elem_properties)
@@ -378,7 +391,6 @@ def run_tests(firefox_driver, chrome_driver, bugs):
378391
firefox_driver.quit()
379392
chrome_driver.quit()
380393

381-
dd_argument('--user-agent=Mozilla/5.0 (Linux; Android 6.0.1; Nexus 5 Build/M4B30Z) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.83 Mobile Safari/537.36')
382394

383395
def main(bugs):
384396
driver = Driver()

tests/test_utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ def test_get_browser_bin():
143143
assert isinstance(nightly_bin, str)
144144
assert os.path.exists(os.path.abspath('./') + '/' + chrome_bin)
145145
assert os.path.exists(os.path.abspath('./') + '/' + nightly_bin)
146-
146+
147147

148148
def test_create_file_name():
149149
assert(utils.create_file_name(bug_id='1661', browser='chrome', seq_no=None) == '1661_chrome')

0 commit comments

Comments
 (0)