Live data from Hacker News

Show HN: Kasaya – A scripting language and runtime for browser automation

github.com

71–80 of 109 posts

Re: Show HN: Kasaya – A scripting language and runtime for browser automation

#71

Earlier quoted context omitted.

Seriously, how is this DSL better? With JavaScript you get method completion and debugging. Are parentheses really so terrible? You can setup a DSL in scala.js and you can get the best of both worlds (though, parentheses are fine for me so I would just use one of the many fine existing JS libraries).

> With JavaScript you get method completion and debugging. a) now your QA team needs to know JavaScript b) method completion is crap when you don't know the language. c) "You can setup a DSL in scala.js and you can get the best of both worlds" OMG You want to add Scala to the mix too? AND write your own DSL from scratch, and take on its maintenance to support your QA team's needs instead of leveraging an existing one…

1) if you are on a qa team writing automation, there is a high chance you already know javascript.

source: was qa automation engineer for a few years. I realize it is purely anecdotal, but nearly all of the QA people I worked with knew javascript, even the manual testers.

Re: Show HN: Kasaya – A scripting language and runtime for browser automation

#72

All those kind of projects share the same flaw: it uses a DSL instead of an existing language, so tooling/documentation/testing/support/modules are going to be very weak, and 100% depending of the creator for the first years, in a domain that is already a niche. It could be a library with good API instead. Or even a special env setup for an existing language with injected built-in and automatic imports. Now you could…

All these kinds of HN comments share the same flaw: they unnecessarily detract from the work the OP has done by attacking use cases that the project never claimed to solve. DSL's, for all their problems, do simplify complex programming logic, and people use them every day to do great things. DSL's like Ansible and Chef save people an order of magnitude of time for server provisioning hence why they are wildly popular…

I tried using Ansible once and could never escape the fact that anything complex like installing files or raising docker containers requires the use of external modules with actual code and templated YAML. Every time something "templated" shows up in a supposedly "declarative" language it feels like the designers had to add on features from an actual programming language to do what they wanted, because the DSL was too declarative and static to accomplish anything useful.

For example, look at this Azure deployment template:

https://github.com/Azure/azure-quickstart-templates/blob/65d...

Notice all the inline function calls. They basically modified JSON with their own domain-specific "functions" like "concat" and have an entire section dedicated to "variables" because in standard JSON this is not possible to express. Already this sounds like a scripting language, except terribly watered down and specific only to Azure services.

As a personal anecdote, I once made the dumb mistake of choosing a static config file instead of a dynamic one when I was developing a mod system for a game. The problem became that there were things like function callbacks that I wanted to add in, so that meant I ended up writing inline "pointers" to a place where a Lua callback existed as an identifier, instead of inlining it as Lua code, then it went through an unnecessary transpilation step to Lua data structures. My mistake was assuming that the DSL was expressive enough for my needs, which included loops, inline function callbacks and code generation, when clearly it was not.

Sometimes the effort people expend to make declarative configs work out are significant. The OpenAge project (an engine rewrite of Age of Empires II) uses a declarative language called nyan[1] which describes the changes of things like unit health or cost. It's entirely custom-made for the engine.

The moment that I realized that declarative configs were not for me was when I realized that this declarative language, which the author wrote an entire PhD thesis over and was specifically designed for the purpose of game modding, would still not be expressive for the things I was envisioning. In the end Lua, a general-purpose language that had existed for decades, was the better choice. There was no need to muck around with writing new languages or munging the declarative data into the shape I wanted - the data could just be output from a script.

On the other hand I understand if having a Turing-complete language for configuration is a bad thing because of security or too much expressiveness that hinders static analysis because of unseen edge cases. It depends on if the "scripting" features are hacks intended to get around the fundamental limitations of DSLs or a deliberately constructed featureset.

Also the reason I became so attached to declarative configs in the first place was the prospect of writing an editor frontend to interactively create new data entries. That's probably the reason Azure went with JSON instead of a programming language - they have a template editor in the web portal for filling in the parameterized variables the config declares. This is probably an ease-of-use tradeoff so people don't need to program to deploy things. As someone who uses scripts as configs, how to properly write an editor for them escapes me. I was thinking of having to parse the scripts into an AST and use heuristics to discover where data is inserted, but of course you can program anything so this won't always work.

Still, in my opinion I would choose something like Lua any day over the nth domain-specific proprietary reimplementation of 2% of JavaScript on top of JSON.

[1] https://github.com/SFTtech/nyan

Re: Show HN: Kasaya – A scripting language and runtime for browser automation

#73
post #7

We can do this with Canopy in F# (repl/interactive style too!): //go to url url "http://lefthandedgoat.github.io/canopy/testpages/" //assert that the element with an id of 'welcome' has //the text 'Welcome' "#welcome" == "Welcome" //assert that the element with an id of 'firstName' has the value 'John' "#firstName" == "John" //change the value of element with //an id of 'firstName' to 'Something Else' "#firstName" ht…

