aivaturi/Selenium-Remote-Driver — Issue #22: click in Selenium::Remote::Driver produces invalid JSON
Author: MattiL
Created: 2011-12-22 09:38:38+00:00
State: open

click in class Selenium::Remote::Driver produces invalid JSON as noted in Selenium Server log:

11:33:20.897 INFO - WebDriver remote server: Fatal, unhandled exception: /session/1324545212079/click: org.openqa.selenium.remote.JsonException: org.json.JSONException: A JSONObject text must begin with '{' at character 1
Build info: version: '2.15.0', revision: '15105', time: '2011-12-08 09:56:25'
System info: os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.6.8', java.version: '1.6.0_29'
Driver info: driver.version: unknown

RemoteConnection gets invalid JSON back:

Failed to click mouse button: malformed JSON string, neither array, object, number, string or atom, at character offset 0 (before "n

n line 1.

Below is part of the code that produces the error:

use Selenium::Remote::Driver;

my $driver;
eval { $driver = new Selenium::Remote::Driver; };
if ($@) {
sleep 10;
$driver = new Selenium::Remote::Driver;
}
$driver->get('http://10.80.10.227:8042');

my $map;
eval { $map = $driver->find_element('//*[@class="olMap"]'); };
if ($@) {
die "Failed to find map: $@";
}
eval { $driver->move_to( element => $map ); };
if ($@) {
die "Failed to move to map: $@";
}
eval { $driver->click() };
if ($@) {
die "Failed to click mouse button: $@";
}