totpero / php-webdriver-bindings

Automatically exported from code.google.com/p/php-webdriver-bindings
0 stars 0 forks source link

sendKeys with key codes doesn't seem to work #9

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Include Keys.php
2. Try $element->sendKeys( array( Keys::SPACE ) );

What is the expected output? What do you see instead?

I expect this to insert a space into $element.  Instead it throws an exception 
on the Selenium Server side saying: "java.lang.ClassCastException: 
java.lang.Long cannot be cast to java.lang.String."

What version of the product are you using? On what operating system?

The 0.9.0 bindings release on Ubuntu.  On the server side I'm using Selenium 
Server v2.8.0 on Windows XP.

Original issue reported on code.google.com by seventow...@gmail.com on 20 Oct 2011 at 2:33

GoogleCodeExporter commented 9 years ago
http://code.google.com/p/selenium/wiki/JsonWireProtocol#/session/:sessionId/elem
ent/:id/value

Fwiw.

Original comment by hunter1...@gmail.com on 13 Dec 2011 at 5:08

GoogleCodeExporter commented 9 years ago
In case it matters for browser support of native keystroke events, which 
browser was this targeted at?

Maybe the Keys::SPACE needs to be cast as string before passing into array()? I 
think there are functions to make a variable's content as string in PHP. Worth 
a try.

After all the JSONWireProtocol spec (see comment 1), states JSON argument is 
array of strings. Keys::SPACE as I last recall isn't a string (yet).

Or just simply pass array("U+E00D") and see if that works?

Original comment by manga...@gmail.com on 13 Dec 2011 at 7:30

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
I've attached what worked for me.  The wrinkle would be that you have to do 
sendSpecialKey()

Fwiw: tried enter,f1,f3,tab,backspace,pageup,pagedown in firefox and ie and it 
seemed to work.

(Sorry for the spam, previous code had a bug)

Original comment by hunter1...@gmail.com on 13 Dec 2011 at 10:09

Attachments:

GoogleCodeExporter commented 9 years ago
Yeah this was on FF 3.6.something. I tried various combinations of strings and 
arrays.  I'll check out the patch.  Thanks!

Original comment by seventow...@gmail.com on 18 Dec 2011 at 4:33

GoogleCodeExporter commented 9 years ago
Excellent! That worked.

Well it worked for the left arrow in IE7 and FF3.6. I need to figure out how to 
press and hold shift and then hit the left arrow (to simulate highlighting 
keys). Thanks for the help.

Original comment by seventow...@gmail.com on 27 Dec 2011 at 6:39