how to switch context to children pages of popup

41 views
Skip to first unread message

1788...@qq.com

unread,
Nov 15, 2016, 1:29:37 AM11/15/16
to CasperJS
dump like this:
require('utils').dump(casper.popups);

the result like this. i want to switch to the page 'pay_menu.php' then do some operations.
how to switch ?

{
    "0": {
        "objectName": "WebPage",
        "title": "Member Center",
        "frameTitle": "Member Center",
        "content": "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\"><html></html>",
        "loading": false,
        "loadingProgress": 100,
        "canGoBack": false,
        "canGoForward": false,
        "plainText": " ",
        "libraryPath": "D:/Program Files (x86)/casperjs-1.1.3/bin",
        "offlineStoragePath": "C:/Users/saltywu/AppData/Local/Ofi Labs/PhantomJS",
        "offlineStorageQuota": 5242880,
        "viewportSize": {
            "height": 300,
            "width": 400
        },
        "paperSize": {},
        "clipRect": {
            "height": 0,
            "left": 0,
            "top": 0,
            "width": 0
        },
        "scrollPosition": {
            "left": 0,
            "top": 0
        },
        "navigationLocked": false,
        "customHeaders": {},
        "zoomFactor": 1,
        "cookies": [
            {
                "domain": "spj33.com",
                "httponly": false,
                "name": "Example_Session",
                "path": "/",
                "secure": false,
                "value": "40bg4s66h0nt36cj4svfvh4436"
            },
            {
                "domain": "spj33.com",
                "httponly": false,
                "name": "route",
                "path": "/",
                "secure": false,
                "value": "1726d7172592305df7cc673c3de0c94d"
            },
            {
                "domain": "spj33.com",
                "httponly": false,
                "name": "random",
                "path": "/",
                "secure": false,
                "value": "562379"
            },
            {
                "domain": "spj33.com",
                "httponly": false,
                "name": "token",
                "path": "/",
                "secure": false,
                "value": "fe9be91bb8db260d98f8e47a930d8fc9"
            },
            {
                "domain": "spj33.com",
                "httponly": false,
                "name": "page_site",
                "path": "/cl/",
                "secure": false,
                "value": "bankSavings"
            }
        ],
        "windowName": "MACENTER",
        "pages": [
            {
                "objectName": "WebPage",
                "title": "",
                "frameTitle": "",
                "content": "<html> </html>",
                "loading": false,
                "loadingProgress": 100,
                "canGoBack": false,
                "canGoForward": false,
                "plainText": " ",
                "framePlainText": " ",
                "libraryPath": "D:/Program Files (x86)/casperjs-1.1.3/bin",
                "offlineStoragePath": "C:/Users/xxx/AppData/Local/Ofi Labs/PhantomJS",
                "offlineStorageQuota": 5242880,
                "viewportSize": {
                    "height": 300,
                    "width": 400
                },
                "paperSize": {},
                "clipRect": {
                    "height": 0,
                    "left": 0,
                    "top": 0,
                    "width": 0
                },
                "scrollPosition": {
                    "left": 0,
                    "top": 0
                },
                "navigationLocked": false,
                "customHeaders": {},
                "zoomFactor": 1,
                "cookies": [
                    {
                        "domain": "spj33.com",
                        "httponly": false,
                        "name": "Example_Session",
                        "path": "/",
                        "secure": false,
                        "value": "40bg4s66h0nt36cj4svfvh4436"
                    },
                    {
                        "domain": "spj33.com",
                        "httponly": false,
                        "name": "route",
                        "path": "/",
                        "secure": false,
                        "value": "1726d7172592305df7cc673c3de0c94d"
                    },
                    {
                        "domain": "spj33.com",
                        "httponly": false,
                        "name": "random",
                        "path": "/",
                        "secure": false,
                        "value": "562379"
                    },
                    {
                        "domain": "spj33.com",
                        "httponly": false,
                        "name": "token",
                        "path": "/",
                        "secure": false,
                        "value": "fe9be91bb8db260d98f8e47a930d8fc9"
                    },
                    {
                        "domain": "spj33.com",
                        "httponly": false,
                        "name": "game_cookie",
                        "path": "/app/member/",
                        "secure": false,
                        "value": "40bg4s66h0nt36cj4svfvh4436"
                    }
                ],
                "windowName": "SecureOnline",
                "pages": [],
                "pagesWindowName": [],
                "ownsPages": true,
                "framesName": [],
                "frameName": "SecureOnline",
                "framesCount": 0,
                "focusedFrameName": "SecureOnline",
                "cookieJar": {
                    "objectName": "",
                    "cookies": [
                        {
                            "domain": "spj33.com",
                            "httponly": false,
                            "name": "Example_Session",
                            "path": "/",
                            "secure": false,
                            "value": "40bg4s66h0nt36cj4svfvh4436"
                        },
                        {
                            "domain": "spj33.com",
                            "httponly": false,
                            "name": "page_site",
                            "path": "/cl/",
                            "secure": false,
                            "value": "bankSavings"
                        },
                        {
                            "domain": "spj33.com",
                            "httponly": false,
                            "name": "game_cookie",
                            "path": "/app/member/",
                            "secure": false,
                            "value": "40bg4s66h0nt36cj4svfvh4436"
                        },
                        {
                            "domain": "spj33.com",
                            "httponly": false,
                            "name": "route",
                            "path": "/",
                            "secure": false,
                            "value": "1726d7172592305df7cc673c3de0c94d"
                        },
                        {
                            "domain": "spj33.com",
                            "httponly": false,
                            "name": "random",
                            "path": "/",
                            "secure": false,
                            "value": "562379"
                        },
                        {
                            "domain": "spj33.com",
                            "httponly": false,
                            "name": "token",
                            "path": "/",
                            "secure": false,
                            "value": "fe9be91bb8db260d98f8e47a930d8fc9"
                        }
                    ]
                }
            }
        ],
        "pagesWindowName": [
            "SecureOnline"
        ],
        "ownsPages": true,
        "framesName": [],
        "frameName": "MACENTER",
        "framesCount": 0,
        "focusedFrameName": "MACENTER",
        "cookieJar": {
            "objectName": "",
            "cookies": [
                {
                    "domain": "spj33.com",
                    "httponly": false,
                    "name": "Example_Session",
                    "path": "/",
                    "secure": false,
                    "value": "40bg4s66h0nt36cj4svfvh4436"
                },
                {
                    "domain": "spj33.com",
                    "httponly": false,
                    "name": "page_site",
                    "path": "/cl/",
                    "secure": false,
                    "value": "bankSavings"
                },
                {
                    "domain": "spj33.com",
                    "httponly": false,
                    "name": "game_cookie",
                    "path": "/app/member/",
                    "secure": false,
                    "value": "40bg4s66h0nt36cj4svfvh4436"
                },
                {
                    "domain": "spj33.com",
                    "httponly": false,
                    "name": "route",
                    "path": "/",
                    "secure": false,
                    "value": "1726d7172592305df7cc673c3de0c94d"
                },
                {
                    "domain": "spj33.com",
                    "httponly": false,
                    "name": "random",
                    "path": "/",
                    "secure": false,
                    "value": "562379"
                },
                {
                    "domain": "spj33.com",
                    "httponly": false,
                    "name": "token",
                    "path": "/",
                    "secure": false,
                    "value": "fe9be91bb8db260d98f8e47a930d8fc9"
                }
            ]
        }
    },
    "length": 1
}

1788...@qq.com

unread,
Nov 15, 2016, 2:14:24 AM11/15/16
to CasperJS
additional remarks : the child page is opened by ‘window.open’

Ken

unread,
May 25, 2017, 3:56:31 PM5/25/17
to CasperJS
There some recent patches applied for CasperJS v1.1.4. You may want to navigate the page normally and then use waitforpopup and withpopup to interact with the new sub-pages that appear. I've tried both and they work for helping me interact with elements or data on the popup page.
Reply all
Reply to author
Forward
0 new messages