2

In Behat testing you have an context to "show last response" of a step in test scenario. This fires up a browser window with static html of last response. But running this on mac os returns an error:

sh: x-www-browser: command not found

Any idea how to setup this command to a specific browser (e.g. chrome)?

Bartek Banachewicz
  • 38,596
  • 7
  • 91
  • 135
Bartosz Rychlicki
  • 1,918
  • 3
  • 20
  • 41

2 Answers2

6

So, in a terminal on my Mac, (OSX 10.5.8), I type:

 open -a Firefox

and Firefox opens up.

When I type:

open -a opera

Opera opens up. Is this what you were looking for?

If you want the default browser to open up a web page for you, you can type:

open http://foobar.com

Reference for the more general solution.

CHEERS

happy coder
  • 1,517
  • 1
  • 14
  • 29
  • Thanks! A bit, but I need somehow to hook it up with "x-www-browser" command. Maybe alias will help? – Bartosz Rychlicki Feb 07 '13 at 10:47
  • Nope, alias does not help, still got "x-www-browser: command not found" – Bartosz Rychlicki Feb 07 '13 at 10:49
  • @BartoszRychlicki I didn't quite understand. Ok, after a bit of "duckduckgo"ing I wasn't able to find a version of x-www-browser that works on the Mac. It seems this is a Linux thing. Or is it something tied in with "behat"? I'd never heard of "behat" before your posting. CHEERS – happy coder Feb 07 '13 at 10:58
  • alias x-www-browser='open -a Chrome' (Might also be Google Chrome for Chrome, but I don't have a Mac at hand right now.) – Marc Fischer Feb 07 '13 at 11:12
  • @BartoszRychlicki Put it in a script instead. Aliases are only expanded in interactive shells. – molbdnilo Feb 07 '13 at 11:28
  • Try AppleScript, using the osascript command line tool. `man osascript` – nielsbot Feb 07 '13 at 11:33
  • I can't modify behat code and invoke something, behat is calling for x-www-browser and I need to hookup to that :/ – Bartosz Rychlicki Feb 07 '13 at 11:36
0

Try AppleScript to control the browser, using the osascript command line tool. man osascript

More here: https://stackoverflow.com/a/7276138

Community
  • 1
  • 1
nielsbot
  • 15,922
  • 4
  • 48
  • 73