Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ActionChains perform returns exception 'value' must be a single unicode point #12255

Closed
jvanyo opened this issue Mar 4, 2019 · 5 comments
Closed
Labels
Mobile Chrome related to mobile Chrome driver Needs Info typically non-actionable; needs author to respond

Comments

@jvanyo
Copy link

jvanyo commented Mar 4, 2019

The problem

While attempting to perform ActionChains(driver).move_to_element(element).click().perform()
I received the following exception:
selenium.common.exceptions.InvalidArgumentException: Message: invalid argument
from invalid argument: 'value' must be a single unicode point
Note that I was getting the same error as described in issue 12161
#12161
but when I moved up to 1.11.1, I now started getting this new error.

Environment

  • Appium version (or git revision) that exhibits the issue: 1.11.1
  • Last Appium version that did not exhibit the issue (if applicable): 1.9.0
  • Desktop OS/version used to run Appium: Win7
  • Node.js version (unless using Appium.app|exe): 10.15.1
  • Npm or Yarn package manager: 6.4.1
  • Mobile platform/version under test: Android 8.1 and Android 9
  • Real device or emulator/simulator: Real
  • Appium CLI or Appium.app|exe: CLI

Details

In an Hybrid app my Move to element and click used to work and at some point stopped. I was getting the same error as described in issue#12161, but when I moved up to 1.11.1 where the fix
appium/appium-base-driver#302
was applied, I started getting this new error.
I am using Appium Python Client: 0.38

Link to Appium logs

https://gist.github.com/jvanyo/c0ac24ba076ddc6c8669a115d2e8cbf4

Code To Reproduce Issue [ Good To Have ]

Although the problem affects me in an Hybrid app, I can reproduce it by just using Chrome on the Android device using the following python code:

from appium import webdriver
from selenium.webdriver.common.action_chains import ActionChains
import time
import traceback

desired_caps = {}
desired_caps['platformName'] = 'Android'
desired_caps['platformVersion'] = '9'
desired_caps['deviceName'] = 'XXXX'
desired_caps['newCommandTimeout'] = '300'
desired_caps['automationName'] = 'UIAutomator2'
desired_caps['browserName'] = 'Chrome'
driver = webdriver.Remote('http://localhost:4723/wd/hub', desired_caps)
driver.get('http://appium.io')

driver.context
element = driver.find_element_by_xpath("(//span[text()='Toggle navigation'])[1]")
element.text

The following click will fail because another element would receive the click

try:
print('Trying element.click(). It will fail as expected.')
element.click()
except Exception:
print(traceback.format_exc())

The following move_to_element click should work because I am moving to the location, but it fails.

try:
print('Trying move_to_element(element).click().perform() with W3C')
ActionChains(driver).move_to_element(element).click().perform()
except Exception:
print(traceback.format_exc())
time.sleep(5)
driver.close_app()

If I force JSON, the move_to_element.click will work.

desired_caps['forceMjsonwp'] = 'true'
driver = webdriver.Remote('http://localhost:4723/wd/hub', desired_caps)
driver.get('http://appium.io')

driver.context
element = driver.find_element_by_xpath("(//span[text()='Toggle navigation'])[1]")
element.text

The following click will fail because another element would receive the click

try:
print('Trying element.click(). It will fail as expected.')
element.click()
except Exception:
print(traceback.format_exc())

The following move_to_element click now works because I am using JSON instead of default W3C

print('Trying move_to_element(element).click().perform() with JSON')
ActionChains(driver).move_to_element(element).click().perform()
time.sleep(5)
driver.close_app()

@KazuCocoa
Copy link
Member

I guess https://github.com/SeleniumHQ/selenium/blob/11c25d75bd7ed22e6172d6a2a795a1d195fb0875/py/selenium/webdriver/common/action_chains.py#L105-L106 is related to the error.

What about below?

action = ActionChains(driver).move_to_element(element)
action.w3c_actions.pointer_action.click() # skip calling them
action.perform()

In Ruby client, for example, just call the command (does not call key_action.pause(). So, I wonder they are not supported by Chrome driver)


https://github.com/bayandin/chromedriver/blob/25beb7aba364ec6a6a01ff1b8a9aeb28bff72ead/window_commands.cc#L1147

@KazuCocoa KazuCocoa added Needs Info typically non-actionable; needs author to respond W3C regarding W3C specification compliance labels Mar 5, 2019
@mykola-mokhnach mykola-mokhnach added the Mobile Chrome related to mobile Chrome driver label Mar 5, 2019
@mykola-mokhnach
Copy link
Collaborator

{"type":"key","id":"key","actions":[{"type":"pause","duration":0},{"type":"pause","duration":0},{"type":"pause","duration":0}
]}

I have no idea why Python lib adds this unnecessary stuff into the call on its own. Try to build the actions chain on your own instead of using all these weird high-level wrapper methods

@mykola-mokhnach mykola-mokhnach added NotABug and removed W3C regarding W3C specification compliance labels Mar 5, 2019
@mykola-mokhnach
Copy link
Collaborator

Please create an issue to Python selenium lib or to chromedriver. There is nothing to do here in Appium for now.

@KazuCocoa
Copy link
Member

SeleniumHQ/selenium#7000 (comment)

Just moved up Appium to use Chromedriver 2.46 and it works. Thanks.

as a log. thanks for reporting to the repo.

@lock
Copy link

lock bot commented Mar 10, 2020

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked and limited conversation to collaborators Mar 10, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Mobile Chrome related to mobile Chrome driver Needs Info typically non-actionable; needs author to respond
Projects
None yet
Development

No branches or pull requests

3 participants