Forum Discussion

Petewilson's avatar
Petewilson
Contributor
5 years ago
Solved

iOS menu appears after a higher option is selected, but TC can't see it.

Hello all, i am hoping someone can  point me in the right direction of an issue i am having with testing an iOS app.

 

I have a menu down the left hand side. Dependant on what has been selected, the left hand menu can change.

 

On the app it has a Wall Height and when it is over a certain height a option appears at the bottom of the left hand nav.

 

My script basically reuses 2 procedures and searches the Left Hand Nav for the item label working bottom up, and this works for all options apart from this options that appears at the end after being activated higher up.

 

When debugging i noticed that the check for the label starts the one above and doesn't even start at the now new bottom label, but the original last label.

 

Is there any way to have TC capture the new left hand menu list?

 

 

procedure SetLeftHandMenu(MenuName : String; ControlName : String; Driver: OleVariant);
var
  LeftHandOption                    : OleVariant;
  Value                             : OleVariant;
begin
  Value := Project.Variables.Driver.Value(ControlName);
  If Value <> 'Blank' then 
  begin
    LeftHandOption := FindMenuLabel(MenuName);
    if LeftHandOption <> nil then
    begin
      LeftHandOption.Touch;
    end;
  end;  
end;

 

function FindMenuLabel(MenuName: String) : String;
var
  I: Integer;
  MenuValue;
begin
  Result:=nil;
  Aliases.Device.processApplication.window0.tableview0.Refresh;
  MenuValue := Project.Variables.Driver.Value(MenuName);
  if MenuValue <> 'Blank' then
  begin
    Delay(1000);
    for I:=0 to cleftnavtable.ChildCount -1 do
      if cleftnavtable.Child[I].Label.ab_text = MenuValue then
      begin
        Result := cleftnavtable.Child[I];
        break;
      end;
  end;
end;
  • I have resolved this by changing my script left nav search to the below. Much faster and more stable with changing menus than my previous method.

     

    procedure Find_Label_Touch(ControlName : String; Driver: OleVariant);
    var
      target_CollectionView;
      target_Label;
      Value;
    begin
      Value := Project.Variables.Driver.Value(ControlName);
      If Value <> 'Blank' then 
      begin
        target_CollectionView := Aliases.Device.processApplication.window0.tableview0;
        target_Label := target_CollectionView.Find( ['ObjectType', 'ObjectText'], ['Label', Value], 20000);
        target_Label.Touch();
      end;
    end;

1 Reply

  • I have resolved this by changing my script left nav search to the below. Much faster and more stable with changing menus than my previous method.

     

    procedure Find_Label_Touch(ControlName : String; Driver: OleVariant);
    var
      target_CollectionView;
      target_Label;
      Value;
    begin
      Value := Project.Variables.Driver.Value(ControlName);
      If Value <> 'Blank' then 
      begin
        target_CollectionView := Aliases.Device.processApplication.window0.tableview0;
        target_Label := target_CollectionView.Find( ['ObjectType', 'ObjectText'], ['Label', Value], 20000);
        target_Label.Touch();
      end;
    end;