[英]how can I get raw html for a web page using javascript automator (JAX) for mac yosemite?
I figured out how to open a web page, but I want to submit a form to google and then get the html results. 我想出了如何打开网页,但是我想向Google提交表单,然后获取html结果。 how can I do this?
我怎样才能做到这一点? I want to take those page results so I can parse the data myself.
我想获取这些页面结果,以便自己解析数据。
chrome = Application("Google Chrome");
win = chrome.Window().make();
chrome.windows[0].tabs[0].url = "https://google.com";
// submit form button to search for "test"
//generated_html_from_chrome = ??
If you are genuinely wanting just the raw html of google searches, then no need to use Chrome at all; 如果您真的只想要google搜索的原始html,则根本不需要使用Chrome; just use the command line to get the text directly, using something like curl.
只需使用命令行即可直接获取文本,例如使用curl。
var mysearch = "test"
app = Application.currentApplication()
app.includeStandardAdditions = true
app.doShellScript('curl -D - https://www.google.com/#q=' + mysearch)
If you do need to be working in Chrome, we can figure that out too. 如果您确实需要在Chrome中工作,我们也可以解决。 Just say so.
只是这样说。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.