Selenium automation and Telerik RadEditor

343 views
Skip to first unread message

Piotr K

unread,
Aug 12, 2011, 7:11:09 AM8/12/11
to Selenium Users
Hi all,

I've founded following problem in my test automation with Telerik
RadEditor (ASP.NET AJAX). I'd like to introduce some text to this
RadEditor control and I can't do it.

On Telerik forum here:
http://www.telerik.com/community/forums/aspnet/editor/testing-wysiwyg-editor-with-selenium-ide.aspx
there is mentioned solution but unfortunately I don't know how to do
it.

Can someone help me with this, please?

I want to do simple test. Put some "text" to this RadEditor.

Thanks for help.

BR,
Piotr

Piotr K

unread,
Aug 15, 2011, 7:55:55 AM8/15/11
to Selenium Users
Nobody used this RadEditor and use Selenium to test this?

On 12 Sie, 13:11, Piotr K <piotr.kin...@gmail.com> wrote:
> Hi all,
>
> I've founded following problem in my test automation with Telerik
> RadEditor (ASP.NET AJAX). I'd like to introduce some text to this
> RadEditor control and I can't do it.
>
> On Telerik forum here:http://www.telerik.com/community/forums/aspnet/editor/testing-wysiwyg...

Piotr K

unread,
Aug 16, 2011, 8:25:39 AM8/16/11
to Selenium Users
Hi all,

I'm still looking for solution for introduce text to text area of
Telerik RadEditor. I've found that I need reference the editor's API
and manipulate the "text area" by calling its gerHTML and setHTMl
functions. But I don't know how :(

Can someone execute Javascript code on the client side via Selenium?

Raja sankar

unread,
Aug 16, 2011, 8:50:39 AM8/16/11
to seleniu...@googlegroups.com
You can use the javascript executer in SE 2. There are examples in this list how to use it. Do a search.

Rajasankar

ராஜசங்கர்



--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To post to this group, send email to seleniu...@googlegroups.com.
To unsubscribe from this group, send email to selenium-user...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/selenium-users?hl=en.


Piotr K

unread,
Aug 16, 2011, 9:19:15 AM8/16/11
to Selenium Users
Raja, thanks that you are trying help me but I've seen this FAQ:

Q: How do I execute Javascript directly?
A: We believe that most of the time there is a requirement to execute
Javascript there is a failing in the tool being used: it hasn't
emitted the correct events, has not interacted with a page correctly,
or has failed to react when an XmlHttpRequest returns. We would rather
fix WebDriver to work consistently and correctly than rely on testers
working out which Javascript method to call.

We also realise that there will be times when this is a limitation. As
a result, for those browsers that support it, you can execute
Javascript by casting the WebDriver instance to a JavascriptExecutor.
In Java, this looks like:

WebDriver driver; // Assigned elsewhere
JavascriptExecutor js = (JavascriptExecutor) driver;
js.executeScript("return document.title");

Other language bindings will follow a similar approach. Take a look at
the UsingJavascript page for more information.
Q: Why is my Javascript execution always returning null?

A: You need to return from your javascript snippet to return a value,
so:
js.executeScript("document.title");
will return null, but:

js.executeScript("return document.title");
will return the title of the document.

Unfrotunately, I don't know how can I use it. Can you help me with
this on this page:
http://demos.telerik.com/aspnet-ajax/editor/examples/default/defaultcs.aspx

I'd like to put another text via Selenium to this Editor, but
how... ?



On 16 Sie, 14:50, Raja sankar <errajasankarc...@gmail.com> wrote:
> You can use the javascript executer in SE 2. There are examples in this list
> how to use it. Do a search.
>
> Rajasankar
>
> ராஜசங்கர்
>

Raja sankar

unread,
Aug 16, 2011, 9:06:55 PM8/16/11
to seleniu...@googlegroups.com
I have checked the page. That RadEditor contents are in a iframe. Normally you need to change the focus to that iframe and execute the Se commands. The  teledrik forum doesn't mentions that.

Have you tried that? If yes and that didn't worked, you can try to execute the JS set command using the javascript executor. For that too, JS needed to be executed in that iframe not in the main html.

Rajasankar

ராஜசங்கர்

Piotr K

unread,
Aug 17, 2011, 4:11:27 AM8/17/11
to Selenium Users
Rajasankar,

Yes, I've tried this command to select frame:

selenium.SelectFrame("id=RadEditor1_contentIframe");

but the SE command only highlighted frame but the type some text
doesn't work, so I think teh text should be type by javascript
executor.
Unfortunately, as I mentioned I don't know how use this javascript
executor. Can you help me with this or anybody, please?

Thanks


