0

I figured out how to open a web page, but I want to submit a form to google and then get the html results. 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 = ??
foo
  • 3,171
  • 17
  • 18
jas
  • 580
  • 1
  • 7
  • 18

1 Answers1

1

If you are genuinely wanting just the raw html of google searches, then no need to use Chrome at all; just use the command line to get the text directly, using something like 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. Just say so.

jweaks
  • 3,674
  • 1
  • 19
  • 32