Skip to content

Commit 8e60171

Browse files
authored
Merge pull request #519 from seleniumbase/seleniumbase-in-japanese
Add the Japanese translation of SeleniumBase
2 parents c36c8ff + 3b38937 commit 8e60171

File tree

4 files changed

+264
-10
lines changed

4 files changed

+264
-10
lines changed
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Japanese Language Test - Python 3 Only!
2+
from seleniumbase.translate.japanese import セレンテストケース # noqa
3+
4+
5+
class テストクラス(セレンテストケース): # noqa
6+
7+
def test_例1(self):
8+
self.URLを開く("https://ja.wikipedia.org/wiki/")
9+
self.テキストを確認する("ウィキペディア")
10+
self.要素を確認する('[title="メインページに移動する"]')
11+
self.テキストを更新("#searchInput", "アニメ")
12+
self.クリックして("#searchButton")
13+
self.テキストを確認する("アニメ", "#firstHeading")
14+
self.テキストを更新("#searchInput", "寿司")
15+
self.クリックして("#searchButton")
16+
self.テキストを確認する("寿司", "#firstHeading")
17+
self.要素を確認する('img[alt="握り寿司"]')

seleniumbase/translate/chinese.py

Lines changed: 53 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@ def 双击(self, *args, **kwargs):
1616
# double_click(selector)
1717
self.double_click(*args, **kwargs)
1818

19+
def 慢单击(self, *args, **kwargs):
20+
# slow_click(selector)
21+
self.slow_click(*args, **kwargs)
22+
1923
def 单击链接文本(self, *args, **kwargs):
2024
# click_link_text(link_text)
2125
self.click_link_text(*args, **kwargs)
@@ -48,6 +52,22 @@ def 断言标题(self, *args, **kwargs):
4852
# assert_title(title)
4953
self.assert_title(*args, **kwargs)
5054

55+
def 断言为真(self, *args, **kwargs):
56+
# assert_true(expr)
57+
self.assert_true(*args, **kwargs)
58+
59+
def 断言为假(self, *args, **kwargs):
60+
# assert_false(expr)
61+
self.assert_false(*args, **kwargs)
62+
63+
def 断言等于(self, *args, **kwargs):
64+
# assert_equal(first, second)
65+
self.assert_equal(*args, **kwargs)
66+
67+
def 断言不等于(self, *args, **kwargs):
68+
# assert_not_equal(first, second)
69+
self.assert_not_equal(*args, **kwargs)
70+
5171
def 刷新页面(self, *args, **kwargs):
5272
# refresh_page()
5373
self.refresh_page(*args, **kwargs)
@@ -68,9 +88,9 @@ def 向前(self, *args, **kwargs):
6888
# go_forward()
6989
self.go_forward(*args, **kwargs)
7090

71-
def 文本是否存在(self, *args, **kwargs):
72-
# is_text_visible(selector)
73-
self.is_element_visible(*args, **kwargs)
91+
def 文本是否显示(self, *args, **kwargs):
92+
# is_text_visible(text, selector="html")
93+
self.is_text_visible(*args, **kwargs)
7494

7595
def 元素是否可见(self, *args, **kwargs):
7696
# is_element_visible(selector)
@@ -81,25 +101,37 @@ def 元素是否存在(self, *args, **kwargs):
81101
self.is_element_present(*args, **kwargs)
82102

83103
def 等待文本(self, *args, **kwargs):
84-
# wait_for_text(text, selector)
104+
# wait_for_text(text, selector="html")
85105
self.wait_for_text(*args, **kwargs)
86106

87107
def 等待元素(self, *args, **kwargs):
88108
# wait_for_element(selector)
89109
self.wait_for_element(*args, **kwargs)
90110

111+
def (self, *args, **kwargs):
112+
# sleep(seconds)
113+
self.sleep(*args, **kwargs)
114+
115+
def 提交(self, *args, **kwargs):
116+
# submit(selector)
117+
self.submit(*args, **kwargs)
118+
91119
def JS单击(self, *args, **kwargs):
92120
# js_click(selector)
93121
self.js_click(*args, **kwargs)
94122

95-
def 检查JS错误(self, *args, **kwargs):
96-
# assert_no_js_errors()
97-
self.assert_no_js_errors(*args, **kwargs)
98-
99123
def 检查HTML(self, *args, **kwargs):
100124
# inspect_html()
101125
self.inspect_html(*args, **kwargs)
102126

