Skip to content

Commit 33f688b

Browse files
committed
Add windows markdown files for Japanese, Chinese, and Portuguese languages.
1 parent b0730ed commit 33f688b

3 files changed

Lines changed: 36 additions & 141 deletions

File tree

website_and_docs/content/documentation/webdriver/interactions/windows.ja.md

Lines changed: 12 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,9 @@ WebDriverは、ウィンドウとタブを区別しません。
2020
{{< tab header="Java" text=true >}}
2121
{{< gh-codeblock path="/examples/java/src/test/java/dev/selenium/interactions/WindowsTest.java#L16-L20" >}}
2222
{{< /tab >}}
23-
{{< tab header="Python" >}}driver.current_window_handle{{< /tab >}}
23+
{{< tab header="Python" text=true >}}
24+
{{< gh-codeblock path="/examples/python/tests/interactions/test_windows.py#L16-L18" >}}
25+
{{< /tab >}}
2426
{{< tab header="CSharp" text=true >}}
2527
{{< gh-codeblock path="/examples/dotnet/SeleniumDocs/Interactions/WindowsTest.cs#L17-L21" >}}
2628
{{< /tab >}}
@@ -41,39 +43,8 @@ WebDriverは、ウィンドウとタブを区別しません。
4143
{{< tab header="Java" text=true >}}
4244
{{< gh-codeblock path="/examples/java/src/test/java/dev/selenium/interactions/WindowsTest.java#L22-L29" >}}
4345
{{< /tab >}}
44-
{{< tab header="Python" >}}
45-
from selenium import webdriver
46-
from selenium.webdriver.support.ui import WebDriverWait
47-
from selenium.webdriver.support import expected_conditions as EC
48-
49-
# Start the driver
50-
with webdriver.Firefox() as driver:
51-
# Open URL
52-
driver.get("https://seleniumhq.github.io")
53-
54-
# Setup wait for later
55-
wait = WebDriverWait(driver, 10)
56-
57-
# Store the ID of the original window
58-
original_window = driver.current_window_handle
59-
60-
# Check we don't have other windows open already
61-
assert len(driver.window_handles) == 1
62-
63-
# Click the link which opens in a new window
64-
driver.find_element(By.LINK_TEXT, "new window").click()
65-
66-
# Wait for the new window or tab
67-
wait.until(EC.number_of_windows_to_be(2))
68-
69-
# Loop through until we find a new window handle
70-
for window_handle in driver.window_handles:
71-
if window_handle != original_window:
72-
driver.switch_to.window(window_handle)
73-
break
74-
75-
# Wait for the new tab to finish loading content
76-
wait.until(EC.title_is("SeleniumHQ Browser Automation"))
46+
{{< tab header="Python" text=true >}}
47+
{{< gh-codeblock path="/examples/python/tests/interactions/test_windows.py#L22-L30" >}}
7748
{{< /tab >}}
7849

7950
{{< tab header="CSharp" text=true >}}
@@ -169,12 +140,8 @@ wait.until(titleIs("Selenium documentation"))
169140
{{< tab header="Java" text=true >}}
170141
{{< gh-codeblock path="/examples/java/src/test/java/dev/selenium/interactions/WindowsTest.java#L31-L34" >}}
171142
{{< /tab >}}
172-
{{< tab header="Python" >}}
173-
#Close the tab or window
174-
driver.close()
175-
176-
#Switch back to the old tab or window
177-
driver.switch_to.window(original_window)
143+
{{< tab header="Python" text=true >}}
144+
{{< gh-codeblock path="/examples/python/tests/interactions/test_windows.py#L35-L35" >}}
178145
{{< /tab >}}
179146

