Ah, so this issue has nothing to do with send_keys. Apparently, the response to find element (POST /session/:sessionId/element) is different between geckodriver and the selenium standalone server jar.
From geckodriver, the key that corresponds to the element ID has its own UUID on it:
REQ: POST, session/0a0af85d-6556-c74b-b324-697a98287f41/element, {"value":"div","using":"css selector"}
RES: {
"value": {
"element-6066-11e4-a52e-4f735466cecf": "e1ae9c33-85eb-2245-9273-af7da455aa75"
}
}
whereas from RemoteDriver via standalone server jar, the key is simply ELEMENT:
REQ: POST, session/beabd546-b1a4-4cc0-baf6-bdd57c7d1332/element, {"value":"div","using":"css selector"}
RES: {
"class": "org.openqa.selenium.remote.Response",
"hCode": 1200604265,
"sessionId": "beabd546-b1a4-4cc0-baf6-bdd57c7d1332",
"state": "success",
"status": 0,
"value": {
"ELEMENT": "0"
}
}
I have opened an issue in geckodriver and I’m putting a workaround in for a bugfix release of S::R::D. Thanks for bringing this to my attention!
test script:
use strict;
use warnings;
use Selenium::Firefox;
my $ff = Selenium::Firefox->new;
# my $ff = Selenium::Remote::Driver->new; # for comparison
$ff->get('https://www.google.com');
$ff->debug_on;
my $search_bar = $ff->find_element('div', 'css');
# my $search_bar = $ff->find_elements('div', 'css');
$ff->quit;