On 17 Sie, 03:06, Raja sankar <errajasankarc...@gmail.com> wrote:
> I have checked the page. That RadEditor contents are in a iframe. Normally
> you need to change the focus to that iframe and execute the Se commands.
> The  teledrik forum doesn't mentions that.
>
> Have you tried that? If yes and that didn't worked, you can try to execute
> the JS set command using the javascript executor. For that too, JS needed to
> be executed in that iframe not in the main html.
>
> Rajasankar
>
> ராஜசங்கர்
>
> >http://demos.telerik.com/aspnet-ajax/editor/examples/default/defaultc...

Raja sankar

unread,
Aug 17, 2011, 6:50:00 AM8/17/11
to seleniu...@googlegroups.com
You need to use the Type command after selecting the frame.

selenium.SelectFrame();
selenium.typeKeys("","")

I have tried in Se IDE. It works. Try and let me know.

HTML code is below.

<tr>
    <td>selectFrame</td>
    <td>css=iframe</td>
    <td></td>
</tr>
<tr>
    <td>typeKeys</td>
    <td>//html/body/h2</td>
    <td>test</td>
</tr>


ராஜசங்கர்

Piotr K

unread,
Aug 17, 2011, 7:26:32 AM8/17/11
to Selenium Users
Raja, You are the best :)

But It's works only when open this page and run your HTML code. Can
you run your code in this case:

---open http://demos.telerik.com/aspnet-ajax/editor/examples/default/defaultcs.aspx
---remove all text from textarea

and when the textarea is empty it doesn't work, only reload the page.

I've tried to use this code:

<tr>
<td>selectFrame</td>
<td>css=iframe</td>
<td></td>
</tr>
<tr>
<td>typeKeys</td>
<td>//html/body</td>
<td>test</td>
</tr>

any suggestion?


On 17 Sie, 12:50, Raja sankar <errajasankarc...@gmail.com> wrote:
> You need to use the Type command after selecting the frame.
>
> selenium.SelectFrame();
> selenium.typeKeys("","")
>
> I have tried in Se IDE. It works. Try and let me know.
>
> HTML code is below.
>
> <tr>
>     <td>selectFrame</td>
>     <td>css=iframe</td>
>     <td></td>
> </tr>
> <tr>
>     <td>typeKeys</td>
>     <td>//html/body/h2</td>
>     <td>test</td>
> </tr>
>
> ராஜசங்கர்
>

Raja sankar

unread,
Aug 17, 2011, 8:17:37 AM8/17/11
to seleniu...@googlegroups.com
use

//html

not

//html/body.

It works fine, even i remove all the text.


ராஜசங்கர்



Piotr K

unread,
Aug 17, 2011, 8:36:35 AM8/17/11
to Selenium Users
I don't understand I have this:

<tr>
<td>selectFrame</td>
<td>css=iframe</td>
<td></td>
</tr>
<tr>
<td>typeKeys</td>
<td>//html</td>
<td>test</td>
</tr>

and it reloads me the page, not type "test" to textarea as it should. :
(

On 17 Sie, 14:17, Raja sankar <errajasankarc...@gmail.com> wrote:
> use
>
> //html
>
> not
>
> //html/body.
>
> It works fine, even i remove all the text.
>
> ராஜசங்கர்
>
> On Wed, Aug 17, 2011 at 4:56 PM, Piotr K <piotr.kin...@gmail.com> wrote:
> > Raja, You are the best :)
>
> > But It's works only when open this page and run your HTML code. Can
> > you run your code in this case:
>
> > ---open
> >http://demos.telerik.com/aspnet-ajax/editor/examples/default/defaultc...

santoshsarma jayanthi

unread,
Aug 17, 2011, 8:43:12 AM8/17/11
to seleniu...@googlegroups.com
Give "\" followed by the numeric keycode of the key to be pressed (i.e.,t e s t)

You can find ascii values of alphabets here
--
Regards,
-SantoshSarma

Raja sankar

unread,
Aug 17, 2011, 8:46:16 AM8/17/11
to seleniu...@googlegroups.com
Browser Version???

It works in the Se IDE 1.0 version in FF 5.0

If I try //html/body, it reloads the page for me.

ராஜசங்கர்

Piotr K

unread,
Aug 17, 2011, 9:02:04 AM8/17/11
to Selenium Users
I have FF 3.6.20


On 17 Sie, 14:46, Raja sankar <errajasankarc...@gmail.com> wrote:
> Browser Version???
>
> It works in the Se IDE 1.0 version in FF 5.0
>
> If I try //html/body, it reloads the page for me.
>
> ராஜசங்கர்
>
Reply all
Reply to author
Forward
0 new messages