180147
{{< tab header="CSharp" text=true >}}
@@ -220,12 +187,8 @@ __注意: この機能は、Selenium 4以降のバージョンで機能します
220187
{{< tab header="Java" text=true >}}
221188
{{< gh-codeblock path="/examples/java/src/test/java/dev/selenium/interactions/WindowsTest.java#L36-L42" >}}
222189
{{< /tab >}}
223-
{{< tab header="Python" >}}
224-
# Opens a new tab and switches to new tab
225-
driver.switch_to.new_window('tab')
226-
227-
# Opens a new window and switches to new window
228-
driver.switch_to.new_window('window')
190+
{{< tab header="Python" text=true >}}
191+
{{< gh-codeblock path="/examples/python/tests/interactions/test_windows.py#L40-L43" >}}
229192
{{< /tab >}}
230193

231194
{{< tab header="CSharp" text=true >}}
@@ -268,7 +231,9 @@ driver.switchTo().newWindow(WindowType.WINDOW)
268231
{{< tab header="Java" text=true >}}
269232
{{< gh-codeblock path="/examples/java/src/test/java/dev/selenium/interactions/WindowsTest.java#L44-L45" >}}
270233
{{< /tab >}}
271-
{{< tab header="Python" >}}driver.quit(){{< /tab >}}
234+
{{< tab header="Python" text=true >}}
235+
{{< gh-codeblock path="/examples/python/tests/interactions/test_windows.py#L13-L13" >}}
236+
{{< /tab >}}
272237
{{< tab header="CSharp" text=true >}}
273238
{{< gh-codeblock path="/examples/dotnet/SeleniumDocs/Interactions/WindowsTest.cs#L45-L46" >}}
274239
{{< /tab >}}

website_and_docs/content/documentation/webdriver/interactions/windows.pt-br.md

Lines changed: 12 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,9 @@ persistente em uma única sessão. Você pode pegar o identificador atual usando
2020
{{< tab header="Java" text=true >}}
2121
{{< gh-codeblock path="/examples/java/src/test/java/dev/selenium/interactions/WindowsTest.java#L16-L20" >}}
2222
{{< /tab >}}
23-
{{< tab header="Python" >}}driver.current_window_handle{{< /tab >}}
23+
{{< tab header="Python" text=true >}}
24+
{{< gh-codeblock path="/examples/python/tests/interactions/test_windows.py#L16-L18" >}}
25+
{{< /tab >}}
2426
{{< tab header="CSharp" text=true >}}
2527
{{< gh-codeblock path="/examples/dotnet/SeleniumDocs/Interactions/WindowsTest.cs#L17-L21" >}}
2628
{{< /tab >}}
@@ -47,39 +49,8 @@ que cria uma nova guia (ou) nova janela e muda automaticamente para ela.
4749
{{< tab header="Java" text=true >}}
4850
{{< gh-codeblock path="/examples/java/src/test/java/dev/selenium/interactions/WindowsTest.java#L22-L29" >}}
4951
{{< /tab >}}
50-
{{< tab header="Python" >}}
51-
from selenium import webdriver
52-
from selenium.webdriver.support.ui import WebDriverWait
53-
from selenium.webdriver.support import expected_conditions as EC
54-
55-
# Start the driver
56-
with webdriver.Firefox() as driver:
57-
# Open URL
58-
driver.get("https://seleniumhq.github.io")
59-
60-
# Setup wait for later
61-
wait = WebDriverWait(driver, 10)
62-
63-
# Store the ID of the original window
64-
original_window = driver.current_window_handle
65-
66-
# Check we don't have other windows open already
67-
assert len(driver.window_handles) == 1
68-
69-
# Click the link which opens in a new window
70-
driver.find_element(By.LINK_TEXT, "new window").click()
71-
72-
# Wait for the new window or tab
73-
wait.until(EC.number_of_windows_to_be(2))
74-
75-
# Loop through until we find a new window handle
76-
for window_handle in driver.window_handles:
77-
if window_handle != original_window:
78-
driver.switch_to.window(window_handle)
79-
break
80-
81-
# Wait for the new tab to finish loading content
82-
wait.until(EC.title_is("SeleniumHQ Browser Automation"))
52+
{{< tab header="Python" text=true >}}
53+
{{< gh-codeblock path="/examples/python/tests/interactions/test_windows.py#L22-L30" >}}
8354
{{< /tab >}}
8455

