Search
 
 

Display results as :
 


Rechercher Advanced Search

Latest topics
» FlexMonkium Download Not available under Gorillalogic site
Thu Dec 08, 2016 5:40 pm by bhanu.praveen

» Selenium Script issue
Tue Dec 06, 2016 9:48 pm by njain213

» Difference between QTP, Selenium and Silk test
Tue Dec 06, 2016 7:58 pm by jessicacyrus1

» Where does selenium script pick browser from
Tue Dec 06, 2016 1:52 pm by janbaskt

» Safari throws an HTTP ERROR: 404
Tue Dec 06, 2016 1:51 pm by janbaskt

» Access Denied Error in Selenium RC
Tue Dec 06, 2016 1:51 pm by janbaskt

» Automating Flex application through selenium webdriver
Fri Dec 02, 2016 2:06 pm by abhinay.krs

» Starting with Selenium, what is Selenium?
Mon Nov 28, 2016 4:00 pm by Foma

» Getting started with Selenium
Mon Nov 28, 2016 3:23 pm by Rebbelx

Navigation
 Portal
 Index
 Memberlist
 Profile
 FAQ
 Search

Help with Variables

View previous topic View next topic Go down

Help with Variables

Post by DHHJ on Thu Mar 28, 2013 11:31 pm

I have a web part on my page that uses the TinyMCE editor. After much trial and error, I can get Selenium IDE to write to the editor using:

runScript | tinyMCE.activeEditor.setContent('This is a test')

and "This is a test" is typed into the editor area. I now want to replace "This is a test' with a variable. What would be the correct syntax?

I tried

Store | sample | This is another test
runScript | tinyMCE.activeEditor.setContent(sample) and it didn't work, nor did:
runScript | tinyMCE.activeEditor.setContent(${sample})

Help?

DHHJ

Posts : 8
Join date : 2013-03-14

Back to top Go down

Re: Help with Variables

Post by ccox on Thu Mar 28, 2013 11:44 pm

swap 'sample' and 'This is another test'

Store | This is another test | sample

ccox
Master
Master

Posts : 205
Join date : 2012-01-06
Age : 31
Location : Denver, CO

Back to top Go down

Re: Help with Variables

Post by DHHJ on Fri Mar 29, 2013 1:22 am

Thanks. Yes, you're right- it was a typo in my post- I accidentally reversed the Target and Value in my post. Here are some examples of what I have tried so far.

This works:
runScript | tinyMCE.activeEditor.setContent('Another test')

This doesn't work:
Store | Another test| sample
runScript | tinyMCE.activeEditor.setContent(sample)

This also doesn't work:
Store | Another test| sample
runScript | tinyMCE.activeEditor.setContent(${sample})

If I:
Echo| ${sample}
the Log file provides:
[info] echo: Another test

So sample is a valid variable in Selenium- I can't figure out how to get it into a js TinyMCE method.

DHHJ

Posts : 8
Join date : 2013-03-14

Back to top Go down

Re: Help with Variables

Post by ccox on Fri Mar 29, 2013 1:38 am

Can you swap runScript for 'getEval' and try?
For your variable try storedVars['sample']

getEval | tinyMCE.activeEditor.setContent(storedVars['sample'])

ccox
Master
Master

Posts : 205
Join date : 2012-01-06
Age : 31
Location : Denver, CO

Back to top Go down

Re: Help with Variables

Post by DHHJ on Fri Mar 29, 2013 1:41 am

I don't think getEval is available Selenium IDE?

DHHJ

Posts : 8
Join date : 2013-03-14

Back to top Go down

Re: Help with Variables

Post by ccox on Fri Mar 29, 2013 1:44 am

It is. Just type it in completely and it'll pick it up. I'm not very confident it'll work since runScript isn't working, but it's worth a try.

ccox
Master
Master

Posts : 205
Join date : 2012-01-06
Age : 31
Location : Denver, CO

Back to top Go down

Re: Help with Variables

Post by DHHJ on Fri Mar 29, 2013 1:47 am

Nice try but....

[error] Threw an exception: tinyMCE is not defined

DHHJ

Posts : 8
Join date : 2013-03-14

Back to top Go down

Re: Help with Variables

Post by ccox on Fri Mar 29, 2013 2:43 am

I played around with a few different things and see what you are seeing. I can send a variable in, but only if it is within the same command.

runScript |var a = document.title; var type = tinyMCE.activeEditor; type.setContent(a);

This typed the page title in the tinyMCE box. I still can't figure out how to get variables stored in Selenium into this command though. If I find out more, I'll let you know

ccox
Master
Master

Posts : 205
Join date : 2012-01-06
Age : 31
Location : Denver, CO

Back to top Go down

Re: Help with Variables

Post by DHHJ on Fri Mar 29, 2013 2:45 am

Thanks, I just did the same and it worked.

Its like the Selenium variable can;t be passed into the javascript snippet.

Do you think there is a work around or can you think of another way to achieve this?

DHHJ

Posts : 8
Join date : 2013-03-14

Back to top Go down

Re: Help with Variables

Post by Sponsored content Today at 1:00 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