Open BigWavelet opened 7 years ago
It would be impossible to seek it to particular frame/time. But you can seek it to random point & verify the expected result
maybe i can calculate the expected value according to the position of the seekbar, and then click or swipe? @SivaKranthiKumar
Yes, you can do that if it is possible :)
Hi Siva,
Can share the example how can we do this.
@sanjaykumar5115 get the seekbar co-ordinates using obj.info. No find random co-ordinates of the seekbar by just increasing/decreasing the x-axis values
Hi,
Thanks for your quick reply. we have used the same approach, but this is varying device to device. On old android version device(4.2.2) it is partially working, but on new android version device(6.0) , nothing is working. Can you share an example, which will work on every device. At lest share the an example?
I found alternative way to control seekbar, since I also found the standard methods hard to use because of some problems, so here it is, maybe it will help you:
private void clickSeekbar (float position) { while ((seekBarUiObj2 = mDevice.findObject(By.res(BASIC_SAMPLE_PACKAGE+":id/seekbar"))) == null) { mDevice.click(200,200); try { Thread.sleep(100); } catch (InterruptedException e) { e.printStackTrace(); } } Rect rect = seekBarUiObj2.getVisibleBounds(); mDevice.click(rect.left+5/pixels/+(int)((rect.right-rect.left-10/pixels/)*position), ((rect.top+rect.bottom)/2));
}
The trick is to click on the device on the desired location on the seekbar. It works. The whlle loop makes sure the seekbar is on screen, if not tap the screen on some location, which makes seekbar to appear. Then calculate the location to be clicked according to desired position. Only if your seekbar is very thin like 1 or 2 pixels it might not work.
RT!