127+
def 保存截图(self, *args, **kwargs):
128+
# save_screenshot(name)
129+
self.save_screenshot(*args, **kwargs)
130+
131+
def 选择文件(self, *args, **kwargs):
132+
# choose_file(selector, file_path)
133+
self.choose_file(*args, **kwargs)
134+
103135
def 执行脚本(self, *args, **kwargs):
104136
# execute_script(script)
105137
self.execute_script(*args, **kwargs)
@@ -108,11 +140,19 @@ def 广告区块(self, *args, **kwargs):
108140
# ad_block()
109141
self.ad_block(*args, **kwargs)
110142

143+
def 跳过(self, *args, **kwargs):
144+
# skip(reason="")
145+
self.skip(*args, **kwargs)
146+
111147
def 检查断开的链接(self, *args, **kwargs):
112148
# assert_no_404_errors()
113149
self.assert_no_404_errors(*args, **kwargs)
114150

115-
def 切换到相框(self, *args, **kwargs):
151+
def 检查JS错误(self, *args, **kwargs):
152+
# assert_no_js_errors()
153+
self.assert_no_js_errors(*args, **kwargs)
154+
155+
def 切换到帧(self, *args, **kwargs):
116156
# switch_to_frame(frame)
117157
self.switch_to_frame(*args, **kwargs)
118158

@@ -140,6 +180,10 @@ def 亮点单击(self, *args, **kwargs):
140180
# highlight_click(selector)
141181
self.highlight_click(*args, **kwargs)
142182

183+
def 滚动到(self, *args, **kwargs):
184+
# scroll_to(selector)
185+
self.scroll_to(*args, **kwargs)
186+
143187
def 滚动到顶部(self, *args, **kwargs):
144188
# scroll_to_top()
145189
self.scroll_to_top(*args, **kwargs)

seleniumbase/translate/japanese.py

