microsoft / WinAppDriver

Windows Application Driver
MIT License
3.7k stars 1.41k forks source link

selenium-appium - Can't click a MenuItem #983

Open alexjupton opened 5 years ago

alexjupton commented 5 years ago

I'm testing a WindowsForms application using selenium-appium. I am attempting to click a MenuItem in a MenuStrip menu. The root menu can be clicked with an element.click() call, but the MenuItem beneath cannot be clicked with element.click() - I run into an ElementNotInteractableError. It appears that there is Menu element masking the MenuItem (inspect.exe flashes the MenuItem briefly before showing this Menu element, the MenuItem in question has an IsOffscreen property of true despite being visible, and the Menu element is clickable at that time). I have tried simply moving the mouse to coordinates of the underlying element like

session.actions({ bridge: true }) .move({ origin: element }) .press() .pause(10) .release() .perform();

where session is the WebDriver session and element is the WebElement object, but this results in the following error

WebDriverError: An unknown server-side error occurred while processing the command. Original error: Could not proxy. Proxy error: Could not proxy command to remote server. Original error: 501 - "Command not implemented: POST: /session/1D676E64-3D25-4A72-9F16-C6EB45F2D0BD/execute"

I have searched through the documentation to find alternatives to this, but can't seem to find a way to click this element. Is there a way to click an arbitrary point on the screen with selenium-appium, or is this a feature which is not implemented yet?

licanhua commented 4 years ago

WinAppDriver implements most of JsonWireProtocol, but execute is not one of them. I don't know which trigged execute, but WinAppDriver doesn't support execute because it only applies to browser and JavaScript is expected. Here is the supported API, and WinAppDriver has example to move mouse to anywhere.

Do you mean https://github.com/react-native-windows/selenium-appium? If yes, you have to look at https://selenium.dev/selenium/docs/api/javascript/module/selenium-webdriver/index.html and source code of selenium-webdriver to see if it has this API. selenium-appium itself only improve locators but actions are provided by selenium-webdriver.

licanhua commented 4 years ago

Possible a dup of #958 if IsOffscreen=true