codecamp

selenium2 使用Cookies

在我们进行下一步之前,你可能会好奇如何使用​cookie​,首先你需要处在一个域名下,然后这样设置​cookie​:

# Go to the correct domain
driver.get("http://example.com")

# Now set the cookie. This one's valid for the entire domain
cookie = {'name':'foo','value':'bar'}
driver.add_cookie(cookie)

# And now output all the available cookies for the current URL
driver.get_cookies()



selenium2 导航:历史记录和定位
selenium2 元素定位
温馨提示
下载编程狮App,免费阅读超1000+编程语言教程
取消
确定