课程: Test Automation with Selenium WebDriver for Java
免费学习该课程!
今天就开通帐号,24,700 门业界名师课程任您挑!
Using Page Objects in tests
- [Instructor] Every web test needs to open and close the browser and use Selenium web driver to interact with the page. Rather than duplicating this code in every test method, you can extract it out and place it into methods that run before and after your test suite. For that, we'll use a base test class that every other test class can inherit from. This class lives under the source test Java directory. Let's start by declaring a web driver instance that can be used across all tests, and we'll make this protected so that it's accessible in all test classes that inherit from this one. So we can say protected static WebDriver driver. Next, we'll create a setup method and we can say public static void, and we'll call this setup. In this method, we can set up our chrome driver executable. So let's say chromedriver.setup. And we can also specify any preferred options. So let's say chrome options, we'll call this options, equals new chrome options. To run selenium tests in GitHub code…
内容
-
-
-
-
-
-
-
-
-
-
(已锁定)
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 秒
-
(已锁定)
-