Lines changed: 193 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,193 @@
1+
# Japanese Language Translations - Python 3 Only!
2+
from seleniumbase import BaseCase
3+
4+
5+
class セレンテストケース(BaseCase): # noqa
6+
7+
def URLを開く(self, *args, **kwargs):
8+
# open(url)
9+
self.open(*args, **kwargs)
10+
11+
def クリックして(self, *args, **kwargs):
12+
# click(selector)
13+
self.click(*args, **kwargs)
14+
15+
def ダブルクリックして(self, *args, **kwargs):
16+
# double_click(selector)
17+
self.double_click(*args, **kwargs)
18+
19+
def ゆっくりクリックして(self, *args, **kwargs):
20+
# slow_click(selector)
21+
self.slow_click(*args, **kwargs)
22+
23+
def リンクテキストをクリックします(self, *args, **kwargs):
24+
# click_link_text(link_text)
25+
self.click_link_text(*args, **kwargs)
26+
27+
def テキストを更新(self, *args, **kwargs):
28+
# update_text(selector, new_value)
29+
self.update_text(*args, **kwargs)
30+
31+
def テキストを追加(self, *args, **kwargs):
32+
# add_text(selector, new_value)
33+
self.add_text(*args, **kwargs)
34+
35+
def テキストを取得(self, *args, **kwargs):
36+
# get_text(selector, new_value)
37+
self.get_text(*args, **kwargs)
38+
39+
def テキストを確認する(self, *args, **kwargs):
40+
# assert_text(text, selector)
41+
self.assert_text(*args, **kwargs)
42+
43+
def 正確なテキストを確認する(self, *args, **kwargs):
44+
# assert_exact_text(text, selector)
45+
self.assert_exact_text(*args, **kwargs)
46+
47+
def 要素を確認する(self, *args, **kwargs):
48+
# assert_element(selector)
49+
self.assert_element(*args, **kwargs)
50+
51+
def タイトルを確認(self, *args, **kwargs):
52+
# assert_title(title)
53+
self.assert_title(*args, **kwargs)
54+
55+
def 検証が正しい(self, *args, **kwargs):
56+
# assert_true(expr)
57+
self.assert_true(*args, **kwargs)
58+
59+
def 検証は偽です(self, *args, **kwargs):
60+
# assert_false(expr)
61+
self.assert_false(*args, **kwargs)
62+
63+
def 検証が等しい(self, *args, **kwargs):
64+
# assert_equal(first, second)
65+
self.assert_equal(*args, **kwargs)
66+
67+
def 検証が等しくない(self, *args, **kwargs):
68+
# assert_not_equal(first, second)
69+
self.assert_not_equal(*args, **kwargs)
70+
71+
def ページを更新する(self, *args, **kwargs):
72+
# refresh_page()
73+
self.refresh_page(*args, **kwargs)
74+
75+
def 現在のURLを取得(self, *args, **kwargs):
76+
# get_current_url()
77+
self.get_current_url(*args, **kwargs)
78+
79+
def ページのソースコードを取得する(self, *args, **kwargs):
80+
# get_page_source()
81+
self.get_page_source(*args, **kwargs)
82+
83+
def 戻る(self, *args, **kwargs):
84+
# go_back()
85+
self.go_back(*args, **kwargs)
86+
87+
def 進む(self, *args, **kwargs):
88+
# go_forward()
89+
self.go_forward(*args, **kwargs)
90+
91+
def テキストが表示されています(self, *args, **kwargs):
92+
# is_text_visible(text, selector="html")
93+
self.is_text_visible(*args, **kwargs)
94+
95+
def 要素は表示されますか(self, *args, **kwargs):
96+
# is_element_visible(selector)
97+
self.is_element_visible(*args, **kwargs)
98+
99+
def 要素が存在するかどうか(self, *args, **kwargs):
100+
# is_element_present(selector)
101+
self.is_element_present(*args, **kwargs)
102+
103+
def テキストを待つ(self, *args, **kwargs):
104+
# wait_for_text(text, selector)
105+
self.wait_for_text(*args, **kwargs)
106+
107+
def 要素を待つ(self, *args, **kwargs):
108+
# wait_for_element(selector)
109+
self.wait_for_element(*args, **kwargs)
110+
111+
def 眠る(self, *args, **kwargs):
112+
# sleep(seconds)
113+
self.sleep(*args, **kwargs)
114+
115+
def を提出す(self, *args, **kwargs):
116+
# submit(selector)
117+
self.submit(*args, **kwargs)
118+
119+
def JSクリックして(self, *args, **kwargs):
120+
# js_click(selector)
121+
self.js_click(*args, **kwargs)
122+
123+
def htmlをチェック(self, *args, **kwargs):
124+
# inspect_html()
125+
self.inspect_html(*args, **kwargs)
126+
127+
def スクリーンショットを保存(self, *args, **kwargs):
128+
# save_screenshot(name)
129+
self.save_screenshot(*args, **kwargs)
130+
131+
def ファイルを選択(self, *args, **kwargs):
132+
# choose_file(selector, file_path)
133+
self.choose_file(*args, **kwargs)
134+
135+
def スクリプトを実行する(self, *args, **kwargs):
136+
# execute_script(script)
137+
self.execute_script(*args, **kwargs)
138+
139+
def 広告ブロック(self, *args, **kwargs):
140+
# ad_block()
141+
self.ad_block(*args, **kwargs)
142+
143+
def スキップする(self, *args, **kwargs):
144+
# skip(reason="")
145+
self.skip(*args, **kwargs)
146+
147+
def リンク切れを確認する(self, *args, **kwargs):
148+
# assert_no_404_errors()
149+
self.assert_no_404_errors(*args, **kwargs)
150+
151+
def JSエラーを確認する(self, *args, **kwargs):
152+
# assert_no_js_errors()
153+
self.assert_no_js_errors(*args, **kwargs)
154+
155+
def フレームに切り替え(self, *args, **kwargs):
156+
# switch_to_frame(frame)
157+
self.switch_to_frame(*args, **kwargs)
158+
159+
def デフォルトのコンテンツに切り替える(self, *args, **kwargs):
160+
# switch_to_default_content()
161+
self.switch_to_default_content(*args, **kwargs)
162+
163+
def 新しいウィンドウを開く(self, *args, **kwargs):
164+
# open_new_window()
165+
self.open_new_window(*args, **kwargs)
166+
167+
def ウィンドウに切り替え(self, *args, **kwargs):
168+
# switch_to_window(window)
169+
self.switch_to_window(*args, **kwargs)
170+
171+
def デフォルトのウィンドウに切り替える(self, *args, **kwargs):
172+
# switch_to_default_window()
173+
self.switch_to_default_window(*args, **kwargs)
174+
175+
def ハイライト(self, *args, **kwargs):
176+
# highlight(selector)
177+
self.highlight(*args, **kwargs)
178+
179+
def ハイライトしてクリックして(self, *args, **kwargs):
180+
# highlight_click(selector)
181+
self.highlight_click(*args, **kwargs)
182+
183+
def スクロールして(self, *args, **kwargs):
184+
# scroll_to(selector)
185+
self.scroll_to(*args, **kwargs)
186+
187+
def 一番上までスクロール(self, *args, **kwargs):
188+
# scroll_to_top()
189+
self.scroll_to_top(*args, **kwargs)
190+
191+
def 一番下までスクロール(self, *args, **kwargs):
192+
# scroll_to_bottom()
193+
self.scroll_to_bottom(*args, **kwargs)

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545

4646
setup(
4747
name='seleniumbase',
48-
version='1.36.2',
48+
version='1.36.3',
4949
description='Fast, Easy, and Reliable Browser Automation & Testing.',
5050
long_description=long_description,
5151
long_description_content_type='text/markdown',

0 commit comments

Comments
 (0)