Search
 
 

Display results as :
 


Rechercher Advanced Search

Latest topics
Navigation
 Portal
 Index
 Memberlist
 Profile
 FAQ
 Search

How to select a text in iFrame and bold it?

View previous topic View next topic Go down

How to select a text in iFrame and bold it?

Post by bugsyg 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!

bugsyg

Posts : 6
Join date : 2010-03-08

Back to top Go down

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

Post by Adviser 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

Adviser
------------------------
------------------------

Posts : 379
Join date : 2009-07-30
Location : India

http://seleniumforum.forumotion.net

Back to top Go down

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

Post by bugsyg 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!

bugsyg

Posts : 6
Join date : 2010-03-08

Back to top Go down

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

Post by Adviser 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.

Adviser
------------------------
------------------------

Posts : 379
Join date : 2009-07-30
Location : India

http://seleniumforum.forumotion.net

Back to top Go down

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

Post by bugsyg 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!!

bugsyg

Posts : 6
Join date : 2010-03-08

Back to top Go down

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

Post by Adviser 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.

Adviser
------------------------
------------------------

Posts : 379
Join date : 2009-07-30
Location : India

http://seleniumforum.forumotion.net

Back to top Go down

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

Post by bugsyg on Mon Mar 15, 2010 11:27 am

okay... thanks a lot!

bugsyg

Posts : 6
Join date : 2010-03-08

Back to top Go down

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

Post by qasim on Mon Jun 17, 2013 2:47 pm

could you please mention the way you are typing in an iframe...??

qasim

Posts : 2
Join date : 2013-06-13

Back to top Go down

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

Post by mail2prassad 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.

mail2prassad
Amateur
Amateur

Posts : 41
Join date : 2013-06-05

Back to top Go down

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

Post by Sponsored content Today at 9:07 pm


Sponsored content


Back to top Go down

View previous topic View next topic Back to top

- Similar topics

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