Skip to content

Commit 57171f2

Browse files
authored
Merge pull request #1385 from seleniumbase/refactoring-3d-apis-and-dependencies
Refactoring, optimizations, dependencies, and docs
2 parents b397777 + 0ea7d2d commit 57171f2

File tree

16 files changed

+125
-154
lines changed

16 files changed

+125
-154
lines changed

.github/workflows/python-package.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,9 +86,12 @@ jobs:
8686
- name: Run pytest examples/test_inspect_html.py --browser=chrome --headless
8787
run: |
8888
pytest examples/test_inspect_html.py --browser=chrome --headless -v -s --junit-xml=junit/test-results.xml
89-
- name: Run pytest examples/my_first_test.py --browser=firefox --headless
89+
- name: Run pytest examples/test_mfa_login.py --browser=firefox --headless
9090
run: |
91-
pytest examples/my_first_test.py --browser=firefox --headless -v -s --junit-xml=junit/test-results.xml
91+
pytest examples/test_mfa_login.py --browser=firefox --headless -v -s --junit-xml=junit/test-results.xml
92+
- name: Run pytest examples/test_mfa_login.py --browser=firefox --xvfb
93+
run: |
94+
pytest examples/test_mfa_login.py --browser=firefox --xvfb -v -s --junit-xml=junit/test-results.xml
9295
- name: Run behave examples/behave_bdd/features/calculator.feature -D rs -D crumbs -D xvfb
9396
run: |
9497
behave examples/behave_bdd/features/calculator.feature -D rs -D crumbs -D xvfb -T -k

examples/translations/japanese_test_1.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,16 @@ class 私のテストクラス(セレニウムテストケース):
66
def test_例1(self):
77
self.を開く("https://ja.wikipedia.org/wiki/")
88
self.テキストを確認する("ウィキペディア")
9-
self.要素を確認する('[title="メインページに移動する"]')
10-
self.入力("#searchInput", "アニメ")
11-
self.クリックして("#searchButton")
9+
self.要素を確認する('[title*="メインページに移動する"]')
10+
self.JS入力('input[name="search"]', "アニメ")
11+
self.クリックして("#searchform button")
1212
self.テキストを確認する("アニメ", "#firstHeading")
13-
self.入力("#searchInput", "寿司")
14-
self.クリックして("#searchButton")
13+
self.JS入力('input[name="search"]', "寿司")
14+
self.クリックして("#searchform button")
1515
self.テキストを確認する("寿司", "#firstHeading")
1616
self.要素を確認する('img[alt="握り寿司"]')
1717
self.入力("#searchInput", "レゴランド・ジャパン")
18-
self.クリックして("#searchButton")
18+
self.クリックして("div.suggestions span.highlight")
1919
self.要素を確認する('img[alt*="LEGOLAND JAPAN"]')
2020
self.リンクテキストを確認する("名古屋城")
2121
self.リンクテキストをクリックします("テーマパーク")

help_docs/syntax_formats.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -372,16 +372,16 @@ class 私のテストクラス(セレニウムテストケース):
372372
def test_例1(self):
373373
self.を開く("https://ja.wikipedia.org/wiki/")
374374
self.テキストを確認する("ウィキペディア")
375-
self.要素を確認する('[title="メインページに移動する"]')
376-
self.入力("#searchInput", "アニメ")
377-
self.クリックして("#searchButton")
375+
self.要素を確認する('[title*="メインページに移動する"]')
376+
self.JS入力('input[name="search"]', "アニメ")
377+
self.クリックして("#searchform button")
378378
self.テキストを確認する("アニメ", "#firstHeading")
379-
self.入力("#searchInput", "寿司")
380-
self.クリックして("#searchButton")
379+
self.JS入力('input[name="search"]', "寿司")
380+
self.クリックして("#searchform button")
381381
self.テキストを確認する("寿司", "#firstHeading")
382382
self.要素を確認する('img[alt="握り寿司"]')
383383
self.入力("#searchInput", "レゴランド・ジャパン")
384-
self.クリックして("#searchButton")
384+
self.クリックして("div.suggestions span.highlight")
385385
self.要素を確認する('img[alt*="LEGOLAND JAPAN"]')
386386
self.リンクテキストを確認する("名古屋城")
387387
self.リンクテキストをクリックします("テーマパーク")

