我遵循了这些说明(除了将可执行文件复制到我的PATH,因为我似乎无法找到它并且似乎没有必要).然后我在我的公共javascripts目录中创建了一个名为image_render.js的文件
console.log('Hello, world!');
phantom.exit();
Run Code Online (Sandbox Code Playgroud)
在里面,保存它,并phantomjs render_image.js在我的终端中运行.但是,我的终端无法识别命令:
-bash: phantomjs: command not found
Run Code Online (Sandbox Code Playgroud)
我做错了什么?
在烧瓶上局部运行Selenium.我正在使用PhantomJS驱动程序.我之前有一个路径错误:
selenium.common.exceptions.WebDriverException: Message: 'phantomjs' executable needs to be in PATH.
Run Code Online (Sandbox Code Playgroud)
但是在从另一个StackOverflow问题中找到后,我了解到我必须将环境路径作为PhantomJS的参数传递.我在下面的路径是我的虚拟环境文件夹中phantomJS文件夹的路径.
driver = webdriver.PhantomJS(executable_path='/Users/MyAcc/Documents/MYWEBAPP/venv/lib/python3.5/site-packages/selenium/webdriver/phantomjs')
Run Code Online (Sandbox Code Playgroud)
但是,我现在得到一个新的错误代码:
selenium.common.exceptions.WebDriverException: Message: 'phantomjs' executable may have wrong permissions.
Run Code Online (Sandbox Code Playgroud)
这是我检查路径的文件权限时得到的结果.
total 40
drwxr-xr-x 7 USER staff 238 Nov 6 00:07 .
drwxr-xr-x 17 USER staff 578 Nov 6 00:03 ..
-rw-r--r--@ 1 USER staff 6148 Nov 6 00:07 .DS_Store
-rw-r--r-- 1 USER staff 787 Oct 31 12:27 __init__.py
drwxr-xr-x 5 USER staff 170 Oct 31 12:27 __pycache__
-rw-r--r-- 1 USER staff 2587 Oct 31 12:27 service.py …Run Code Online (Sandbox Code Playgroud) 我正在阅读关于ajax爬行的谷歌规范; 我理解这个概念,但我需要更多的澄清:
我的网址都是这样的:
http://www.website.com/#!/eng/home
http://www.website.com/#!/eng/contacts
...
Run Code Online (Sandbox Code Playgroud)
我必须在这些地址提供html快照:
http://www.website.com/?_escaped_fragment_=/eng/home
http://www.website.com/?_escaped_fragment_=/eng/contacts
...
Run Code Online (Sandbox Code Playgroud)
它是否正确?或者我应该删除"escaped_fragment"网址中的"/"(例如http://www.website.com/?_escaped_fragment_=eng/home或其他什么?)
我使用phantomjs生成HTML快照,但是哪一个是向爬虫提供这些快照的最佳方式?使用节点js?使用htaccess重写规则?
error: Could not spawn
[/root/AgarioBotsV3/node_modules/phantomjsprebuilt/lib/phantom\bin\phantomjs.exe
] executable. Please make sure phantomjs is installed correctly.
error: Error: spawn /root/AgarioBotsV3/node_modules/phantomjs-
prebuilt/lib/phantom\bin\phantomjs.exe ENOENT
at exports._errnoException (util.js:1016:11)
at Process.ChildProcess._handle.onexit (internal/child_process.js:189:19)
at onErrorNT (internal/child_process.js:366:16)
at _combinedTickCallback (internal/process/next_tick.js:102:11)
at process._tickCallback (internal/process/next_tick.js:161:9)
at Function.Module.runMain (module.js:607:11)
at startup (bootstrap_node.js:158:16)
at bootstrap_node.js:575:3
我不知道如何解决请帮忙。我使用的是 linux ubuntu 16.04 服务器
phantomjs ×4
python ×2
debugging ×1
ember.js ×1
javascript ×1
node.js ×1
seo ×1
web-crawler ×1