课程: Test Automation with Selenium WebDriver for Java
免费学习该课程!
今天就开通帐号,24,700 门业界名师课程任您挑!
Tabs
- [Instructor] Clicking a link may open a new tab or window. Let's look at how Selenium Web driver allows us to navigate between multiple open web pages. After clicking the button, which opens a new window to get all of the open windows, we'll say var windows = driver.getWindowHandles(). This gives us a set of unique identifiers that represent each browser window or tab that is currently open within this session. In fact, let's print these out. So these handles allow you to switch control between the different tabs or windows that are open, but don't worry, you don't need to know these exact identifiers. Web driver provides convenience methods. For example, if we want to move the focus to the new tab we just opened, we can say driver.switchTo().window(), and we can provide the handle for the window, which we can get from our Windows collection. However, be careful because getWindowHandles() returns a set and this data structure does not guarantee order. So we cannot assume that the…
内容
-
-
-
-
-
-
-
-
(已锁定)
Browser information1 分钟 17 秒
-
(已锁定)
Navigation1 分钟 44 秒
-
(已锁定)
Tabs3 分钟 24 秒
-
(已锁定)
Modals2 分钟 21 秒
-
(已锁定)
Alerts4 分钟 8 秒
-
(已锁定)
iFrames2 分钟 3 秒
-
(已锁定)
Cookies3 分钟 6 秒
-
(已锁定)
Taking screenshots7 分钟 35 秒
-
(已锁定)
Code Challenge: Accept alert in new tab37 秒
-
(已锁定)
Solution: Accept alert in new tab39 秒
-
(已锁定)
-
-
-