I would like to set the wifi status on ios and in order to do that, I need to to swipe up from the bottom the Control Center.
dimension = driverWrapper.getIo
Swipe method Criteria(Only for IOS) to avoid this error
0 < startx + endx < width
0 < starty + endy < Height
Pragmatic permanent solution
For to simplify our day to day life, write down a function like this
public void swipeFinger(startx, starty, endx, endy, duration) {
driver.swipe(startx, starty, startx - endx, starty - endy, duration);
}
RCA for Error: VerboseError: point is not within the bounds of the screen
Issue is endx and endy input parameters of the driver.swipe method is implemented differently for IOS.
It is actually deltaX and deltaY for IOS.Look at this image and Consider your finger is at the origin(intersection of both axis).
If you want to swipe your finger down or Right side you need to pass positive endx and endy positive value and if you want to swipe down to up or right to left you need to pass negative value of pixels you want to swipe your finger.
20 pixel Right Swipe
driver.swipe(startx, starty, 20, 0, duration)
because you do not want to move your finger in vertical direction so y is always zero!
20 pixel Down Swipe
driver.swipe(startx, starty, 0, 20, duration)
because you do not want to move your finger in Horizontal direction so x is always zero!
Now UP and Left swipe actions
20 pixel UP Swipe Action
driver.swipe(startx, starty, 0, -20, duration)
20 pixel Left Swipe Action
driver.swipe(startx, starty, -20, 0, duration)
JavascriptExecutor executor = driver;
executor.executeScript(
"target.frontMostApp().mainWindow().dragInsideWithOptions({startOffset:{x:0.5, y:0.1}, endOffset:{x:0.5, y:0.7}, duration:0.8});");
Check if this works .. if not try to reduce the y:0.01 further.
Python version for iOS10 with Appium 1.6.5:
def swipe_up(self):
logging.info("swipe up")
sleep(1)
window_size = self.driver.get_window_size() # this returns dictionary
sleep(1)
el = self.driver.find_element(*self.configuration.CommonScreen.WEB_VIEW)
action = TouchAction(self.driver)
sleep(1)
start_x = window_size["width"] * 0.5
start_y = window_size["height"]
end_x = window_size["width"] * 0.5
end_y = window_size["height"] * 0.5
action.press(el, start_x, start_y).wait(100).move_to(el, end_x, end_y).release().perform()
sleep(1)
For iOS9 You need to change wait to 1000.