8556
{{< tab header="CSharp" text=true >}}
@@ -178,12 +149,8 @@ anterior armazenado em uma variável. Junte isso e você obterá:
178149
{{< tab header="Java" text=true >}}
179150
{{< gh-codeblock path="/examples/java/src/test/java/dev/selenium/interactions/WindowsTest.java#L31-L34" >}}
180151
{{< /tab >}}
181-
{{< tab header="Python" >}}
182-
#Close the tab or window
183-
driver.close()
184-
185-
#Switch back to the old tab or window
186-
driver.switch_to.window(original_window)
152+
{{< tab header="Python" text=true >}}
153+
{{< gh-codeblock path="/examples/python/tests/interactions/test_windows.py#L35-L35" >}}
187154
{{< /tab >}}
188155

189156
{{< tab header="CSharp" text=true >}}
@@ -230,12 +197,8 @@ __Nota: este recurso funciona com Selenium 4 e versões posteriores.__
230197
{{< tab header="Java" text=true >}}
231198
{{< gh-codeblock path="/examples/java/src/test/java/dev/selenium/interactions/WindowsTest.java#L36-L42" >}}
232199
{{< /tab >}}
233-
{{< tab header="Python" >}}
234-
# Opens a new tab and switches to new tab
235-
driver.switch_to.new_window('tab')
236-
237-
# Opens a new window and switches to new window
238-
driver.switch_to.new_window('window')
200+
{{< tab header="Python" text=true >}}
201+
{{< gh-codeblock path="/examples/python/tests/interactions/test_windows.py#L40-L43" >}}
239202
{{< /tab >}}
240203

241204
{{< tab header="CSharp" text=true >}}
@@ -279,7 +242,9 @@ em vez de fechar:
279242
{{< gh-codeblock path="/examples/java/src/test/java/dev/selenium/interactions/WindowsTest.java#L44-L45" >}}
280243
{{< /tab >}}
281244

282-
{{< tab header="Python" >}}driver.quit(){{< /tab >}}
245+
{{< tab header="Python" text=true >}}
246+
{{< gh-codeblock path="/examples/python/tests/interactions/test_windows.py#L13-L13" >}}
247+
{{< /tab >}}
283248
{{< tab header="CSharp" text=true >}}
284249
{{< gh-codeblock path="/examples/dotnet/SeleniumDocs/Interactions/WindowsTest.cs#L45-L46" >}}
285250
{{< /tab >}}

website_and_docs/content/documentation/webdriver/interactions/windows.zh-cn.md

