@@ -144,30 +144,30 @@ Moving between windows and frames
144
144
145
145
It's rare for a modern web application not to have any frames or to be
146
146
constrained to a single window. WebDriver supports moving between named windows
147
- using the "switch_to_window " method::
147
+ using the "switch_to.window " method::
148
148
149
- driver.switch_to_window ("windowName")
149
+ driver.switch_to.window ("windowName")
150
150
151
151
All calls to ``driver `` will now be interpreted as being directed to the
152
152
particular window. But how do you know the window's name? Take a look at the
153
153
javascript or link that opened it::
154
154
155
155
<a href="somewhere.html" target="windowName">Click here to open a new window</a>
156
156
157
- Alternatively, you can pass a "window handle" to the "switch_to_window ()"
157
+ Alternatively, you can pass a "window handle" to the "switch_to.window ()"
158
158
method. Knowing this, it's possible to iterate over every open window like so::
159
159
160
160
for handle in driver.window_handles:
161
- driver.switch_to_window (handle)
161
+ driver.switch_to.window (handle)
162
162
163
163
You can also swing from frame to frame (or into iframes)::
164
164
165
- driver.switch_to_frame ("frameName")
165
+ driver.switch_to.frame ("frameName")
166
166
167
167
It's possible to access subframes by separating the path with a dot, and you can
168
168
specify the frame by its index too. That is::
169
169
170
- driver.switch_to_frame ("frameName.0.child")
170
+ driver.switch_to.frame ("frameName.0.child")
171
171
172
172
would go to the frame named "child" of the first subframe of the frame called
173
173
"frameName". **All frames are evaluated as if from *top*. **
0 commit comments