0

I'm having trouble automating the typing of quotation mark and apostrophe characters in a text field with ChromeDriver.

By text field I mean an usual input type text element:

<input type="text" name="form.gps"/>

The Geb tests work with Chrome and Firefox browsers.

When I try it as a user, outside of Geb test, the typing of single quotation mark or single apostrophe does nothing. The sequence of quotation mark + space and apostrophe + space works in both browsers.

Example - input of GPS coordinates. The coordinates are specified in this format - ie. 50°5'0.097"N, 14°25'39.719"E.

Setting the value at once doesn't work. The following statement does assign a value, but different than expected.

$("input", name: "form.gps") = "50°5'0.097\"N, 14°25'39.719\"E"
  • In Chrome, both quotation mark and apostrophe characters are skipped - "50°50.097N, 14°2539.719E".
  • In Firefox, the last apostrophe is merged with E into Ë - "50°5'0.097"N, 14°25'39.719Ë". This can be solved by putting space character after the second " and the string "50°5'0.097\"N, 14°25'39.719\" E" works finally (though in Firefox only).

Trying Slashy-String /50°5'0.097"N, 14°25'39.719"E/ or left shift operator gives the same result.

I tried typing it character by character with a space following each quotation mark or apostrophe.

def gps = [
    "50", '°', "5", '\'', Keys.SPACE, "0.097", "\"", Keys.SPACE, "N, ", 
    "14", '°', "25", '\'', Keys.SPACE, "39.719", "\"", Keys.SPACE, "E"
]
gps.each { 
    $("input", name: "form.gps") << it 
}

This works well in Firefox, but " and ' are still skipped in Chrome.

So, how can I assign my gps coordinates in Chrome?

Tomas Pinos
  • 2,812
  • 14
  • 22
  • Quick Q; I assume it also fails with Slashy-Strings? `$("input", name: "form.gps") = /50°5'0.097"N, 14°25'39.719"E/` – tim_yates Feb 05 '14 at 20:55
  • And if not, how about with the left shift operator; `$("input", name: "form.gps") << /50°5'0.097"N, 14°25'39.719"E/` – tim_yates Feb 05 '14 at 21:00
  • Just tried the Slashy-Strings with the same result - both equals and left shift operators, both Firefox and Chrome. – Tomas Pinos Feb 06 '14 at 08:05

0 Answers0