ajitjaiswal50 / selenium-vba

Automatically exported from code.google.com/p/selenium-vba
0 stars 0 forks source link

how to check availability of cookies #125

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
Operating system : windows 7
.Net Framework version :
Office Version : 2010
SeleniumWrapper version : 2.8.0

What is your issue ?

I have observed that, we can't clear all cookies but still is there any way to 
check cookies cleared or not (we'll do it manually) after each navigation

Thanks in advance for your Support / Help

Original issue reported on code.google.com by sunilm...@gmail.com on 11 Dec 2014 at 11:35

GoogleCodeExporter commented 8 years ago
Each time the start command is called, a new and cleaned session without cookie 
is created.
Moreover, the related commands will only apply to the cookies from to the 
current page domain.
Here is a usage example:

Sub testCookies()
    Dim wd As New SeleniumWrapper.WebDriver

    wd.Start "firefox", "http://www.google.com"
    wd.setImplicitWait 5000
    wd.Open "/"

    Debug.Print "Cookies: " & wd.getCookie()
    Debug.Print "Cookie NID: " & wd.getCookieByName("NID")
    Debug.Print "Verify: " & wd.verifyCookie("")

    Debug.Print "Delete cookies from domain http://www.google.com"
    wd.deleteAllVisibleCookies

    Debug.Print "Cookies: " & wd.getCookie()
    Debug.Print "Verify: " & wd.verifyCookie("")
    wd.assertCookie ""

End Sub

You can handle the cookies from another domain by changing it with the "open" 
command:

wd.open "http://domain 1"
wd.deleteAllVisibleCookies
wd.open "http://domain 2"
wd.deleteAllVisibleCookies
...

Original comment by florentbr on 13 Dec 2014 at 1:34