Hi.
I've been trying to click into the save button of a rich-text editor without luck. Does anyone have an idea on how to do it?
the HTML of the form in which the button is:
Code
<form id="frmEditor" style="hidden:true;margin: 0px;" method="post" target="ifrEditorSalvar" action="editor/editor_processar.php?acao=editor_salvar&acao_origem=editor_montar&id_procedimento=40637&id_documento=52601&infra_sistema=100000100&infra_unidade_atual=12937&infra_hash=51219...caed6f">
<div id="divComandos" style="margin:0px;">
<div id="cke_txaEditor_484" class="cke cke_2 cke_reset_all cke_chrome cke_editor_txaEditor_484 cke_shared cke_detached cke_ltr cke_browser_webkit" dir="ltr" title="" lang="pt-br" role="presentation" style="user-select: none; display: none;">
<div class="cke_inner">
<div id="cke_2_top" class="cke_top" role="presentation">
<span id="cke_22" class="cke_voice_label"> Barra de Ferramentas do Editor </span>
<span id="cke_2_toolbox" class="cke_toolbox" role="group" aria-labelledby="cke_22" onmousedown="return false;">
<span id="cke_25" class="cke_toolbar" role="toolbar">
<span class="cke_toolbar_start"> </span>
<span class="cke_toolgroup" role="presentation">
<a id="cke_26" class="cke_button cke_button__save cke_button_disabled" href="javascript:void('Salvar (Ctrl+Alt+S)')" title="Salvar (Ctrl+Alt+S)" tabindex="-1" hidefocus="true" role="button" aria-labelledby="cke_26_label" aria-haspopup="false" onkeydown="return CKEDITOR.tools.callFunction(0,event);" onfocus="return CKEDITOR.tools.callFunction(1,event);" onclick="CKEDITOR.tools.callFunction(2,this);return false;" aria-disabled="true">
<span class="cke_button_icon cke_button__save_icon" style="background-image:url('/editor/ck/plugins/icons.png?t=G2FX');background-position:0 -1632px;background-size:auto;"> </span>
<span id="cke_26_label" class="cke_button_label cke_button__save_label" aria-hidden="false">Salvar</span></a></span>
Display More
there's also this javascript that is relate to the button
Code
function plugin_save(evt){
CKEDITOR.plugins.registered['save']={
init:function(editor){
var command=editor.addCommand( 'save',{
modes:{wysiwyg:1,source:1},
readOnly:1,
exec:function(editor){
if ( editor.fire( 'save' ) ) {
var $form=editor.element.$.form;
if (validarTags()){
exibirAvisoEditor();
timeoutExibirBotao = self.setTimeout('exibirBotaoCancelarAviso()',30000);
if (INFRA_IE>0) {
window.tempoInicio=(new Date()).getTime();
} else {
console.time('s'); }
if($form){
try{
$form.submit();
}catch(e){
if($form.submit.click){
$form.submit.click();
}
}
}
}
}
}
});
editor.ui.addButton('Save',{label:'Salvar',title:"Salvar (Ctrl+Alt+S)",command:'save'});
editor.setKeystroke( CKEDITOR.CTRL + CKEDITOR.ALT + 83 /*S*/, 'save' );
editor.setKeystroke( CKEDITOR.CTRL + CKEDITOR.ALT + 65 /*A*/, 'assinatura');
}
}
}
if(CKEDITOR.status!='loaded'){
CKEDITOR.on('loaded',plugin_save);
} else {
plugin_save(null);
}
Display More
I can't use the Element's ID since the number often change, so the command I got to that I believe should be working is:
IE2.document.getElementsByTagName("body")(0).Children(1).Children(0).Children(2).Children(0).Children(0).Children(1).getElementsByTagName("a")(0).Click
But when I run it, nothing happens.