课程: Test Automation with Selenium WebDriver for Java
免费学习该课程!
今天就开通帐号,24,700 门业界名师课程任您挑!
Cookies
- [Instructor] Websites often store small amounts of data about your activity and preferences in web cookies within your browser. You can access these cookies on the Application tab of your browser's developer tools. Let's use WebDriver to manage cookies. We can start by adding a new Cookie using the cookie class, and we'll set this equal to new Cookie. Inside of the constructor, we'll set a name and a value for the cookie. So let's say that the user prefers a light theme. We can set the name as theme and the value as light. Now we can use WebDriver to store this cookie in the browser. To do so, we'll say driver.manage.addCookie, and we can pass in our cookie that we just created. Then to access cookies within the browser, we can call driver.manage.get. And notice there's a getCookieNamed method, which will get a specific cookie. And getCookies method, which will return all cookies. We'll call getCookieNamed to get the one that we just created. So we'll pass in the name of the cookie,…
内容
-
-
-
-
-
-
-
-
(已锁定)
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 秒
-
(已锁定)
-
-
-