Lines changed: 12 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,9 @@ WebDriver 没有区分窗口和标签页。如果你的站点打开了一个新
1616
{{< tab header="Java" text=true >}}
1717
{{< gh-codeblock path="/examples/java/src/test/java/dev/selenium/interactions/WindowsTest.java#L16-L20" >}}
1818
{{< /tab >}}
19-
{{< tab header="Python" >}}driver.current_window_handle{{< /tab >}}
19+
{{< tab header="Python" text=true >}}
20+
{{< gh-codeblock path="/examples/python/tests/interactions/test_windows.py#L16-L18" >}}
21+
{{< /tab >}}
2022
{{< tab header="CSharp" text=true >}}
2123
{{< gh-codeblock path="/examples/dotnet/SeleniumDocs/Interactions/WindowsTest.cs#L17-L21" >}}
2224
{{< /tab >}}
@@ -40,39 +42,8 @@ WebDriver 没有区分窗口和标签页。如果你的站点打开了一个新
4042
{{< tab header="Java" text=true >}}
4143
{{< gh-codeblock path="/examples/java/src/test/java/dev/selenium/interactions/WindowsTest.java#L22-L29" >}}
4244
{{< /tab >}}
43-
{{< tab header="Python" >}}
44-
from selenium import webdriver
45-
from selenium.webdriver.support.ui import WebDriverWait
46-
from selenium.webdriver.support import expected_conditions as EC
47-
48-
# 启动驱动程序
49-
with webdriver.Firefox() as driver:
50-
# 打开网址
51-
driver.get("https://seleniumhq.github.io")
52-
53-
# 设置等待
54-
wait = WebDriverWait(driver, 10)
55-
56-
# 存储原始窗口的 ID
57-
original_window = driver.current_window_handle
58-
59-
# 检查一下,我们还没有打开其他的窗口
60-
assert len(driver.window_handles) == 1
61-
62-
# 单击在新窗口中打开的链接
63-
driver.find_element(By.LINK_TEXT, "new window").click()
64-
65-
# 等待新窗口或标签页
66-
wait.until(EC.number_of_windows_to_be(2))
67-
68-
# 循环执行,直到找到一个新的窗口句柄
69-
for window_handle in driver.window_handles:
70-
if window_handle != original_window:
71-
driver.switch_to.window(window_handle)
72-
break
73-
74-
# 等待新标签页完成加载内容
75-
wait.until(EC.title_is("SeleniumHQ Browser Automation"))
45+
{{< tab header="Python" text=true >}}
46+
{{< gh-codeblock path="/examples/python/tests/interactions/test_windows.py#L22-L30" >}}
7647
{{< /tab >}}
7748

7849
{{< tab header="CSharp" text=true >}}
@@ -163,12 +134,8 @@ wait.until(titleIs("Selenium documentation"))
163134
{{< tab header="Java" text=true >}}
164135
{{< gh-codeblock path="/examples/java/src/test/java/dev/selenium/interactions/WindowsTest.java#L31-L34" >}}
165136
{{< /tab >}}
166-
{{< tab header="Python" >}}
167-
#关闭标签页或窗口
168-
driver.close()
169-
170-
#切回到之前的标签页或窗口
171-
driver.switch_to.window(original_window)
137+
{{< tab header="Python" text=true >}}
138+
{{< gh-codeblock path="/examples/python/tests/interactions/test_windows.py#L35-L35" >}}
172139
{{< /tab >}}
173140

174141
{{< tab header="CSharp" text=true >}}
@@ -213,12 +180,8 @@ _注意: 该特性适用于 Selenium 4 及其后续版本。_
213180
{{< tab header="Java" text=true >}}
214181
{{< gh-codeblock path="/examples/java/src/test/java/dev/selenium/interactions/WindowsTest.java#L36-L42" >}}
215182
{{< /tab >}}
216-
{{< tab header="Python" >}}
217-
# 打开新标签页并切换到新标签页
218-
driver.switch_to.new_window('tab')
219-
220-
# 打开一个新窗口并切换到新窗口
221-
driver.switch_to.new_window('window')
183+
{{< tab header="Python" text=true >}}
184+
{{< gh-codeblock path="/examples/python/tests/interactions/test_windows.py#L40-L43" >}}
222185
{{< /tab >}}
223186

224187
{{< tab header="CSharp" text=true >}}
@@ -261,7 +224,9 @@ driver.switchTo().newWindow(WindowType.WINDOW)
261224
{{< gh-codeblock path="/examples/java/src/test/java/dev/selenium/interactions/WindowsTest.java#L44-L45" >}}
262225
{{< /tab >}}
263226

264-
{{< tab header="Python" >}}driver.quit(){{< /tab >}}
227+
{{< tab header="Python" text=true >}}
228+
{{< gh-codeblock path="/examples/python/tests/interactions/test_windows.py#L13-L13" >}}
229+
{{< /tab >}}
265230
{{< tab header="CSharp" text=true >}}
266231
{{< gh-codeblock path="/examples/dotnet/SeleniumDocs/Interactions/WindowsTest.cs#L45-L46" >}}
267232
{{< /tab >}}

0 commit comments

Comments
 (0)