phpunit-selenium icon indicating copy to clipboard operation
phpunit-selenium copied to clipboard

sending keystrokes using JSON wire /keys request instead of /value

Open amdugar opened this issue 11 years ago • 3 comments

Hi,

I have noticed that while testing with iWebdriver, the function keys() fails giving

BadMethodCallException: The command http://host/session_id/keys is not recognized by the server.

Here's a comparison how key strokes are sent in ruby, php and php-unit

Ruby

POST /session/6c9b91d32cf81fb9fe3e840af53ccc7872215f7d/element/:wdc:1390552642458/value {"value":["ABC"]}

PHP

POST /session/7fb0dd154bd9c427c8a54fbe96bbf5e419d1a1f7/element/:wdc:1390554708484/value {"value":["ABC"],":id":":wdc:1390554708484"}

PHP-Unit

POST /session/8364eb099e4ad6999e6831e6207d69446b215e6b/keys {"value":["B","r","o","w","s","e","r","s","t","a","c","k"]}

/keys works fine with selenium-webdrivers but fails with iWebDriver, could a fix for this be provided or is there any other way things can be done?

Thanks

Amit

amdugar avatar Jan 24 '14 10:01 amdugar

Do you experience this with a particular implementation of WebDriver or does it replicate between different ones? If it's iWebDriver specific, you should open an issue on that project while if it's cross-driver we can change the protocol with which PHPUnit_Selenium talks to them.

giorgiosironi avatar Jan 26 '14 16:01 giorgiosironi

Hi This is the way the function keys() behave. Selenium-webdriver do interpret the /keys JSONWireProtocol, but iWebdriver and Android Webdriver do not understand /keys.

It would be more generic to use /value since other almost all majority languages use /value to send the key presses.

amdugar avatar Jan 27 '14 09:01 amdugar

Didn't know about the multiple choices at the time keys() was implemented. This is covered by the test suite so you can open a PR and if tests are still green I will merge for greater compatibility.

giorgiosironi avatar Feb 01 '14 10:02 giorgiosironi