Take the 2-minute tour ×
Software Quality Assurance & Testing Stack Exchange is a question and answer site for software quality control experts, automation engineers, and software testers. It's 100% free, no registration required.

I am creating functional tests with selenium & PHPUnit, but I can't locate a WYSIWYG element using different locators:

  • Xpath
  • byId
  • byName
  • by Css Selector

Examples:

public function test(){
     $this->assertEquals($this->getBrowserUrl(),'url'); 
     $this->ByName('text field name')->value('test');
     $this->ByName('text field name')->value('test');   
     $this->ByName('wysiwyg name')->value('test');   
     $this->ByName('wysiwyg name')->value('test');
     $this->ById('submit id')->click();

     }

In the two first text fields the value has been inserted, but for the two last no values are added. If some one has an idea of what is wrong, please help.

The HTML code is like this:

<html>
 <textarea id="test_libelle" class="item_field wysiwyg_editor" required="required" name="test[libelle]" style="visibility: hidden; display: none;"></textarea>
 <span id="cke_otest_libelle" class="cke_skin_kama cke_1 cke_editor_test_libelle" lang="fr" style="width: 788px;" aria-labelledby="cke_test_libelle_arialbl" role="application" title=" " dir="ltr">
  <span id="cke_test_libelle_arialbl" class="cke_voice_label">Éditeur‌·de‌·Texte‌·Enrichi</span>
  <span class="cke_browser_gecko" role="presentation">
   <span class="cke_wrapper cke_ltr" role="presentation">
    <table class="cke_editor" cellspacing="0" cellpadding="0" border="0" role="presentation">
     <tbody>
      <tr role="presentation" style="-moz-user-select: none;">
      <tr role="presentation">
      <tr role="presentation" style="-moz-user-select: none;">
     </tbody>
    </table>
    <style>
   </span>
  </span>
  <span role="presentation" style="position:absolute;" tabindex="-1"></span>
 </span>
 </div>
 </td>
 </tr>
</html>

Here is my selenium code:

public function creatMat(){ 
    $this->assertEquals($this->getBrowserUrl(),'url/ssion'); 
    $this->ByValue('Créer')->click(); 
}
public function test(){ 
    $this->assertEquals($this->getBrowserUrl(),'url/session/new/'); 
    $this->ByName('text area1 name')->value('01 02 03');
    $this->ByName('text area2 name')->value('150'); 
    $this->ByName('wysiwyge1 name')->value('test');
    $this->ByName('wysiwyge name')->value('test'); 
    $this->ById('submit id')->click();
} 
share|improve this question
    
welcome to SQA, I am having a bit of trouble understanding what the issue is exactly. Are you saying that the $this->ByName('wysiwyg name')->value('test'); $this->ById('submit id')->click(); code segments are not working for your application? –  Dan Snell Jul 11 '13 at 18:23
    
when i execute the tests withe selenium serever all the text field get the value that i gives bur the wysiwyg doesn't take the value 'test' as value. did i was clear? tainks for traying. –  Lorina Jul 12 '13 at 9:32
    
Can you show the html? There are a number of different reasons why the selenium identifiers might not be working, but we can't tell which is which without a look at the html. –  vincebowdren Jul 15 '13 at 10:13
    
@Lorina: You have to put four spaces before each line of the html, to make it show as embedded code instead of being interpreted as html. –  vincebowdren Jul 17 '13 at 10:38
    
@Lorina: Your html doesn't match your selenium code; I guess the identifier 'wysiwyg name' isn't from your real code? Can you include the actual selenium code you are trying to run; otherwise it's difficult to tell what's going wrong. –  vincebowdren Jul 17 '13 at 10:45
show 5 more comments

1 Answer

I had an issue once with CKEditor. Turned out that it was using its on IFRAME, so in order to find the element, first you might need to Switch to the WYSIWYG frame/iframe.

Like this:

driver.SwitchTo().Frame("frame_name");
share|improve this answer
    
tahinks very muche . i will try what you said, i want just mantion that am biggner in programing and in selenium. driver what is it is it a varible: $driver.switchTo().Frame("frame_name"); or what exactly?? –  Lorina Jul 17 '13 at 10:42
    
is this code is in java? –  Lorina Jul 26 '13 at 9:13
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.