Selenium Forum: Functional And Regression Testing Tool.
Would you like to react to this message? Create an account in a few clicks or log in to continue.
Search
Display results as :
Advanced Search
Latest topics
AEM Training | Free Online DemoWed Apr 21, 2021 5:45 pmazharuddin
c# PageFactory - issue initializing elementsFri Nov 01, 2019 8:40 pmthegoatboy
Selenium making automatic connection to random urlsMon Jul 08, 2019 12:58 pmrepairtechsolutions1
How can we design the custom framework in Selenium RCMon Jun 24, 2019 2:26 pmrandybonnettes
What are the new features in Selenium 3.0Tue Jun 18, 2019 5:37 pmpappyvicky
What are you using Selenium for? Fri Apr 12, 2019 3:52 amzhl
LIMITATIONS OF SELENIUMWed Apr 10, 2019 11:23 amswara
Navigation
 Portal
 Index
 Memberlist
 Profile
 FAQ
 Search

Go down
avatar
DHHJ
Posts : 8
Join date : 2013-03-14

Help with Variables Empty Help with Variables

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?
avatar
ccox
Master
Master
Posts : 205
Join date : 2012-01-06
Age : 38
Location : Denver, CO

Help with Variables Empty Re: Help with Variables

Thu Mar 28, 2013 11:44 pm
swap 'sample' and 'This is another test'

Store | This is another test | sample
avatar
DHHJ
Posts : 8
Join date : 2013-03-14

Help with Variables Empty Re: Help with Variables

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.
avatar
ccox
Master
Master
Posts : 205
Join date : 2012-01-06
Age : 38
Location : Denver, CO

Help with Variables Empty Re: Help with Variables

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'])
avatar
DHHJ
Posts : 8
Join date : 2013-03-14

Help with Variables Empty Re: Help with Variables

Fri Mar 29, 2013 1:41 am
I don't think getEval is available Selenium IDE?
avatar
ccox
Master
Master
Posts : 205
Join date : 2012-01-06
Age : 38
Location : Denver, CO

Help with Variables Empty Re: Help with Variables

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.
avatar
DHHJ
Posts : 8
Join date : 2013-03-14

Help with Variables Empty Re: Help with Variables

Fri Mar 29, 2013 1:47 am
Nice try but....

[error] Threw an exception: tinyMCE is not defined
avatar
ccox
Master
Master
Posts : 205
Join date : 2012-01-06
Age : 38
Location : Denver, CO

Help with Variables Empty Re: Help with Variables

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
avatar
DHHJ
Posts : 8
Join date : 2013-03-14

Help with Variables Empty Re: Help with Variables

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?
Sponsored content

Help with Variables Empty Re: Help with Variables

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