Heroku上的PhantomJSpath

我有一个在Heroku上运行的节点应用程序。 我在python中使用selenium来抓取一个网站,并在我需要的时候从我的节点app调用python脚本。 我在我的Mac上安装PhantomJS,当我在本地运行应用程序(节点index.js)时,一切正常。

path_to_phantom = '/Users/govind/Desktop/phantomjs-2.1.1- macosx/bin/phantomjs' browser = webdriver.PhantomJS(executable_path = path_to_phantom) 

然而,Heroku似乎没有任何工作。 我也将PhantomJS buildpack添加到我的节点应用程序,但它只是不会调用python脚本。 我认为这个问题是通往PhantomJS buildpack的path。 我应该添加什么path? 还是有我在这里失踪的其他方面?

我在我的Python应用程序中使用了PhantomJS中的Selenium,这些应用程序按照以下步骤部署到Heroku:

1)切换到我的Heroku应用程序上使用Cedar-14堆栈

 $ heroku stack:set cedar-14 

2)安装PhantomJS buildpack

 $ heroku buildpacks:add https://github.com/stomita/heroku-buildpack-phantomjs 

随着这些变化,我可以使用Selenium来获取网站

 from selenium import webdriver browser = webdriver.PhantomJS() browser.get("http://www.google.com") # This does not throw an exception if it got a 404 html = browser.page_source print html # If this outputs more than just '<html><head></head><body></body></html>' you know that it worked