Share
Go down
bugsyg
Posts : 6
Join date : 2010-03-08

How to select a text in iFrame and bold it?

on Mon Mar 08, 2010 7:22 pm
Hi,

I have an iFrame box and I am able to type some value using typekeys function in Selenium IDE. Now I want to select the text that I have added and make it bold. Bold option is there in a tool box in the iFrame.

Example as below. Type Hello wold and want to highlight the same text and mark it as bold


typeKeys
//html/body/p
Hello world


Thanks!
avatar
Advisor
------------------------
------------------------
Posts : 387
Join date : 2009-07-30
Location : India
http://seleniumforum.forumotion.net

Re: How to select a text in iFrame and bold it?

on Tue Mar 09, 2010 11:49 am
Hi,

Use this command .


selectFrame("Name/ID of the frame ");
type("//body"," how are you? this will print in next line");
selectWindow("null");

NOTE: use html syntax with text to bold or italic in type command. I try to add this in above code but it interpret the formatting syntax and applying in it. so you have to add it on your own, the command remain same.

Best of Luck.

Bye
bugsyg
Posts : 6
Join date : 2010-03-08

Re: How to select a text in iFrame and bold it?

on Wed Mar 10, 2010 2:50 pm
Hey Thanks for the reply...

The editor tool have Bold and Italic buttons. What I want to do is to highlight the text and make selenium IDE to click on Bold button.

Is it possible? The text highlighting part?

Thanks!
avatar
Advisor
------------------------
------------------------
Posts : 387
Join date : 2009-07-30
Location : India
http://seleniumforum.forumotion.net

Re: How to select a text in iFrame and bold it?

on Wed Mar 10, 2010 5:47 pm
No you can't click on bold button but you can make it by typing HTML code.

The reasons for that is you can accessible text area only not the formatting buttons present on editor.

The things you can do is type into it with formatting HTML text.
bugsyg
Posts : 6
Join date : 2010-03-08

Re: How to select a text in iFrame and bold it?

on Wed Mar 10, 2010 5:52 pm
hmmm... that mean If i want to bold a text using selenium IDE in this editor [where i am typing now] with the steps type, select, bold it's not possible? if the answer is yes how i can check whether the B button in the editor tool bar is working?

Thanks!!
avatar
Advisor
------------------------
------------------------
Posts : 387
Join date : 2009-07-30
Location : India
http://seleniumforum.forumotion.net

Re: How to select a text in iFrame and bold it?

on Fri Mar 12, 2010 6:10 pm
you have to do it manually only or you can can find other tool who support the testing of special editor.

You can just test that something is entering into it and flow is working fine.
bugsyg
Posts : 6
Join date : 2010-03-08

Re: How to select a text in iFrame and bold it?

on Mon Mar 15, 2010 11:27 am
okay... thanks a lot!
qasim
Posts : 2
Join date : 2013-06-13

Re: How to select a text in iFrame and bold it?

on Mon Jun 17, 2013 2:47 pm
could you please mention the way you are typing in an iframe...??
mail2prassad
Amateur
Amateur
Posts : 41
Join date : 2013-06-05

Re: How to select a text in iFrame and bold it?

on Mon Jun 17, 2013 5:00 pm
You can not write text directly on to an Iframe, there might be other input element inside the Iframe that takes the text from user. Look at the Iframe source and find that text input element and try the code below.

JavascriptExecutor executor = (JavascriptExecutor)driver;
executor.executeScript("document.getElementById(ELEMENT_FOR_TEXT_IN_IFRAME).style.backgroundColor = '#FF33FF';"); -- highlights the text
executor.executeScript("document.getElementById(ELEMENT_FOR_TEXT_IN_IFRAME).style.fontWeight = 'bold';"); -- bolds the text.


If the Frame is a contentEditable Frame, then try
driver.switchTo(IFRAME_NAME);
JavascriptExecutor executor = (JavascriptExecutor)driver;
executor.executeScript("document.body.style.backgroundColor = '#FF33FF';"); -- highlights the text
executor.executeScript("document.body.style.fontWeight = 'bold';"); -- bolds the text.
Sponsored content

Re: How to select a text in iFrame and bold it?

Back to top
Permissions in this forum:
You cannot reply to topics in this forum