@@ -64,16 +64,10 @@ WebElementを使用した切り替えは、最も柔軟なオプションです
64
64
{{< tab header="Java" text=true >}}
65
65
{{< gh-codeblock path="examples/java/src/test/java/dev/selenium/interactions/FramesTest.java#L38-L46" >}}
66
66
{{< /tab >}}
67
- {{< tab header="Python" >}}
68
- # Store iframe web element
69
- iframe = driver.find_element(By.CSS_SELECTOR, "#modal > iframe")
70
-
71
- # switch to selected iframe
72
- driver.switch_to.frame(iframe)
73
-
74
- # Now click on button
75
- driver.find_element(By.TAG_NAME, 'button').click()
76
- {{< /tab >}}
67
+ {{< tab header="Python" text=true >}}
68
+ {{< gh-codeblock path="examples/python/tests/interactions/test_frames.py#L24-L32" >}}
69
+ {{< /tab >}}
70
+
77
71
{{< tab header="CSharp" text=true >}}
78
72
{{< gh-codeblock path="examples/dotnet/SeleniumDocs/Interactions/FramesTest.cs#L38-L46" >}}
79
73
{{< /tab >}}
@@ -118,13 +112,11 @@ FrameまたはiFrameにidまたはname属性がある場合、代わりにこれ
118
112
{{< tab header="Java" text=true >}}
119
113
{{< gh-codeblock path="examples/java/src/test/java/dev/selenium/interactions/FramesTest.java#L50-L58" >}}
120
114
{{< /tab >}}
121
- {{< tab header="Python" >}}
122
- # Switch frame by id
123
- driver.switch_to.frame('buttonframe')
124
-
125
- # Now, Click on the button
126
- driver.find_element(By.TAG_NAME, 'button').click()
127
- {{< /tab >}}
115
+
116
+ {{< tab header="Python" text=true >}}
117
+ {{< gh-codeblock path="examples/python/tests/interactions/test_frames.py#L34-L42" >}}
118
+ {{< /tab >}}
119
+
128
120
{{< tab header="CSharp" text=true >}}
129
121
{{< gh-codeblock path="examples/dotnet/SeleniumDocs/Interactions/FramesTest.cs#L50-L58" >}}
130
122
{{< /tab >}}
@@ -155,31 +147,27 @@ driver.findElement(By.tagName("button")).click()
155
147
JavaScriptの _ window.frames_ を使用して照会できるように、Frameのインデックスを使用することもできます。
156
148
157
149
{{< tabpane langEqualsHeader=true >}}
158
- {{< tab header="Java" text=true >}}
150
+ {{< tab header="Java" text=true >}}
159
151
{{< gh-codeblock path="examples/java/src/test/java/dev/selenium/interactions/FramesTest.java#L62-L63" >}}
160
- {{< /tab >}}
161
- {{< tab header="Ruby" >}}
162
- # Switch to the second frame
152
+ {{< /tab >}}
153
+ {{< tab header="Python" text=true >}}
154
+ {{< gh-codeblock path="examples/python/tests/interactions/test_frames.py#L45-L46" >}}
155
+ {{< /tab >}}
156
+ {{< tab header="Ruby" >}}
157
+ # Switch to the second frame
163
158
driver.switch_to.frame(1)
164
- {{< /tab >}}
165
- {{< tab header="CSharp" text=true >}}
159
+ {{< /tab >}}
160
+ {{< tab header="CSharp" text=true >}}
166
161
{{< gh-codeblock path="examples/dotnet/SeleniumDocs/Interactions/FramesTest.cs#L62-L63" >}}
167
162
{{< /tab >}}
168
- {{< tab header="Python" >}}
169
- # switching to second iframe based on index
170
- iframe = driver.find_elements(By.TAG_NAME,'iframe')[ 1]
171
-
172
- # switch to selected iframe
173
- driver.switch_to.frame(iframe)
174
- {{< /tab >}}
175
- {{< tab header="JavaScript" >}}
163
+ {{< tab header="JavaScript" >}}
176
164
// Switches to the second frame
177
165
await driver.switchTo().frame(1);
178
- {{< /tab >}}
179
- {{< tab header="Kotlin" >}}
166
+ {{< /tab >}}
167
+ {{< tab header="Kotlin" >}}
180
168
// Switches to the second frame
181
169
driver.switchTo().frame(1)
182
- {{< /tab >}}
170
+ {{< /tab >}}
183
171
{{< /tabpane >}}
184
172
185
173
0 commit comments