Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 656a8b2

Browse files
committed
Use new API
Signed-off-by: Baiju Muthukadan <[email protected]>
1 parent 1d97c3e commit 656a8b2

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

source/navigating.rst

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -144,30 +144,30 @@ Moving between windows and frames
144144

145145
It's rare for a modern web application not to have any frames or to be
146146
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::
148148

149-
driver.switch_to_window("windowName")
149+
driver.switch_to.window("windowName")
150150

151151
All calls to ``driver`` will now be interpreted as being directed to the
152152
particular window. But how do you know the window's name? Take a look at the
153153
javascript or link that opened it::
154154

155155
<a href="somewhere.html" target="windowName">Click here to open a new window</a>
156156

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()"
158158
method. Knowing this, it's possible to iterate over every open window like so::
159159

160160
for handle in driver.window_handles:
161-
driver.switch_to_window(handle)
161+
driver.switch_to.window(handle)
162162

163163
You can also swing from frame to frame (or into iframes)::
164164

165-
driver.switch_to_frame("frameName")
165+
driver.switch_to.frame("frameName")
166166

167167
It's possible to access subframes by separating the path with a dot, and you can
168168
specify the frame by its index too. That is::
169169

170-
driver.switch_to_frame("frameName.0.child")
170+
driver.switch_to.frame("frameName.0.child")
171171

172172
would go to the frame named "child" of the first subframe of the frame called
173173
"frameName". **All frames are evaluated as if from *top*.**

0 commit comments

Comments
 (0)