镜像站点 · 本页由第三方 GitHub 只读镜像提供,非 GitHub 官方站点,不接受任何登录或凭据输入。前往 github.com
Skip to content

Hover on element is not working #888

Description

@pppppino

Environment:
Appium-Python-Client 2.11.1
Windows desktop app,
My Env is Ok, since I have done many automation work

I want to hover on element, I have tried:
ActionChains(self.driver).move_to_element(ele).perform(),
I got an exception:
> raise exception_class(msg=message, stacktrace=format_stacktrace(stacktrace)) E selenium.common.exceptions.UnknownMethodException: Message: Currently only pen and touch pointer input source types are supported E Stacktrace: E UnsupportedOperationError: Currently only pen and touch pointer input source types are supported

then I tried:
TouchAction(self.driver).move_to(ele).perform(), I found it directly click the target instead of hover on it!

then I tried:
ActionChains(self.driver).w3c_actions.pointer_action.move_to(ele), and it do not work

Is there any other method to achieve this?

Activity

  1. KazuCocoa commented on Jul 5, 2023

    @KazuCocoa
    Member

    Maybe you need to use touch input like

    touch_input = PointerInput(interaction.POINTER_TOUCH, 'touch')
    actions = ActionChains(self)
    actions.w3c_actions = ActionBuilder(self, mouse=touch_input)
    # https://github.com/SeleniumHQ/selenium/blob/3c82c868d4f2a7600223a1b3817301d0b04d28e4/py/selenium/webdriver/common/actions/pointer_actions.py#L83
    actions.w3c_actions.pointer_action.move_to(origin_el)
    actions.w3c_actions.pointer_action.pointer_down()
    # setup duration for second move only, assuming duration always has atleast default value
    actions.w3c_actions = ActionBuilder(self, mouse=touch_input, duration=duration)
    actions.w3c_actions.pointer_action.move_to(destination_el)
    actions.w3c_actions.pointer_action.release()
    actions.perform()
    for the env. I guess your code sent mouse .

  2. mykola-mokhnach commented on Jul 6, 2023

    @mykola-mokhnach
    Contributor

    @KazuCocoa I assume touch pointers do not have a "hover" concept. Only mouse does it

  3. pppppino commented on Jul 10, 2023

    @pppppino
    Author

    @KazuCocoa I have tried it, but it not works

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions