Skip to content

Commit 414a9cb

Browse files
authored
Merge pull request #1611 from seleniumbase/optimizations
Optimizations
2 parents 8864da6 + 66324bb commit 414a9cb

File tree

12 files changed

+34
-19
lines changed

12 files changed

+34
-19
lines changed

examples/hack_the_planet.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -92,16 +92,15 @@ def test_all_your_base_are_belong_to_us(self):
9292
self.highlight('form[role="search"]', loops=8)
9393

9494
self.open("https://github.com/features/actions")
95-
self.set_text_content('a[href="/team"]', ayb)
96-
self.set_text_content('a[href="/enterprise"]', abtu)
95+
self.set_text_content('a[href="/pricing"]', aybabtu)
9796
self.set_text_content("h1 span:nth-child(1)", ayb)
9897
self.set_text_content("h1 span:nth-of-type(2)", "ARE")
9998
self.set_text_content("h1 span:nth-of-type(3)", "BELONG")
10099
self.set_text_content("h1 span:nth-of-type(4)", "TO")
101100
self.set_text_content("h1 span:nth-of-type(5)", "US")
102101
self.type('input[name="q"]', aybabtu.lower())
103102
self.click("h1", scroll=False)
104-
self.highlight("nav", loops=5, scroll=False)
103+
self.highlight('a[href="/pricing"]', loops=5, scroll=False)
105104
self.highlight('input[name="q"]', loops=5, scroll=False)
106105
self.highlight("h1", loops=8, scroll=False)
107106

examples/migration/protractor/input_test.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,5 @@ class AngularMaterialInputTests(BaseCase):
55
def test_invalid_input(self):
66
# Test that there's an error for an invalid input
77
self.open("https://material.angular.io/components/input/examples")
8-
self.assert_element(".mat-button-wrapper > .mat-icon")
98
self.type("#mat-input-1", "invalid")
109
self.assert_element("mat-error")

examples/migration/protractor/mat_paginator_test.py

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,21 @@
55
class AngularMaterialPaginatorTests(BaseCase):
66
def test_pagination(self):
77
self.open("https://material.angular.io/components/paginator/examples")
8-
self.assert_element(".mat-button-wrapper > .mat-icon")
8+
# Set pagination to 5 items per page
9+
self.click("mat-select > div")
10+
self.click("#mat-option-0")
911
# Verify navigation to the next page
1012
self.click('button[aria-label="Next page"]')
11-
self.assert_exact_text("Page 2 of 10", ".mat-paginator-range-label")
13+
self.assert_exact_text(
14+
"Page 2 of 10", ".mat-mdc-paginator-range-label"
15+
)
1216
# Verify navigation to the previous page
1317
self.click('button[aria-label="Previous page"]')
14-
self.assert_exact_text("Page 1 of 10", ".mat-paginator-range-label")
15-
# Verify changed list length to 5 items per page
18+
self.assert_exact_text(
19+
"Page 1 of 10", ".mat-mdc-paginator-range-label"
20+
)
21+
# Set pagination to 10 items per page
1622
self.click("mat-select > div")
17-
self.click("mat-option > .mat-option-text")
18-
self.assert_exact_text("Page 1 of 20", ".mat-paginator-range-label")
23+
self.click("#mat-option-1")
24+
# Verify page with correct number of pages
25+
self.assert_exact_text("Page 1 of 5", ".mat-mdc-paginator-range-label")

examples/setup.cfg

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33
exclude=recordings,temp
44
ignore=W503
55

6+
[ipdb]
7+
context=5
8+
69
[nosetests]
710
# nocapture=1 (Display print statements from output)
811
# (Undo this by using: "--nologcapture")

requirements.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ filelock>=3.4.1;python_version>="3.6" and python_version<"3.7"
2323
filelock>=3.8.0;python_version>="3.7"
2424
platformdirs>=2.0.2;python_version<"3.6"
2525
platformdirs>=2.4.0;python_version>="3.6" and python_version<"3.7"
26-
platformdirs>=2.5.3;python_version>="3.7"
26+
platformdirs>=2.5.4;python_version>="3.7"
2727
pyparsing>=2.4.7;python_version<"3.6"
2828
pyparsing>=3.0.7;python_version>="3.6" and python_version<"3.7"
2929
pyparsing>=3.0.9;python_version>="3.7"
@@ -113,7 +113,7 @@ matplotlib-inline==0.1.6;python_version>="3.7"
113113
colorama==0.4.6;python_version<"3.6"
114114
colorama==0.4.5;python_version>="3.6" and python_version<"3.7"
115115
colorama==0.4.6;python_version>="3.7"
116-
exceptiongroup==1.0.1;python_version>="3.7"
116+
exceptiongroup==1.0.4;python_version>="3.7"
117117
importlib-metadata==2.1.3;python_version<"3.6"
118118
importlib-metadata==4.2.0;python_version>="3.6" and python_version<"3.8"
119119
pycparser==2.21

seleniumbase/__version__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
# seleniumbase package
2-
__version__ = "4.8.3"
2+
__version__ = "4.8.4"

seleniumbase/console_scripts/sb_mkdir.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,9 @@ def main():
165165
data.append("[flake8]")
166166
data.append("exclude=recordings,temp")
167167
data.append("")
168+
data.append("[ipdb]")
169+
data.append("context=5")
170+
data.append("")
168171
data.append("[nosetests]")
169172
data.append("nocapture=1")
170173
data.append("logging-level=INFO")

seleniumbase/extensions/recorder.zip

-9 Bytes
Binary file not shown.

seleniumbase/js_code/recorder_js.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,8 @@
4040
!el.getAttribute(attr).includes('\n'))
4141
{
4242
the_attr = el.getAttribute(attr);
43-
if (the_attr.includes('"'))
44-
the_attr = the_attr.replace('"', '\\"');
45-
if (the_attr.includes("'"))
46-
the_attr = the_attr.replace("'", "\\'");
43+
the_attr = the_attr.replaceAll('"', '\\"');
44+
the_attr = the_attr.replaceAll("'", "\\'");
4745
selector += '[' + attr + '="' + the_attr + '"]';
4846
path.unshift(selector);
4947
break;
@@ -163,6 +161,7 @@
163161
non_id_attributes.push('for');
164162
non_id_attributes.push('placeholder');
165163
non_id_attributes.push('value');
164+
non_id_attributes.push('ng-click');
166165
non_id_attributes.push('ng-if');
167166
non_id_attributes.push('src');
168167
selector_by_attr = [];

seleniumbase/undetected/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,8 @@ def __init__(
225225
"--password-store=basic",
226226
]
227227
)
228+
options.add_argument("--disable-renderer-backgrounding")
229+
options.add_argument("--disable-backgrounding-occluded-windows")
228230
if headless or options.headless:
229231
options.headless = True
230232
options.add_argument("--no-sandbox")

0 commit comments

Comments
 (0)