groovywebdrivergeb

Selenium 2 get all cookies on domain


All. I have problem with getting cookies on domain. i try get cookies:

def "go to site"() {
    when:
        go "http://bla-bla-bla.bla"
    then:
        title == "Bla-bla-bla"
        // check cookies
        String cookies = driver.manage().getCookieNamed("name1").getValue()
        println cookies
}

but cookies with name1 geting on other domain, not http://bla-bla-bla.bla, name1 it's cookies on domain http://ululu.ulu and a try get all cookies, on all domains(sites), but I did not get.

Please help me get all cookies on all domains(sites). Thank you. My English sucks.


Solution

  • Selenium only gives you access to the cookies for the currently active domain. That is, cookies that are relevant to the current browser state.

    There's no way around this that I know of.