0

I have a text view with message let's say "Only this portion of the message can be clicked",where "this portion" has a clickableSpan attached to it. Is there a way I can touch only on the portion which has clickable span in the message, to verify the next scenarios.

The text view looks like this:

[{"id"=>"message",
"enabled"=>true,
"contentDescription"=>nil,
"class"=>"com.xyz.mobile.android.view.WhitneyBookTextView",
"text"=>
 "Only this portion of the message can be clicked.",
"rect"=>{"center_y"=>934.5, "center_x"=>381.0, "height"=>67, "y"=>901, "width"=>598,"x"=>82},
"description"=>
 "com.xyz.mobile.android.view.WhitneyBookTextView{231r6178 VFED..CL ........ 42,0-640,67 #6f094a app:id/message}"}]

Is there a way it can be clicked?

touch(query("* id:'message'")) does not work.

Infant Dev
  • 1,659
  • 8
  • 24
  • 48
  • Have you tried something like: tap_mark "this portion". I haven't tested your example so this is merely a suggestion. – Lasse Sep 17 '14 at 12:36

3 Answers3

1

Perhaps you could use the offset function, assuming that still works. On calabash for iOS you can do

touch("view marked:'First'", :offset => {:x => 50, :y => 0})

This will find the center of the view marked "First" and then touch 50 pixels to the right of it.

Will that help you, even it is ugly and hardcoded...

Lasse
  • 1,153
  • 1
  • 10
  • 21
0

You could try touch(query("WhitneyBookTextView {text LIKE[c] '*this portion*'}")).

If that doesn't work, e.g. the tap still occurs at another spot, you could try adding an offset as Lasse has suggested.

Community
  • 1
  • 1
Noffica
  • 469
  • 8
  • 23
-1

Its a simple problem. You can either select a particular element based on its "id" or the "text" If the id : message is not used anywhere else then

touch("* id:'message'")

or

touch("android.view.WhitneyBookTextView id:'message'")

should work.

sanoop sandy
  • 534
  • 3
  • 12