agnivade/wasmbrowsertest

Is there away to click "OK" on an alert window?

Closed this issue · 2 comments

Great project. I am toying around with wasm/golang and wanted to use your tool to write tests for a POC I am working on.

I have a go function that is calling alert("some message") in the browser in a failure condition and that makes the test hang when I call that function. Is there any way I can click the OK button on the pop-up that appears?

You can run any JS code from inside Go by calling the Global function. For example: https://github.com/agnivade/shimmer/blob/d08fb873f760d93922e97085a792539e714df4a9/load_image_cb.go#L27-L34

Unless you really need a visual indicator, you could just set some variable to true/false and check that from Go.

Closing. Let me know if you need more help.