Search
 
 

Display results as :
 


Rechercher Advanced Search

Latest topics
» Selenium WebDriver Integration
Today at 1:06 pm by azharuddin

» how to connect DB in selenium webriver
Fri Oct 06, 2017 4:09 pm by anbarasi

» How find any text in browser screen and click on it?
Thu Oct 05, 2017 2:02 pm by sandeepkommineni

» Selenium Webdriver
Tue Oct 03, 2017 1:35 pm by PiyushBiswas

» GRID setup tutorial.
Wed Sep 27, 2017 4:29 pm by johnyapp

» Drag & Drop Between Windows Using Selenium Driver
Wed Sep 27, 2017 2:10 pm by 26rondel

» Check if window is closed / verify input
Sat Sep 23, 2017 10:21 pm by brainstir

» How to work on pages with AJAX in selenium?
Mon Sep 18, 2017 6:08 pm by azharuddin

» pause test until user press a key like F2
Wed Aug 09, 2017 11:10 pm by djnforce

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 : 32
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 : 32
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 : 32
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 : 32
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


Sponsored content


Back to top Go down

View previous topic View next topic Back to top


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