Skip to content

Problems with cookies #405

Description

@magreenblatt

Original report by Osiris Team (Bitbucket: Osiris Team).


Code and problem:

        String username = "usernmae";
        String password = "password"; // TODO REMOVE THIS!
        String loginUrl = "https://www.spigotmc.org/login";

        PandomiumSettings settings = PandomiumSettings.getDefaultSettingsBuilder()
                .nativeDirectory(System.getProperty("user.dir")+"/autoplug-system/natives")
                //.proxy("localhost", 20) // blank page
                .build();

        Pandomium pandomium = new Pandomium(settings);
        pandomium.initialize();

        PandomiumClient client = pandomium.createClient();

        System.out.println("Loading '"+loginUrl+"'. Please stand by...");
        PandomiumBrowser browser = client.loadURL(loginUrl);
        System.out.println("Loaded '"+loginUrl+"'!");


        System.out.println("Logging in...");
        browser.getCefBrowser().executeJavaScript("" +
                "document.getElementById('ctrl_pageLogin_login').value=\""+username+"\";" +
                "document.getElementById('ctrl_pageLogin_password').value=\""+password+"\";" +
                "document.forms[0].submit();", "", 1);
        Thread.sleep(1000);

        System.out.println("Cookies: ");
        boolean hasAccessToCookies = CefCookieManager.getGlobalManager().visitAllCookies(new CefCookieVisitor() {
            @Override
            public boolean visit(CefCookie cefCookie, int i, int i1, BoolRef boolRef) {
                System.out.println("Cookie: "+cefCookie.name+" Value: "+cefCookie.value);
                return false;
            }
        });
        // THIS SHOULD PRINT A BUNCH OF COOKIES, BUT DOESNT.

        if (!hasAccessToCookies)
            System.out.println("Failed to display cookies due to lack of access!");

Already opened an issue here: dzikoysk/pandomium#71, but got told that I should ask here instead.

Activity

  1. magreenblatt commented on Aug 21, 2021

    @magreenblatt
    CollaboratorAuthor

    Original changes by Osiris Team (Bitbucket: Osiris Team).


    • edited description
  2. magreenblatt commented on Aug 21, 2021

    @magreenblatt
    CollaboratorAuthor

    Original changes by Osiris Team (Bitbucket: Osiris Team).


    • edited description
  3. magreenblatt commented on Aug 26, 2021

    @magreenblatt
    CollaboratorAuthor

    Original changes by Osiris Team (Bitbucket: Osiris Team).


    • changed priority from "major" to "blocker"
  4. behring commented on Feb 3, 2025

    @behring

    After all these years, hasn't this problem been fixed? I still can't get cookies through the visitUrlCookies or visitAllCookies method. I hope to receive assistance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugBug report

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions