fhoeben/hsac-fitnesse-fixtures

How to start chrome with json capabilities

Closed this issue · 4 comments

If I were to use script table in wiki page and start chrome with json capabilities how can I do that?
I see this option available only with jUnit test suites when running with override selenium settings. But I want to exercise this in interactive fitnesse mode when using fitnesse standalone.

This is what is available:
image

But this is what I am looking for:
image

At the moment I don't believe this is possible. But I don't quite understand why this would be desirable. What the jUnit logic does is parse the JSON string to a Map and then pass that Map to the startDriverWithProfile method. So this is exactly the same as what is in your 'This is what is available' screenshots.

Yes, I agree jUnit configuration provides this option but unfortunately, we can't use jUnit configs. We need to rely on FitNesse standard method of execution which is using standalone JAR. That is why we want to keep all selenium browser configurations in the fitnesse wiki.
I asked because the json capabilities option is available in the wiki's when using grid but not with standalone browsers.

image

No my point was that the JSON option offers no advantage over specifying a map via the wiki. Why do you want to use JSON instead of just defining the map via MapFixture?

Anyway, you can use JsonFixture to parse the JSON string and then pass it to SeleniumDriverSetup.

Something like:

|script|json fixture                            |
|load  |!-{"args":["headless", "disable-gpu"]}-!|
|$a=   |json path|$                             |

|script          |selenium driver setup |
|start driver for|chrome|with profile|$a|

In this example I load the JSON from the wiki, but you could also load it from a file, which might be better if you want to use the same config in a CI run as it allows you to have the same content in the browser as via the command line.

Thanks @fhoeben.
The map fixture is working fine. We were just trying to simplify it by passing the entire script from command line or using a file as you described. I think json fixture solution serves our purpose.
Thanks!