Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Selenium and ckEditor

Does anybody know How I can get the ckEdtior to work with Selenium. I'm not able to get the focus to the "html edit" field or change the value of the html field.

Does anybody has experience with this ?

like image 913
fehrlich Avatar asked Apr 10 '10 13:04

fehrlich


People also ask

What CKEditor plugins are included in Django-CKEditor?

django-ckeditor includes the following ckeditor plugins, but not all are enabled by default: The image/file upload feature is done by the uploadimage plugin. To restrict upload functionality to image files only, add CKEDITOR_ALLOW_NONIMAGE_FILES = False in your settings.py file.

What is CKEditor_upload_path in CKEditor?

This setting specifies a relative path to your CKEditor media upload directory. CKEditor uses Django’s storage API. By default, Django uses the file system storage backend (it will use your MEDIA_ROOT and MEDIA_URL) and if you don’t use a different backend you have to have write permissions for the CKEDITOR_UPLOAD_PATH path within MEDIA_ROOT, i.e.:

Can superusers see all images in CKEditor?

If CKEDITOR_RESTRICT_BY_USER is set to a string, the named property is used instead. Superusers can still see all images. NOTE: This restriction is only enforced within the CKEditor media browser. Set the CKEDITOR_BROWSE_SHOW_DIRS setting to True to show directories on the “Browse Server” page.

How to add rich text editing to a CKEditor model?

Set the CKEDITOR_RESTRICT_BY_DATE setting to True to bucked uploaded files by year/month/day. The quickest way to add rich text editing capabilities to your models is to use the included RichTextField model field type. A CKEditor widget is rendered as the form field but in all other regards the field behaves as the standard Django TextField.


3 Answers

Just for completing the anwser: I got it to work with: runScript("CKEDITOR.instances['InstanceName'].setData('<p>testContent</p>');") It did not work with the getEval command.

like image 196
fehrlich Avatar answered Oct 13 '22 13:10

fehrlich


When I have had a to test against WYSIWYG editors I have had to build my own mechanism to work in the content area. Normally it involves having to set the inner HTML of object and then start using the page manipulators in the tool bars.

With Selenium 2 you will be able to send keystrokes in so that they work better and a lot easier.

like image 1
AutomatedTester Avatar answered Oct 13 '22 11:10

AutomatedTester


Working in Selenium:

selenium.runScript("for(var i in CKEDITOR.instances) { var x = CKEDITOR.instances[i]; " + " x.setData('" + texto + "'); }");
like image 1
Renato Araujo Avatar answered Oct 13 '22 12:10

Renato Araujo