且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

PhantomJS无法打开本地文件

更新时间:2023-08-30 12:14:46

PhantomJS可以打开本地文件而没有任何问题.该URL必须遵循经典的Url/Uri规则,尤其是对于本地文件.

PhantomJS can open local files without any problems. The url have to follow classic Url/Uri rules, especially for a local file.

/Full/Path/To/test.html对PhantomJS无效.是本地文件还是网络资源?

/Full/Path/To/test.html is not valid for PhantomJS. Is it a local file or a web resource?

根据路径,只需尝试以下操作即可:

Depending of the path, just try with something like this:

file:///C:/Full/Path/To/test.html

或者如果它托管在Web服务器中:

or if it's hosted in a web server:

http://localhost/Full/Path/To/test.html