0

I have a table cell element with a static text, like this:

[UIATableCell] Your height > [UIAStaticText] Your height

When I click on this table cell, there is a [UIAPicker] with 2 [UIAPickerWheel], one is number, one is "cm".

I want to set value for this table cell of height, so my code is below:

// enter height
iosDriver.findElement(By.xpath("//UIATableCell[1]")).click();
iosDriver.findElement(By.xpath("//UIAPickerWheel[1]")).sendKeys("178");
// click Done button to close the picker
iosDriver.findElement(By.xpath("//UIAToolbar[1]/UIAButton")).click();

It works with sendKeys, but the problem is that it's scrolled very slow until it reaches the value "178", so the test is slowed down if I want to enter a high number.

I tried with setValue from IOSElement, like this:

(IOSElement) iosDriver.findElement(By.xpath("//UIAPickerWheel[1]")).setValue("178");

it didn't really work: it entered number 178 outside of this table cell and kind of destroy the layout, and still opened the picker.

So I'd stick with sendKeys. Is there a way to make sendKeys faster or another way to enter value in this case. Thanks in advance

Ragnarsson
  • 1,715
  • 7
  • 41
  • 74
  • Did you try clicking on the picker prior to sendKeys.`iosDriver.findElement(By.xpath("//UIAPickerWheel[1]")).click()` – Naman Mar 03 '16 at 14:32
  • @nullpointer: Yeah, I tried what you suggested, but unfortunately, it didn't work :(, the pickerwheel was still scrolled step-by-step until it reached the goal number, like real user does. Is it because of table cell behaviour or something else? – Ragnarsson Mar 03 '16 at 14:52
  • 1
    If the picker acts in that manner manually as well I probably believe that's the correct behaviour then. – Naman Mar 03 '16 at 15:09
  • Thanks @nullpointer, appreciate your time and help. This behaviour is really irritating ... – Ragnarsson Mar 03 '16 at 15:22
  • look at it this way, you automate things that are there happening manually, if the behaviour of the app is manually the same, the automation suite holds no bad. Ofcourse if its irritating then something could be changed from the application code's perspective to improvise on it. – Naman Mar 03 '16 at 15:25

0 Answers0