I tried using the method you mentioned: try an operation on an element and appium handles the scroll to the element.
It doesnt work for my python client. If the elment is not in the field of view( which is why we need a scroll) it raises : NoSuchElementException: Message: An element could not be located on the page using the given search parameters.
I also tried using the below but to no avail:
scrollobj=dict(direction="down", element=self.driver.find_element_by_name("SUITS & BLAZERS"))
self.driver.execute_script("mobile: scrollTo",scrollobj)
Error:
ERROR: testcategory_men (main.TestHomeScreendisplay)
Traceback (most recent call last):
File "android_piQit.py", line 65, in testcategory_men
scrollobj=dict(direction="down", element=self.driver.find_element_by_name("SUITS & BLAZERS"))
File "/Library/Python/2.7/site-packages/selenium-2.46.0-py2.7.egg/selenium/webdriver/remote/webdriver.py", line 324, in find_element_by_name
return self.find_element(by=By.NAME, value=name)
File "/Library/Python/2.7/site-packages/selenium-2.46.0-py2.7.egg/selenium/webdriver/remote/webdriver.py", line 684, in find_element
{'using': by, 'value': value})['value']
File "/Library/Python/2.7/site-packages/selenium-2.46.0-py2.7.egg/selenium/webdriver/remote/webdriver.py", line 195, in execute
self.error_handler.check_response(response)
File "/Library/Python/2.7/site-packages/Appium_Python_Client-0.14-py2.7.egg/appium/webdriver/errorhandler.py", line 29, in check_response
raise wde
NoSuchElementException: Message: An element could not be located on the page using the given search parameters.
Could you suggest aby other alternative. Like you said it is still a achallenge in appium for python clients. I have tried using many alternatives and while most dont work, the ones that do, do not have any effect on the native app.
I tried using the operation : driver.press(x=100,y=100).move_to(x=100,y=300).release().perform()
using valid cordinates and even though the code worked flawlessly,the screen did not show any signs of scroll.