0

I am using Androidviewclient version 11.5.6 and I want to search for multiple names at a time in function findVeiwwithtext function. Is it possible with AVC??

Vanraj Ghed
  • 1,261
  • 11
  • 23
  • Can you give an example of what you are trying to achieve? – Diego Torres Milano Jun 08 '16 at 15:12
  • I am using this function for operating a powerSwitch. I am curious that if the findViewWithTextOrRaise() function can search for two words like ON, OFF at a time and should accept if any of them is available. Now I am calling function as `com_csr_csrmeshdemo___id_powerSwitch = self.vc.findViewWithTextOrRaise(u'ON').touch()` – parameshwar reddy Jun 09 '16 at 06:57

1 Answers1

0

Yes, findViewWithTextOrRaise() accepts a RegexType (see re) as parameter so you can use patterns if your intention is to match more than one View.

As a starting point you can invoke culebra --use-regexps ... and it will generate statements like this

no_id26 = self.vc.findViewWithTextOrRaise(re.compile(u'Phone'))

which you can easily adapt to your needs. For example

    no_id26 = self.vc.findViewWithTextOrRaise(re.compile(u'(Phone)|(Settings)'))

this will match Phone or Settings.

Diego Torres Milano
  • 65,697
  • 9
  • 111
  • 134
  • Thank You Very much!! Works cool for my requirement. But getting error when I use re.compile with code generated by culebra GUI `$ culebra --scale=0.5 -uUG -o sript.py ` – parameshwar reddy Jun 10 '16 at 06:14
  • If you show your code and the error perhaps you can obtain some help, otherwise it's fairly impossible to guess. If this answers resolved some of your problems accept it a create a new one to keep things organized in **SO** and help others looking for same answers. – Diego Torres Milano Jun 10 '16 at 15:17
  • The code with which I am getting errors is: `self.vc.dump(window=-1) self.vc.findViewWithTextOrRaise(re.compile(u'(OFF)|(ON)')).touch() self.vc.sleep(6)` – parameshwar reddy Jun 14 '16 at 06:42