1

I am trying to slide UIASlider. Below is the script.

var target = UIATarget.localTarget();
var app = target.frontMostApp();
var window = app.mainWindow();

UIALogger.logMessage( "Value Before: " + window.sliders()[0].value() );
window.sliders()[0].dragToValue( 0.5 );
UIALogger.logMessage( "Slider: " + window.sliders()[0].isValid() );
UIALogger.logMessage( "Value After: " + window.sliders()[0].value() );

Script is running without any error but slider not sliding. Log:

Value Before: 0%
target.frontMostApp().mainWindow().Sliders()[0].dragToValue("0.5");
Slider: true
Value After: 0%

Any idea what I'm doing wrong?

EDIT

Objective-C Code

- (void)viewDidLoad
{
    [super viewDidLoad];
    [self.slider setThumbImage:[UIImage imageNamed:@"349-volume-slider@2x"] forState:UIControlStateNormal];
    [self.slider setThumbImage:[UIImage imageNamed:@"349-volume-slider@2x"] forState:UIControlStateHighlighted];
    [self.slider setThumbImage:[UIImage imageNamed:@"349-volume-slider@2x"] forState:UIControlStateSelected];
    [self.slider setMaximumTrackImage:[UIImage imageNamed:@"transparentTrackImage"] forState:UIControlStateNormal];
    [self.slider setMinimumTrackImage:[UIImage imageNamed:@"transparentTrackImage"] forState:UIControlStateNormal];
    // Do any additional setup after loading the view, typically from a nib.
}

I made a testing project and added this code only. then i find out if i set minimum and maximum track image then slider stop sliding. This can be bug or anything else ? Using X-Code 5

Omer Obaid
  • 416
  • 1
  • 6
  • 24
  • Omer, I made a single view app with a slider and run your automation script. Slider is sliding for me, so the script is functional. To investigate further, provide minimum project code and versions of your environment. – paiv Jun 04 '14 at 10:50
  • @paiv Thank you for your response. i have added code. Hoe you can see edit – Omer Obaid Jun 04 '14 at 12:03
  • Omer, still everything works fine for me. What iOS version do you test on? Simulator or on device? – paiv Jun 04 '14 at 18:13
  • Do you get errors in Instruments while running the script? – paiv Jun 04 '14 at 18:23
  • Testing on iOS 7 iphone 4s. 'Unexpected error in -[UIASlider_0x17ec88f0 dragToValue:], /SourceCache/UIAutomation/UIAutomation-365/Framework/UIAItemElements.m' Im not sure what is this. Error in script or what... cuz slider isn't just sliding everything else doing great. – Omer Obaid Jun 05 '14 at 05:28
  • Sorry, I have no idea. Try closing the apps, and moving /SourceCache/UIAutomation away temporary. – paiv Jun 05 '14 at 15:01

1 Answers1

2

Yes it is known bug, depending on your iOS testing environment and instrument version it can go from not sliding at all to sliding to an incorrect value. Some folks have filled up a bug report. Seems to be the same for dragInsideWithOptions and dragFromToForDuration.

You are not alone with that problem.

Try out Xcode 6 to see if it has been solved by apple

Community
  • 1
  • 1
Gomino
  • 12,127
  • 4
  • 40
  • 49