- DHHJ
- Posts : 8
Join date : 2013-03-14
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?
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?
- ccoxMaster
- Posts : 205
Join date : 2012-01-06
Age : 39
Location : Denver, CO
Re: Help with Variables
Thu Mar 28, 2013 11:44 pm
swap 'sample' and 'This is another test'
Store | This is another test | sample
Store | This is another test | sample
- DHHJ
- Posts : 8
Join date : 2013-03-14
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.
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.
- ccoxMaster
- Posts : 205
Join date : 2012-01-06
Age : 39
Location : Denver, CO
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'])
For your variable try storedVars['sample']
getEval | tinyMCE.activeEditor.setContent(storedVars['sample'])
- DHHJ
- Posts : 8
Join date : 2013-03-14
Re: Help with Variables
Fri Mar 29, 2013 1:41 am
I don't think getEval is available Selenium IDE?
- ccoxMaster
- Posts : 205
Join date : 2012-01-06
Age : 39
Location : Denver, CO
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.
- DHHJ
- Posts : 8
Join date : 2013-03-14
Re: Help with Variables
Fri Mar 29, 2013 1:47 am
Nice try but....
[error] Threw an exception: tinyMCE is not defined
[error] Threw an exception: tinyMCE is not defined
- ccoxMaster
- Posts : 205
Join date : 2012-01-06
Age : 39
Location : Denver, CO
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
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
- DHHJ
- Posts : 8
Join date : 2013-03-14
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?
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?
Permissions in this forum:
You cannot reply to topics in this forum
|
|