Automation in non-rooted android smartphone

Can we automate in non-rooted android smartphone using any script remotely?

Like automatically open Gmail and send email to someone??

The only thing I can think of is to make a custom script and run it as an APK, or try something in UserLAnd. https://play.google.com/store/apps/details?id=tech.ula

If you care at all about your privacy I wouldn’t install UserLand (or google play for that matter but Idon’t want to ramble).

Read carefully through their user agreement.