问题描述
完全重写:
我的愿景:将电子邮件,学生ID,密码和所需的课程作为参数用于heroku脚本的Web界面。然后,一旦现场开放,使用heroku上的webdriver注册(使用大学学生门户),然后通过电子邮件发送结果(成功:入门,失败:现场不再开放,将继续尝试)。
这是事情:我在本地计算机上创建了它,它的功能就像一个魅力。我使用硒和镀铬汽油,并有一个盛大的旧时光。
但是:我如何才能在heroku上得到这个?我的选择似乎是:硒与ghostdriver,casperjs,phantomjs,请求(HTTP为HUmans)。屏幕截图对于调试是很好的,但绝对必要。
最好根据什么标准:可扩展性,轻量级,易于构建速度快(注册时间为10月27日如果你需要在你的应用程序中使用Javascript,或者只是发现脚本浏览器更容易,而不是使用JavaScript来编写脚本请求
或 urllib2
,一个无头浏览器是一个好方法。我个人推荐 phantomjs
,因为它很容易在node,js或python中使用。
您将需要一个自定义的buildpack,这是安装相当容易,的。请注意,这需要雪松堆叠。
以下是 以下是buildpack repo自述文件中的示例设置代码:
$ heroku上创建--stack雪松-14 --buildpack https://github.com/ddollar/heroku-buildpack-multi
$ echohttps://github.com/ddollar/heroku-buildpack-apt>> .buildpacks
$ echohttps://github.com/srbartlett/heroku-buildpack-phantomjs-2.0.git>> .buildpacks
$ cat<< EOT>> Aptfile
libicu52
中的libjpeg8
libfontconfig
libwebp5
EOT
$ GIT中推Heroku的主
希望有所帮助!
Reworded completely:
My vision: Web interface that takes email, student ID, password and desired class as parameters for heroku script. And then once a spot is open, use a webdriver on heroku to register them (using university student portal) and then email them the result (success: you got in, failure: spot was no longer open, will keep trying).
Here's the thing: I have made this on my computer locally and it works like a charm. I used selenium and chromedriver and had a grand old time.
But: How can I get this on heroku? My options seem to be: selenium with ghostdriver, casperjs, phantomjs, Requests (HTTP for HUmans). Screenshots would be nice for debugging but absolutely necessary.
"Best according to what criteria": Scalability, lightweight, easy to build fast (registration is two weeks from October 27 (today) )
If you're needing to use Javascript in your application or just find it easier to script a browser than using requests
or urllib2
, a headless browser is a good way to go. I'd personally recommend phantomjs
as it's quite easy to use in node, js, or python.
You'll need a custom buildpack, which is fairly easy to install, here's a good one. Note, this requires the cedar stack.
Here's a bit of info on adding a buildpack.
And here's example setup code from the README of the buildpack repo:
$ heroku create --stack cedar-14 --buildpack https://github.com/ddollar/heroku-buildpack-multi
$ echo "https://github.com/ddollar/heroku-buildpack-apt" >> .buildpacks
$ echo "https://github.com/srbartlett/heroku-buildpack-phantomjs-2.0.git" >> .buildpacks
$ cat <<EOT >> Aptfile
libicu52
libjpeg8
libfontconfig
libwebp5
EOT
$ git push heroku master
Hope that helps!
这篇关于为了我的目的,在heroku上无所畏惧地驱动浏览器的最佳方式是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!