requirements.txt

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,15 @@ jedi==0.18.1;python_version>="3.6"
3232
idna==2.10;python_version<"3.6"
3333
idna==3.3;python_version>="3.6"
3434
chardet==3.0.4;python_version<"3.5"
35-
chardet==4.0.0;python_version>="3.5"
36-
charset-normalizer==2.0.12;python_version>="3.5"
35+
chardet==4.0.0;python_version>="3.5" and python_version<"3.7"
36+
chardet==5.0.0;python_version>="3.7"
37+
charset-normalizer==2.0.12;python_version>="3.5" and python_version<"3.7"
38+
charset-normalizer==2.1.0;python_version>="3.7"
3739
urllib3==1.26.9
3840
requests==2.27.1;python_version<"3.5"
3941
requests==2.25.1;python_version>="3.5" and python_version<"3.6"
4042
requests==2.27.1;python_version>="3.6" and python_version<"3.7"
41-
requests==2.28.0;python_version>="3.7"
43+
requests==2.28.1;python_version>="3.7"
4244
nose==1.3.7
4345
sniffio==1.2.0;python_version>="3.7"
4446
h11==0.13.0;python_version>="3.7"
@@ -117,7 +119,7 @@ pymysql==1.0.2;python_version>="3.6"
117119
pyotp==2.3.0;python_version<"3.5"
118120
pyotp==2.6.0;python_version>="3.5"
119121
boto==2.49.0
120-
cffi==1.15.0
122+
cffi==1.15.1
121123
toml==0.10.2
122124
Pillow==6.2.2;python_version<"3.5"
123125
Pillow==7.2.0;python_version>="3.5" and python_version<"3.6"

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__ = "3.3.3"
2+
__version__ = "3.3.4"

seleniumbase/behave/behave_helper.py