The idea of this library is exactly to not use HTML ids (or css paths etc), but use instructions you could give to an human browsing the web (enter the page, press tab, type this..)

the problem with that is anything that can 'detect' an html element based on human-language will eventually fail to find something described with human-language due to crappy html on legacy systems.

Re: Show HN: Kasaya – A scripting language and runtime for browser automation

#74
I think people often fail to grasp why natural language works for humans. It is because we can have a conversation back and forth and supplement with other things like illustrations or drawings.

That I can explain task to a programmer in natural language and that he can implement it, is only possible because he can ask questions back and gradually build up a mental model.

These natural language solutions often lack this feedback loop mechanism.

When you don’t have feedback you are better off with a more precise and more mathematical language.

Re: Show HN: Kasaya – A scripting language and runtime for browser automation

#76
I don't see how this is a scripting language and runtime; so, maybe I'm totally missing the boat and everything below is nonsense...

I think DSLs like this turn into one thing: maintenance nightmares.

I love the idea of them, I've just _never_ seen one be useful for more than a demo. Especially, for something as complex as interacting with the browser... Why not just use a visual tool and record the session with something like selenium? At this point, the idea of a "DSL" for non-programmers is pretty much a fantastic myth. I think DSLs should really only be used when they enforce quality, not to have a nicer looking statement. Same rule applies with macros, and lmao, if they aren't responsible for most DSLs.

I haven't even begun touch on the problems with errors, debugging, warnings, deprecating, updates, etc. which also come with a DSL.

The SDK setup looks an awful lot like I'm just using selenium with node and this is on-top of that entire debugging nightmare, is there more to it than that and the DSL?

As well I'm curious, how do you reliably use the web without selectors? I see it referenced, but I don't see "how," and that quite honestly seems like the coolest thing on the readme.

Again, I love the idea, it looks slick. Just based on my experiences, it seems like how nightmares, not dreams, start...

Re: Show HN: Kasaya – A scripting language and runtime for browser automation

#77
Test automaton guy here. Why reinvent the wheel? Selenium/WebDriver is already a standard (https://www.w3.org/TR/webdriver/). It has years of maturity. Maturity means that through use and development iterations it can now cater for a lot of corner cases. How to do domain authentication in IE. How to handle all the different types of modal dialogues. And so on. It can be used in several different REAL programming languages so you can interact with a database, or drop a message in a queue or call a webservive during browser interaction. I have done all of those. But sure, if you want a tool for a specific small use like a business analyst doing one linear test case, go ahead. If you don't believe all the corner cases, do yourself a favour and look under the Selenium tag on SO.

Re: Show HN: Kasaya – A scripting language and runtime for browser automation

#79

Earlier quoted context omitted.

All these kinds of HN comments share the same flaw: they unnecessarily detract from the work the OP has done by attacking use cases that the project never claimed to solve. DSL's, for all their problems, do simplify complex programming logic, and people use them every day to do great things. DSL's like Ansible and Chef save people an order of magnitude of time for server provisioning hence why they are wildly popular…

Using Ansible is what made me lose faith in DSL's in all the ways mentioned (eventually wanted loops, conditions, variables and namespaces...). Ansible is an API over a domain and if it were originally just represented through a Python language library I don't see why it would be less accessible or productive. Even something as simple as YAML can be screwed up and turned complicated.

Have you tried SaltStack?

It uses YAML too, but always felt much more cleanly composed, and smoothly integrates with scripting languages.

I've never truly broken into orchestration and am still salty about that so please, take my post with a grain of salt.

(Full disclosure: I have literally no professional affiliations whatsoever.)

Re: Show HN: Kasaya – A scripting language and runtime for browser automation

#80
Is Selenium less crashy nowadays?

Back in 2017 when I had a testing automation job, I wrote a test automation system using Node, Selenium WebDriver, Cucumber and Vagrant.

It worked well once I managed to set up a Vagrant box that would take Cucumber tests from a local directory and keep a Node, Selenium WebDriver and Cucumber install cached, but WebDriver never really stopped crashing unpredictably.

I had to implement very coarse retry logic. Tests would take way too much time just because each run a few of the tests would keep crashing for a minute or more, until they finally succeeded.

I parameterized the Vagrant box so that testers could run subsets of tests by running the "test" command with parameters, not because we had that many tests (just about a 100) but because they were so slow.

It wasn't even that complicated of a SPA, and the backend engineers even added nice classes and ID's to elements that were to be tested.

The binding of Cucumber to JS to WebDriver was flawless, adding new testing functions (e.g. "do something with some particular type of list of items"), it was just that the browser component kept crashing all. the. time.

I longed for a deterministic means of automating the browser then, preferably by hooking right into the browser code and integrating with it, so I would know why the thing kept crashing. That hasn't happened yet.

Post reply on HN