Unable to swipe screen

driver.swipe(300 ,300, 700, 700, 0.8)

Traceback (most recent call last):
File “C:/Users/yufei/Desktop/Python/C_Appium.py”, line 50, in
driver.swipe(300 ,300, 700, 700, 0.8)
File “build\bdist.win-amd64\egg\appium\webdriver\webdriver.py”, line 242, in swipe
File “build\bdist.win-amd64\egg\appium\webdriver\common\touch_action.py”, line 94, in perform
File “C:\Python27\lib\site-packages\selenium\webdriver\remote\webdriver.py”, line 195, in execute
self.error_handler.check_response(response)
File “build\bdist.win-amd64\egg\appium\webdriver\errorhandler.py”, line 29, in check_response
selenium.common.exceptions.WebDriverException: Message: An unknown server-side error occurred while processing the command.

Hi Momo,
In this post, I have posted more safer approach of taking screen size and then calling swipe.
Scroll functionality using loop
Hope this helps!

Hi RamS

I have solved the problem.thanks!

How did you did it? please post your solution

What is your problem? Post your swipe code, error, versions you use, simulator or real device, android or ios

Im using an iphone 4s, my app is hybrid and im getting this error:

Error
Traceback (most recent call last):
File “C:\Users\QA\PycharmProjects\BantasyTestSuite\BantasyTestSuite_modified_new_design.py”, line 2548, in runTest
touch.flick_element(el1, 0, -1000, 5).perform()
File “C:\Python27\lib\site-packages\selenium-2.43.0-py2.7.egg\selenium\webdriver\common\touch_actions.py”, line 29, in perform
action()
File “C:\Python27\lib\site-packages\selenium-2.43.0-py2.7.egg\selenium\webdriver\common\touch_actions.py”, line 166, in
‘speed’: int(speed)}))
File “C:\Python27\lib\site-packages\selenium-2.43.0-py2.7.egg\selenium\webdriver\remote\webdriver.py”, line 173, in execute
self.error_handler.check_response(response)
File “C:\Python27\lib\site-packages\appium\webdriver\errorhandler.py”, line 29, in check_response
raise wde
WebDriverException: Message: u’An error occurred while executing user supplied JavaScript.’

Im using appium 1.4.8 dmg, appium-python-client 0.17. Thank you

Well, I never used python. Lets try a give you a valid response.

Have you tried speed at 0? With 5 that means a speed of 5 pixels per second and you requesting 1000 offset.

Mainly, any reason why you use selendroid TouchActions instead of appium TouchAction? like

action = TouchAction(self.driver)
el = self.driver.find_element_by_name('Something')
action.press(el).move_to(x=100, y=-1000).release().perform()

or the driver swipe:

driver.swipe(100, 500, 100, 100, 800)

The method is def swipe(self, start_x, start_y, end_x, end_y, duration=None)

Appium TouchAction did not work for me but it was not the method you describe i used back then, ill try your suggestion and let you know. Thanks in advance.

Im getting this error with the first suggested method.

Error
Traceback (most recent call last):
File “C:\Users\QA\PycharmProjects\BantasyTestSuite\BantasyTestSuite_modified_new_design.py”, line 1847, in runTest
appium_actions.press(entry_fee_filter_first).move_to(x=swipe_value, y=0).release().perform()
File “C:\Python27\lib\site-packages\appium\webdriver\common\touch_action.py”, line 94, in perform
self._driver.execute(Command.TOUCH_ACTION, params)
File “C:\Python27\lib\site-packages\selenium\webdriver\remote\webdriver.py”, line 196, in execute
self.error_handler.check_response(response)
File “C:\Python27\lib\site-packages\appium\webdriver\errorhandler.py”, line 29, in check_response
raise wde
WebDriverException: Message: Not yet implemented. Please help us: http://appium.io/get-involved.html

I cant try the second method because i need to swipe/scroll from an especific element.

If you wish to swipe to a specific element - add a logic to check for the element after each swipe. Added my function here, check if it helps:

    def android_is_visible(self, locator):
    for _ in xrange(15):
        x = 1000
        try:
            value = self.get_element(locator).is_displayed()
            if value is True:
                break
        except NoSuchElementException:
            self.driver.swipe(470, 1400, 470, x, 400)
            self.driver.implicitly_wait(5)
            continue

with python i see below error and scrolling is not working for me
driver.swipe ( a, b, c, d )
/Library/Python/2.7/site-packages/appium/webdriver/webdriver.py:264: in swipe
action.perform()
/Library/Python/2.7/site-packages/appium/webdriver/common/touch_action.py:94: in perform
self._driver.execute(Command.TOUCH_ACTION, params)
/Library/Python/2.7/site-packages/selenium/webdriver/remote/webdriver.py:308: in execute
self.error_handler.check_response(response)


self = <appium.webdriver.errorhandler.MobileErrorHandler object at 0x101d68410>
response = {‘status’: 500, ‘value’: ‘{“status”:13,“value”:{“message”:“An unknown server-side error occurred while processing the command.”},“sessionId”:“fe33d29e-8758-4619-81cc-f9326c92c143”}’}

def check_response(self, response):
    try:
        super(MobileErrorHandler, self).check_response(response)
    except WebDriverException as wde:
        if wde.msg == 'No such context found.':
            raise NoSuchContextException(wde.msg, wde.screen, wde.stacktrace)
        else:
          raise wde

E WebDriverException: Message: An unknown server-side error occurred while processing the command.

/Library/Python/2.7/site-packages/appium/webdriver/errorhandler.py:29: WebDriverException


appium version : 1.2.6
python 2.7
mac