Lines changed: 10 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,7 @@ def generate_gherkin(srt_actions):
2222
elif "'" not in action[2]:
2323
sb_actions.append("Open '%s'" % action[2])
2424
else:
25-
sb_actions.append(
26-
'Open "%s"' % action[2].replace('"', '\\"')
27-
)
25+
sb_actions.append('Open "%s"' % action[2].replace('"', '\\"'))
2826
elif action[0] == "f_url":
2927
if "%" in action[2] and python3:
3028
try:
@@ -73,27 +71,17 @@ def generate_gherkin(srt_actions):
7371
method = "js_type"
7472
text = action[2].replace("\n", "\\n")
7573
if '"' not in action[1] and '"' not in text:
76-
sb_actions.append(
77-
'Into "%s" type "%s"' % (action[1], text)
78-
)
74+
sb_actions.append('Into "%s" type "%s"' % (action[1], text))
7975
elif '"' not in action[1] and '"' in text:
80-
sb_actions.append(
81-
'Into "%s" type \'%s\'' % (action[1], text)
82-
)
76+
sb_actions.append('Into "%s" type \'%s\'' % (action[1], text))
8377
elif '"' in action[1] and '"' not in text:
84-
sb_actions.append(
85-
'Into \'%s\' type "%s"' % (action[1], text)
86-
)
78+
sb_actions.append('Into \'%s\' type "%s"' % (action[1], text))
8779
elif '"' in action[1] and '"' in text:
88-
sb_actions.append(
89-
"Into '%s' type '%s'" % (action[1], text)
90-
)
80+
sb_actions.append("Into '%s' type '%s'" % (action[1], text))
9181
elif action[0] == "e_mfa":
9282
text = action[2].replace("\n", "\\n")
9383
if '"' not in action[1] and '"' not in text:
94-
sb_actions.append(
95-
'Into "%s" do MFA "%s"' % (action[1], text)
96-
)
84+
sb_actions.append('Into "%s" do MFA "%s"' % (action[1], text))
9785
elif '"' not in action[1] and '"' in text:
9886
sb_actions.append(
9987
'Into "%s" do MFA \'%s\'' % (action[1], text)
@@ -103,9 +91,7 @@ def generate_gherkin(srt_actions):
10391
'Into \'%s\' do MFA "%s"' % (action[1], text)
10492
)
10593
elif '"' in action[1] and '"' in text:
106-
sb_actions.append(
107-
"Into '%s' do MFA '%s'" % (action[1], text)
108-
)
94+
sb_actions.append("Into '%s' do MFA '%s'" % (action[1], text))
10995
elif action[0] == "h_clk":
11096
if '"' not in action[1] and '"' not in action[2]:
11197
sb_actions.append(
@@ -271,9 +257,7 @@ def generate_gherkin(srt_actions):
271257
if not dest:
272258
sb_actions.append('%s "%s" to downloads' % (method, file_url))
273259
else:
274-
sb_actions.append(
275-
'%s "%s" to "%s"' % (method, file_url, dest)
276-
)
260+
sb_actions.append('%s "%s" to "%s"' % (method, file_url, dest))
277261
elif action[0] == "as_at":
278262
if ('"' not in action[1][0]) and action[1][2]:
279263
sb_actions.append(
@@ -337,13 +321,9 @@ def generate_gherkin(srt_actions):
337321
)
338322
else:
339323
if '"' not in action[1][0]:
340-
sb_actions.append(
341-
'%s "%s"' % (method, action[1][0])
342-
)
324+
sb_actions.append('%s "%s"' % (method, action[1][0]))
343325
else:
344-
sb_actions.append(
345-
"%s '%s'" % (method, action[1][0])
346-
)
326+
sb_actions.append("%s '%s'" % (method, action[1][0]))
347327
elif action[0] == "da_el":
348328
method = "Deferred assert element"
349329
if '"' not in action[1]:

seleniumbase/behave/behave_sb.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -636,7 +636,7 @@ def get_configured_sb(context):
636636
sb.proxy_bypass_list = proxy_bypass_list
637637
continue
638638
# Handle: -D proxy-pac-url=URL / proxy-pac-url=USERNAME:PASSWORD@URL
639-
if low_key in ["proxy-pac-url", "proxy_pac_url", "pac-url", "pac_url"]:
639+
if low_key in ["proxy-pac-url", "pac-url"]:
640640
proxy_pac_url = userdata[key]
641641
if proxy_pac_url == "true":
642642
proxy_pac_url = sb.proxy_pac_url # revert to default

seleniumbase/console_scripts/sb_behave_gui.py

Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -84,10 +84,7 @@ def do_behave_run(
8484
total_selected_tests += 1
8585

8686
full_run_command = "behave"
87-
if (
88-
total_selected_tests == 0
89-
or total_tests == total_selected_tests
90-
):
87+
if total_selected_tests == 0 or total_tests == total_selected_tests:
9188
if command_string:
9289
full_run_command += " "
9390
full_run_command += command_string
@@ -192,27 +189,19 @@ def create_tkinter_gui(tests, command_string):
192189
question_menu.pack()
193190

194191
qmx = tk.IntVar()
195-
chk = tk.Checkbutton(
196-
root, text="Quiet Mode (--quiet)", variable=qmx
197-
)
192+
chk = tk.Checkbutton(root, text="Quiet Mode (--quiet)", variable=qmx)
198193
chk.pack()
199194

200195
dmx = tk.IntVar()
201-
chk = tk.Checkbutton(
202-
root, text="Demo Mode (-D demo)", variable=dmx
203-
)
196+
chk = tk.Checkbutton(root, text="Demo Mode (-D demo)", variable=dmx)
204197
chk.pack()
205198

206199
mmx = tk.IntVar()
207-
chk = tk.Checkbutton(
208-
root, text="Mobile Mode (-D mobile)", variable=mmx
209-
)
200+
chk = tk.Checkbutton(root, text="Mobile Mode (-D mobile)", variable=mmx)
210201
chk.pack()
211202

212203
dbx = tk.IntVar()
213-
chk = tk.Checkbutton(
214-
root, text="Dashboard (-D dashboard)", variable=dbx
215-
)
204+
chk = tk.Checkbutton(root, text="Dashboard (-D dashboard)", variable=dbx)
216205
chk.pack()
217206
chk.select()
218207

seleniumbase/console_scripts/sb_commander.py

Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -83,10 +83,7 @@ def do_pytest_run(
8383
total_selected_tests += 1
8484

8585
full_run_command = "pytest"
86-
if (
87-
total_selected_tests == 0
88-
or total_tests == total_selected_tests
89-
):
86+
if total_selected_tests == 0 or total_tests == total_selected_tests:
9087
if command_string:
9188
full_run_command += " "
9289
full_run_command += command_string
@@ -195,28 +192,20 @@ def create_tkinter_gui(tests, command_string):
195192
question_menu.pack()
196193

197194
vox = tk.IntVar()
198-
chk = tk.Checkbutton(
199-
root, text="Verbose Output (-v)", variable=vox
200-
)
195+
chk = tk.Checkbutton(root, text="Verbose Output (-v)", variable=vox)
201196
chk.pack()
202197
chk.select()
203198

204199
dmx = tk.IntVar()
205-
chk = tk.Checkbutton(
206-
root, text="Demo Mode (--demo)", variable=dmx
207-
)
200+
chk = tk.Checkbutton(root, text="Demo Mode (--demo)", variable=dmx)
208201
chk.pack()
209202

210203
mmx = tk.IntVar()
211-
chk = tk.Checkbutton(
212-
root, text="Mobile Mode (--mobile)", variable=mmx
213-
)
204+
chk = tk.Checkbutton(root, text="Mobile Mode (--mobile)", variable=mmx)
214205
chk.pack()
215206

216207
dbx = tk.IntVar()
217-
chk = tk.Checkbutton(
218-
root, text="Dashboard (--dashboard)", variable=dbx
219-
)
208+
chk = tk.Checkbutton(root, text="Dashboard (--dashboard)", variable=dbx)
220209
chk.pack()
221210
chk.select()
222211

seleniumbase/console_scripts/sb_recorder.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ def show_already_recording_warning():
6060
messagebox.showwarning(
6161
"SeleniumBase Recorder: Already Running!",
6262
"Please finalize the active recording from the terminal\n"
63-
'where you opened the Recorder: Type "c" and hit Enter.'
63+
'where you opened the Recorder: Type "c" and hit Enter.',
6464
)
6565

6666

@@ -175,7 +175,7 @@ def do_playback(file_name, use_chrome, window, demo_mode=False):
175175
messagebox.showwarning(
176176
"SeleniumBase Recorder: Already Running!",
177177
"Please finalize the active recording from the terminal\n"
178-
'where you opened the Recorder: Type "c" and hit Enter.'
178+
'where you opened the Recorder: Type "c" and hit Enter.',
179179
)
180180
send_window_to_front(window)
181181

@@ -278,7 +278,7 @@ def show_still_running_warning():
278278
"SeleniumBase Recorder: Still Running!",
279279
"Please finalize the active recording from the terminal\n"
280280
'where you opened the Recorder: Type "c" and hit Enter.\n'
281-
"(Then you can safely close this alert.)"
281+
"(Then you can safely close this alert.)",
282282
)
283283

284284

0 commit comments

Comments
 (0)