1

One of my tests is to press on a link.

The problem is that the link is part of the sentence: “to login, press here” (the “here” is the link).

It won’t work if I’m trying to touch the sentence itself. -> touch(query(“* text:’ to login, press here’”))

Any idea how can I touch the link only?

Tried to use the x/y positions, but tested it on other Android devices and it won’t work correctly (resolution issue).

The query(“*”) result:

`"id" => nil,
           "enabled" => true,
"contentDescription" => nil,
              "text" => to login, press here",
           "visible" => true,
               "tag" => nil,
       "description" => "md5434416eb11d5314a89721b66815c1e97.RichText{52847bcc VFED..CL ......I. 0,805-1080,1014}",
             "class" => "md5434416eb11d5314a89721b66815c1e97.RichText",
              "rect" => {
    "center_y" => 984,
    "center_x" => 540,
      "height" => 209,
           "y" => 880,
       "width" => 1080,
           "x" => 0`

Your thoughts?

Nir Ortal
  • 77
  • 12

1 Answers1

0

Have you tried this ? :

Then /^I touch the "([^\"]*)" text$/ do |text|
      tap_when_element_exists("* {text CONTAINS[c] '#{text}'}")
    end

can you provide me more info in what container it is would like to see what is above and under this. Thank You ;)

Hikaryu
  • 317
  • 5
  • 17
  • that's won't work - it will try to touch the middle of the sentence and not in the end of the sentence (where is the link located) --- I added 'show touches' option to the device and i see that it is trying to touch there. thx! – Nir Ortal Oct 04 '15 at 08:34
  • np. mate at least i help that much ;) – Hikaryu Oct 07 '15 at 07:12
  • @NirOrtal How to resolve it ? Can you share me more detail because I'm invest in this case. Thanks ! – Bulma Oct 08 '15 at 01:38
  • I created a non-elegant solution. I hope it will help-still looking for a different solution and when I find it I will update the thread: First I found the ‘y’: `y = query(“* text:’ to login, press here’”) [0]['rect']['y']` Then I found the ‘x’ size of the device: `xx = query(“* text:’ to login, press here’”,:width)[0]` Now, I know that the link is located around ¼ size of the width from the left: `x = xx/4` And then I press on it: `perform_action('long_press_coordinate' , x , y)` Tried that on 2 different device resolutions: 1080x1920 and 720x1280 and on both of them it works fine. Thank you, – Nir Ortal Oct 08 '15 at 06:00