Interaction with ace editor using selenium programmatically

I am trying to do something with selenium-webdriver . A specific page uses the ace editor to highlight syntax. The problem is that I can enter text using

 driver.get "http://codetable.org" elem = driver.find_element(:css, "#editor textarea") elem.send_keys "Hello" 

but I cannot clear the entered text. elem.clear affects the page.

Is there any way that I can remove text that is on the screen programmatically? I suspect this is because of the extra CSS that the ace adds. I am using ruby 1.9.3 .

I also tried this

 irb(main):035:0> driver.find_element(:css, ".ace_content").clear Selenium::WebDriver::Error::UnknownError: Element must be user-editable in order to clear it. from [remote server] 
+4
source share
1 answer

It looks like when a value is entered into a text field, it applies to a different range. Textarea always has an empty value, which explains why clear does not work, does nothing.

If you want to clear the text, I think you may have to use the keyboard shortcuts - ctrl + a and then delete. Try:

 elem.send_keys [:control, 'a'], :delete 
+3
source

All Articles