Skip to content
This repository has been archived by the owner on May 30, 2023. It is now read-only.

open a page failed #12053

Closed
supersha opened this issue Mar 13, 2014 · 3 comments
Closed

open a page failed #12053

supersha opened this issue Mar 13, 2014 · 3 comments
Labels

Comments

@supersha
Copy link

my code is like this:

var page = require("webpage").create(); 
page.open("http://act.ju.taobao.com/go/act/ju-client-download.php", function(s){
   console.log(s);
   phantom.exit();
});

page.onResourceReceived = function(response){
    console.log(response.status + " " + response.url + " " + response.redirectURL);
};

and terminal stdout:

200 http://act.ju.taobao.com/go/act/ju-client-download.php null
200 http://act.ju.taobao.com/go/act/ju-client-download.php null
200 http://act.ju.taobao.com/go/rgn/act-style.css?t=20130805.css null
200 http://act.ju.taobao.com/go/rgn/act-style.css?t=20130805.css null
200 http://g.tbcdn.cn/??kissy/k/1.3.2/kissy-min.js,ju/common/1.0.44/global-min.js null
200 http://g.tbcdn.cn/ju/common/1.0.44/global-min.css null
200 http://g.tbcdn.cn/ju/common/1.0.44/global-min.css null
200 http://g.tbcdn.cn/??kissy/k/1.3.2/kissy-min.js,ju/common/1.0.44/global-min.js null
200 http://a.tbcdn.cn/s/aplus_v2.js null
200 http://a.tbcdn.cn/s/aplus_v2.js null
200 http://skip.ju.taobao.com/json/tg/juSkip.htm?menuType=index&_ksTS=1394706195084_18&callback=myjsonp0 null
200 http://skip.ju.taobao.com/json/tg/juSkip.htm?menuType=index&_ksTS=1394706195084_18&callback=myjsonp0 null
200 http://img04.taobaocdn.com/tps/i4/T1Y6qKXv0eXXXRdT_h-52-20.png null
200 http://img04.taobaocdn.com/tps/i4/T1Y6qKXv0eXXXRdT_h-52-20.png null
200 http://gtms04.alicdn.com/tps/i4/T1huWTXrXbXXaKqpTX-14-272.png null
200 http://gtms02.alicdn.com/tps/i2/T1CCRNXmRFXXXXXXXX.png null
200 http://gtms04.alicdn.com/tps/i4/T1huWTXrXbXXaKqpTX-14-272.png null
200 http://gtms02.alicdn.com/tps/i2/T1CCRNXmRFXXXXXXXX.png null
200 http://g.tbcdn.cn/tbc/umpp/1.4.4/index-min.js null
200 http://g.tbcdn.cn/tbc/umpp/1.4.4/index-min.js null
200 http://regcheckcode.taobao.com/auction/checkcode?sessionID= null
200 http://regcheckcode.taobao.com/auction/checkcode?sessionID= null
200 http://a.tbcdn.cn/p/header/webww-min.js?t=20110629.js null
null http://gtms01.alicdn.com/tps/i1/T1Bh1aFutXXXaAKfZG-116-116.png null
null http://a.tbcdn.cn/apps/matrix-mission/feedback/feedback.js null
200 http://a.tbcdn.cn/p/header/webww-min.js?t=20110629.js null
null http://gtms04.alicdn.com/tps/i4/T1ju1KXxFdXXcG.6..-1-14.png null
null http://gtms01.alicdn.com/tps/i1/T14DfWXedkXXXt8j_X-16-17.png null
null http://img02.taobaocdn.com/tps/i2/T1p1zUXXxqXXayyjnr-9-5.png null
null http://gtms02.alicdn.com/tps/i2/T1yTGHXDXfXXXEI6I.-13-19.png null
null http://gtms01.alicdn.com/tps/i1/T1IG5aFDFXXXcmQCDy-500-599.jpg null
null http://gtms04.alicdn.com/tps/i4/T1NyyXFsNaXXc23ncx-428-601.jpg null
null http://gtms03.alicdn.com/tps/i3/T1oMSFFyNXXXaQLg.H-435-600.jpg null
null http://gtms02.alicdn.com/tps/i2/T1pxx.FsdbXXbMrywu-108-469.png null
null http://gtms02.alicdn.com/tps/i2/T1rUX9FyhjXXX0BlAm-212-338.png null
null http://g.tbcdn.cn/ju/??jufav/1.0.13/index-min.js?t=16142.js null
null http://w.cnzz.com/c.php?id=30049117 null
null http://gtms03.alicdn.com/tps/i3/T1sWaaFpFaXXbNYzfD-472-572.jpg null
null http://gtms03.alicdn.com/tps/i3/T19XiaFwNaXXaLj_cs-956-582.jpg null
null http://g.tbcdn.cn/kissy/k/1.3.2/??template-min.js?t=20131125184002.js null
null http://gtms01.alicdn.com/tps/i1/T1vAT.FlVdXXb6keYl-250-440.png null
null http://g.tbcdn.cn/ju/??julog/1.0.0/index-min.js?t=16142.js null
null http://g.tbcdn.cn/kissy/k/1.3.2/??datalazyload-min.js?t=20131125184002.js null
null http://a.tbcdn.cn/apps/cart/mini/minicart-min.js?t=20130328.js null
null http://gtms02.alicdn.com/tps/i2/T17Wx_FqpcXXaEpLj6-728-443.jpg null
fail

There are many statusCode is null, and open the page's status is "fail", but i open that page at the browser is ok.

What is wrong?

@sniemetz
Copy link

Couple things:

  1. the callback onResourceReceived fires whenever a chunk was received - so for a larger resource it will fire multiple times wiht a null status code because the resource is still being downloaded.

see the docs: https://github.com/ariya/phantomjs/wiki/API-Reference-WebPage#onresourcereceived

  1. the page you want has a mobile detector and that is redirecting you to http://m.taobao.com/channel/act/juwap/download.php - so your initial page load is failed due to the redirect.

Phantom currently has trouble handling redirects happening via Javascript - you need to check for onNavigationRequested - and then do a new page.open

Apparently Phantom pretends to be a touch browser: #10375

their mobile code is poor - touch != mobile...
function redirectMobile() {
var isMobile = 'ontouchstart' in window;
if (isMobile) {
window.location.href = "http://m.taobao.com/channel/act/juwap/download.php ";
}
}

@ghyghoo8
Copy link

should have some modes:mobile、pc、all
just like patchs

bad en,sorry~

@stale stale bot added the stale label Dec 27, 2019
@stale
Copy link

stale bot commented Dec 30, 2019

Due to our very limited maintenance capacity, we need to prioritize our development focus on other tasks. Therefore, this issue will be automatically closed (see #15395 for more details). In the future, if we see the need to attend to this issue again, then it will be reopened. Thank you for your contribution!

@stale stale bot closed this as completed Dec 30, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants