News for hackers. Stuff that matters.
Re:Ask HN: What automation tools have you used to replace mu... by dhruvkar on Monday February 17, 2020 @12:17AM (#22345768)
>>my goodness, it'd be slow and potentially flaky all via the web UI for those sites

Generally, I've had better luck using undocumented APIs for this kind of stuff. I was a heavy user of Selenium to automate many a task (I work in wholesale construction goods, tons of automations needed everywhere).

But then discovered that using internal APIs (which surprisingly don't change much) is far easier than trying to exception manage changing UIs.

Open up dev tools on your browser and watch the GETS/POSTS as you complete your daily tedium. I use Python (usually just requests and beautifulsoup is enough) to mimic the calls and I have yet to find a use case where I wasn't able to automate something online.

I'm currently developing an SDK for our 18th-century ERP system, which has no API. I've also automated getting shipping container tracking data from a various shipping lines and railroad company websites, many with complicated login processes.

Happy to chat, email in profile.

Re:Ask HN: What automation tools have you used to replace mu... by ctrl4 on Monday February 17, 2020 @08:38AM (#22347574)
Yup. I did this with a local Android app, that tells you the gps location of a public bus. I sniffed the http packets, found the requests i needed and made a python script that pinged me at slack when my bus was 5 minutes from my bus stop. Useful when I worked at night.
Re:Ask HN: What automation tools have you used to replace mu... by spikej on Thursday February 20, 2020 @12:05AM (#22372822)
I'm familiar with the web dev tools, but no clue about mobile. Can you point me in the right direction on how to do the same?

Were you using an android emulator on desktop or there's some way to easily do this on android?

Re:Ask HN: What automation tools have you used to replace mu... by dhruvkar on Monday February 24, 2020 @12:12AM (#22401833)
I use mitmproxy or charles proxy with an android emulator, with an older version of Android so it allows for a man-in-the middle, without being finicky about certificates.
Re:Ask HN: What automation tools have you used to replace mu... by dhruvkar on Monday February 17, 2020 @12:38PM (#22349172)
Nice, that's the next step up.

Man-in-the-middle Android apps to discover (sometimes different API backend).

I did the same with a shipping line which turned out to use a SOAP backend.

Re:Ask HN: What automation tools have you used to replace mu... by beatthatflight on Monday February 17, 2020 @08:40PM (#22352696)
(Facepalm)

I read your post.

Paused.

Opened up debugger on the site I'm currently selenium-ising.

reloaded.

boom. there it is. The request, and beautiful json response.

So...so..so much simpler.

Thank you, my evening is sorted ;)

Re:Ask HN: What automation tools have you used to replace mu... by dhruvkar on Monday February 17, 2020 @09:38PM (#22352979)
Haha.. love it, I'm so glad it helped.

I had the same experience a couple years ago after spending months selenium-ing our ERP software.

Re:Ask HN: What automation tools have you used to replace mu... by beatthatflight on Thursday February 20, 2020 @03:28PM (#22378275)
finally got to it last evening. 20 minutes of playing with json libraries, and I've got a ~10 line script that runs in under a second and produces output that would have taken probably a minute to run in selenium and occasionally been flaky too.

/starts looking at other APIs to use!

Thanks!

Re:Ask HN: What automation tools have you used to replace mu... by dhruvkar on Monday February 24, 2020 @12:13AM (#22401840)
Awesome! enjoy the rabbit hole :D
Re:Ask HN: What automation tools have you used to replace mu... by 2rsf on Monday February 17, 2020 @03:24AM (#22346306)
Good point, using the APIs directly is the also the corner stone of stable test automation
Re:Ask HN: What automation tools have you used to replace mu... by tech_tuna on Wednesday February 19, 2020 @06:17PM (#22371187)
Ha ha, yep. I do this kind of thing all the time.