[IDE] Exporting ${variable} no longer working

62 views
Skip to first unread message

Ovidiu Dumitrescu

unread,
Apr 29, 2016, 10:26:47 AM4/29/16
to Selenium Users
Hello.

I am using Selenium IDE.
The following line in a test case:
<tr>
 
<td>type</td>
 
<td>id=inboxfield</td>
 
<td>${userID}</td>
</tr>
used to give the following result when exported to Ruby/Rspec/Webdriver:
@driver.find_element(:id, "inboxfield").send_keys userID

But suddenly, for some reason, it's now exporting:
@driver.find_element(:id, "inboxfield").send_keys "${userID}"

Is anyone else having this problem? How do I fix it?

Thank you for reading.

Ovidiu Dumitrescu

unread,
Apr 29, 2016, 10:41:00 AM4/29/16
to Selenium Users
PS: This is happening with all export types, not just the Ruby example I gave. 

Ovidiu Dumitrescu

unread,
Apr 29, 2016, 11:42:00 AM4/29/16
to Selenium Users
Ok. So now it's working on and off. With the same file and the same export oprion it's sometimes exporting the variable correctly and sometimes as ${userID}.

JJan

unread,
Apr 29, 2016, 5:20:38 PM4/29/16
to Selenium Users
What OS/browser/version are you using?

Ovidiu Dumitrescu

unread,
May 3, 2016, 4:54:25 AM5/3/16
to Selenium Users
On Saturday, April 30, 2016 at 12:20:38 AM UTC+3, JJan wrote:
What OS/browser/version are you using?

Win XP/FF 45.0.1 and also Win 8.1/FF 45.01

The problem seems to appear only when in the test case there is no 'store' function before I want to use the value of the variable.
I want to use a variable from another test case.
So I have 2 test cases:
1:
<tr>
 
<td>store</td>
 
<td>javascript{''+(new Date()).getTime()}</td>
 
<td>userID</td>
</tr>

2:
<tr>
 
<td>type</td>
 
<td>id=inboxfield</td>
 
<td>${userID}</td>
</tr>

This second test case sometimes gets exported correctly and sometimes not.

Ovidiu Dumitrescu

unread,
May 6, 2016, 5:42:30 AM5/6/16
to Selenium Users
I figured it out in the meantime.

The default export js does not cover this case.
It needs to declare a variable before using it. I did this by adding a line in the following code inside the xlateArgument function:

else if ((r = /\$\{/.exec(value))) {
   
var regexp = /\$\{(.*?)\}/g;
   
var lastIndex = 0;
   
while (r2 = regexp.exec(value)) {
     
var key = xlateKeyVariable(r2[1]);

the line:
addDeclaredVar(''+r2[1]);

The corrected code:
else if ((r = /\$\{/.exec(value))) {
   
var regexp = /\$\{(.*?)\}/g;
   
var lastIndex = 0;
   
while (r2 = regexp.exec(value)) {
      addDeclaredVar
(''+r2[1]);
   
  var key = xlateKeyVariable(r2[1]);



Reply all
Reply to author
Forward
0 new messages