https://kotlinlang.org logo
Title
n

Nezteb

08/09/2019, 4:32 PM
So I end up using https://github.com/GoogleChrome/puppeteer a lot for browser automation, but it requires JS. Is there a Kotlin alternative? I’d rather avoid Selenium if I can. Are there any fancy modern libraries for browser automation in Kotlin?
j

jw

08/09/2019, 4:34 PM
You could create Kotlin
external
declarations for its API and then compile with Kotlin/JS
I have a Chrome extension written in 100% Kotlin by doing this for the Chrome platform APIs. I actually planned on doing it for puppeteer eventually as well so that I could test the extension integration.
n

Nezteb

08/09/2019, 4:41 PM
Ooo do you have a link to said extension? Or a blog/tutorial on writing Kotlin wrappers for JS APIs?
Don't know of any resources, unfortunately. Been fakin' it until I made it. There's #javascript that's here to help though.
t

tipsy

08/09/2019, 7:31 PM
I’d rather avoid Selenium if I can
how come?
n

Nezteb

08/14/2019, 9:01 PM
In my purely anecdotal experience Selenium is slow and janky. Its wait API is also a pain to use. By comparison Puppeteer is a joy to work with.