Coder Social home page Coder Social logo

Comments (2)

mykola-mokhnach avatar mykola-mokhnach commented on June 2, 2024 1

This error is expected. All touch actions-related APIs have been deprecated a while ago and removed from android and ios drivers. Consider using W3C actions or gesture shortcuts instead

from appium.

tking16 avatar tking16 commented on June 2, 2024

I think this is the functions that's causing this, just verified it works when not headless

    def scroll_to_center(self, origin_el, end_el=None):
        phone_width = self._driver.get_window_size().get("width")
        phone_height = self._driver.get_window_size().get("height")
        center_y = phone_height / 2
        if origin_el.location.get('y') > center_y:
            # if el is on bottom half of screen, swipe up a tiny bit
            self.partial_scroll(distance=150)
        else:
            # if el is on top half of screen, swipe down a tiny bit
            self.partial_scroll(direction="up", distance=150)

    def partial_scroll(self, direction='down', distance=250):
        phone_width_center = self._driver.get_window_size().get("width") / 2
        phone_height_center = self._driver.get_window_size().get("height") / 2
        actions = TouchAction(self._driver)
        if direction == 'down':
            end_loc = (phone_width_center, (phone_height_center - distance))
        elif direction == 'up':
            end_loc = (phone_width_center, (phone_height_center + distance))
        elif direction == 'right':
            end_loc = ((phone_width_center - distance), phone_height_center)
        elif direction == 'left':
            end_loc = ((phone_width_center + distance), phone_height_center)
        actions.long_press(x=phone_width_center, y=phone_height_center).move_to(x=end_loc[0], y=end_loc[1]).release()
        actions.perform()

from appium.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.