daveenguyen / atomacos

Automated Testing on macOS
https://daveenguyen.github.io/atomacos/
GNU General Public License v2.0
47 stars 13 forks source link

regex/substring match in `.findFirst` methods and similar? #10

Closed gderosa closed 4 years ago

gderosa commented 4 years ago

Hi, I have code like this:

my_menu.AXChildren[0].findFirst(AXTitle='Preferences\u2026')

which works fine but relies on exact string match (with an Unicode hellipsis character, which tomorrow may be replaced with three dots or mothing at all).

It would be great to be able to match by regex or substring and/or in a case insensitive manner etc.

Because what I want is just clicking "Preferences" :)

I know I can probably findAll() and then iteratively match, but perhaps there's a better way?

Thanks!

daveenguyen commented 4 years ago

IIRC can be used as wildcard. so `AXTitle="Preferences"` should work

https://github.com/daveenguyen/atomacos/blob/master/tests/test_atomacos.py#L136

On Tue, Feb 4, 2020 at 2:19 AM Guido De Rosa notifications@github.com wrote:

Hi, I have code like this:

my_menu.AXChildren[0].findFirst(AXTitle='Preferences\u2026')

which works fine but relies on exact string match (with an Unicode hellipsis character, which tomorrow may be replaced with three dots or mothing at all).

It would be great to be able to match by regex or substring and/or in a case insensitive manner etc.

Because what I want is just clicking "Preferences" :)

I know I can probably findAll() and then iteratively match, but perhaps there's a better way?

Thanks!

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/daveenguyen/atomacos/issues/10?email_source=notifications&email_token=AATS73XU5VZFVMRZ6NLAJI3RBE6L3A5CNFSM4KPUG3K2YY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4IK3DW6Q, or unsubscribe https://github.com/notifications/unsubscribe-auth/AATS73X7VRNPM37MOOCNNJ3RBE6L3ANCNFSM4KPUG3KQ .

gderosa commented 4 years ago

Excellent, thank you!