课程: Test Automation with Selenium WebDriver for Java
免费学习该课程!
今天就开通帐号,24,700 门业界名师课程任您挑!
Initializing elements
- [Instructor] Let's create a page object class that contains the web elements needed to automate entering a username and password and clicking the login button. We'll need the locators for each element. The username field has an ID of username-field. The password field has an ID of password-dash field, and the login button has an ID of login-form-submit. In this LoginPage class, which lives in the source main Java package, we'll define each of the elements as global variables so that they are accessible by any methods we create for this page. And instead of using web elements as the type we'll use By. So I'm going to say By usernameField. When you define objects as web element, they are located and initialized immediately when the page object class is instantiated. If the page hasn't fully loaded or if the elements aren't immediately present in the dom, this can lead to an exception. By defining the elements as By objects, the actual search for the element happens when the method…
内容
-
-
-
-
-
-
-
-
-
-
(已锁定)
Framework and tests1 分钟 12 秒
-
(已锁定)
Page Object Model design pattern1 分钟 16 秒
-
(已锁定)
Initializing elements3 分钟 1 秒
-
(已锁定)
Implementing interaction methods5 分钟 3 秒
-
(已锁定)
Using Page Objects in tests7 分钟 45 秒
-
(已锁定)
Code challenge: Implement Page Object Model47 秒
-
(已锁定)
Solution: Implement Page Object Model4 分钟 5 秒
-
(已锁定)
-