Best practices for handling multiple registration flows/layouts in one script?

xNoname

Новичок
Регистрация
11.09.2024
Сообщения
12
Благодарностей
0
Баллы
1
Hey everyone,
I'm working on a registration script, but I'm running into issues when the app I'm automating has several possible flows or UI layouts during account creation.

For example:

  • Sometimes the button says "Get Started",
  • Other times it's "Create Account",
  • Occasionally a popup appears asking for permissions (e.g. "Don't allow"),
  • Then the form with first name, last name, password shows up – but even this screen can vary in layout or order.

Here's how I'm currently handling it:

When the element appears, the bot clicks it.
Then it checks for the next possible button or screen in the same way — block by block.


This approach works functionally, but the problem is that sometimes I have to scroll through 5–6 text blocks (using Check Element Exists) just to get to the correct clickable button, which turns a 3-second flow into a 10-second one.
And this happens on multiple screens across different registration variants.


I also tested Check Text (OCR) briefly, but I’m not using it in my current implementation. The problem was that sometimes layout loaded too slow and OCR found the same element like before and it broke script.
My questions:

  • Is it OK to rely on chained XPath checks like this? Or is there a cleaner way to structure multi-path flows?
  • Would Get Text give more accurate screen detection?
  • How do you structure logic for variable UI flows – long chain or clear stage-based logic?
  • What’s the best way to avoid unnecessary processing time (e.g. when checking multiple possible elements)?


I’m currently automating 10 real Android phones in parallel, but I sometimes notice that the script:


  • fails at points where it shouldn’t,
  • or can’t detect a button that normally works, even when I’ve already prepared 3 layout variants.

Example: Facebook’s post-login menu — I’ve recorded 3 different UI versions, and still, sometimes something new shows up and breaks the logic.


So I'm looking for a way to build scripts that are:


  • fast and efficient,
  • resistant to layout changes,
  • and context-aware (don’t waste time scanning irrelevant blocks).
Any advice, feedback, or examples are much appreciated
 

lokiys

Moderator
Регистрация
01.02.2012
Сообщения
4 886
Благодарностей
1 197
Баллы
113
Hi,

In general, your logic seems correct. You check, Text, Element or any other parameter you can find that indicate particular interface and then using Switch execute logic developed for that interface.

Fast and efficient, = You have to do everything in C#, to have FULL control of every step you make. Default actions are for the best quality, so they will better wait for execution than fail. Adding some unnecessary delay sometimes. In C# you can control every aspect. Unfortunately, in ZennoDroid not ALL actions is possible to write in c# So you have to do the best you can.

resistant to layout changes = That's not possible. If you don't have a logic for a particular layout, then you don't have and it will fail. All You can do is make some workarounds. Like, for example, in your pop-up case, sometimes reloading helps. Or going to some other page. Basically, there is no such think as universal "click button logic" that will work in ALL cases. Every site, and even every place on site, are different and requires a different approach.
 

Кто просматривает тему: (Всего: 0, Пользователи: 0, Гости: 0)