|
1 |
| -<h3 align="left"><a href="https://github.com/seleniumbase/SeleniumBase/"><img src="https://seleniumbase.io/cdn/img/super_logo_m.png" title="SeleniumBase" width="300" /></a></h3> |
2 |
| - |
3 | 1 | <a id="language_tests"></a>
|
4 |
| -<h3><img src="https://seleniumbase.io/img/logo6.png" title="SeleniumBase" width="32" /> Language Tests (Python 3+)</h3> |
| 2 | +<h2>🌏 Translated Tests 🈺</h2> |
| 3 | + |
| 4 | +<b>SeleniumBase</b> supports the following 10 languages: <i>English</i>, <i>Chinese</i>, <i>Dutch</i>, <i>French</i>, <i>Italian</i>, <i>Japanese</i>, <i>Korean</i>, <i>Portuguese</i>, <i>Russian</i>, and <i>Spanish</i>. (Examples can be found in [<a href="https://github.com/seleniumbase/SeleniumBase/tree/master/examples/translations">SeleniumBase/examples/translations</a>]) |
5 | 5 |
|
6 |
| -<b>SeleniumBase</b> supports the following 10 languages: <i>English</i>, <i>Chinese</i>, <i>Dutch</i>, <i>French</i>, <i>Italian</i>, <i>Japanese</i>, <i>Korean</i>, <i>Portuguese</i>, <i>Russian</i>, and <i>Spanish</i>. |
| 6 | +Multi-language tests run with **pytest** like other tests. Test methods have a one-to-one mapping to supported languages. Here's an example of a translated test: |
7 | 7 |
|
8 |
| -Examples can be found in [<a href="https://github.com/seleniumbase/SeleniumBase/tree/master/examples/translations">SeleniumBase/examples/translations</a>]. |
| 8 | +```python |
| 9 | +# Chinese Translation |
| 10 | +from seleniumbase.translate.chinese import 硒测试用例 |
9 | 11 |
|
10 |
| -Multi-language tests are run with **pytest** like any other test. Every test method has a one-to-one mapping to every other supported language. <i>Example:</i> |
| 12 | +class 我的测试类(硒测试用例): |
| 13 | + def test_例子1(self): |
| 14 | + self.开启("https://zh.wikipedia.org/wiki/") |
| 15 | + self.断言标题("维基百科,自由的百科全书") |
| 16 | + self.断言元素('a[title="首页"]') |
| 17 | + self.断言文本("新闻动态", "span#新闻动态") |
| 18 | + self.输入文本("#searchInput", "舞龍") |
| 19 | + self.单击("#searchButton") |
| 20 | + self.断言文本("舞龍", "#firstHeading") |
11 | 21 | ```
|
12 |
| -self.open(URL) <=> self.开启网址(URL) |
| 22 | + |
| 23 | +Here's another example: |
| 24 | + |
| 25 | +```python |
| 26 | +# Japanese Translation |
| 27 | +from seleniumbase.translate.japanese import セレニウムテストケース |
| 28 | + |
| 29 | +class 私のテストクラス(セレニウムテストケース): |
| 30 | + def test_例1(self): |
| 31 | + self.を開く("https://ja.wikipedia.org/wiki/") |
| 32 | + self.テキストを確認する("ウィキペディア") |
| 33 | + self.要素を確認する('[title="メインページに移動する"]') |
| 34 | + self.入力("#searchInput", "アニメ") |
| 35 | + self.クリックして("#searchButton") |
| 36 | + self.テキストを確認する("アニメ", "#firstHeading") |
| 37 | + self.入力("#searchInput", "寿司") |
13 | 38 | ```
|
14 | 39 |
|
15 | 40 | <a id="translation_api"></a>
|
16 |
| -<h2><img src="https://seleniumbase.io/img/logo6.png" title="SeleniumBase" width="32" /> Translation API</h2> |
| 41 | +<h2><img src="https://seleniumbase.io/img/logo6.png" title="SeleniumBase" width="32" /> Translation API 🈺</h2> |
17 | 42 |
|
18 |
| -You can use SeleniumBase to selectively translate the method names of any test from one language to another via the console scripts interface. Additionally, the ``import`` line at the top of the Python file will change to import the new ``BaseCase``. Example: ``BaseCase`` becomes ``CasoDeTeste`` when a test is translated into Portuguese. |
| 43 | +You can use SeleniumBase to selectively translate the method names of any test from one language to another with the console scripts interface. Additionally, the ``import`` line at the top of the Python file will change to import the new ``BaseCase``. Example: ``BaseCase`` becomes ``CasoDeTeste`` when a test is translated into Portuguese. |
19 | 44 |
|
20 | 45 | ```bash
|
21 | 46 | seleniumbase translate
|
@@ -59,3 +84,7 @@ plus the 2-letter language code of the new language.
|
59 | 84 | (Example: Translating ``test_1.py`` into Japanese with
|
60 | 85 | ``-c`` will create a new file called ``test_1_ja.py``.)
|
61 | 86 | ```
|
| 87 | + |
| 88 | +-------- |
| 89 | + |
| 90 | +<h3 align="left"><a href="https://github.com/seleniumbase/SeleniumBase/"><img src="https://seleniumbase.io/cdn/img/super_logo_m.png" title="SeleniumBase" width="280" /></a></h3> |
0 commit comments