Closed paulbjensen closed 12 years ago
I have used 'type' and 'typeKeys' without any problems (so far). I believe 'sendKeys' is specific to the WebDriver implementation, and I have used Soda only with Selenium RC.
browser.type('username', 'foo')
Thanks @chrisdeely.
To give context, I need to be able to simulate pressing the Return key on an input text field. I tried both 'type' and 'typeKeys' when attempting to replicate hitting the Return key, with these identifiers:
"\13" "\n" "\r"
I have not been able to do so using various combinations of these. Am I doing something stupid?
Ah, I gotcha. No, not doing something stupid, but the approach varies based on your JS code and what event listeners are being used. This is a challenge with Selenium, not Soda specifically. Different methods in Selenium enter keys differently, and some do not actually fire all of the events you would expect.
I had the exact same challenge recently, I used the 'keyUp' method to get the enter key to be captured:
browser.keyUp('css=input.myTarget', '\13')
Hopefully that will work for your case. I'd recommend closing this issue, as it is not truly a bug in Soda.
Thanks for the information. Agreed, this isn't a bug with Soda.
Hi, I'm still running into this issue, and my description was incorrect, apologies. The element being manipulated is a h1 tag with a contenteditable attribute, and I'm trying to type keys into it. Even though I can focus on it and trigger it's state change, I don't seem to be able to manipulate the text at all.
Any ideas?
PS - The test is a cucumber feature inside Dashku's codebase, here: https://github.com/Anephenix/dashku/blob/master/features/dashboards.feature#L27
Step definition:
Thanks,a ton chrisdeely :) :) "browser.keyUp('css=input.myTarget', '\13')" saved my day :)
Hi,
I haven't found a documented way to use the sendKeys selenium command in Soda. Is there a way?