Submitted by administrator on
add the content of another test to the current test
- target receives the page address (from selenium tests root)
- text receives vars names and their values for this test as a comma separated list of var_name=value
nested include works
selenium IDE users Note :
In selenium IDE you won't be able to play your script in the editing window but you will be able to play them in selenium TestRunner.
Please add a note "why?"... (Selenium Core and IDE use different testcase object etc.)
[Jerry Qian]: I create a Selenium-IDE capable extension edition(Selenium-IDE1.0b2). Please use attachment: includeCommand4IDE_1_1.zip
- target receives the page address (relative path from base url or use absolute path)
- text receives vars names and their values for this test as a comma separated list of var_name=value
example of use
in the test :
include | testpiece.html | name=joe,userId=3445 |
where testpiece.html contains
this is a piece of test | ||
---|---|---|
open | myurl?userId=${userId} | |
verifyTextPresent | ${name} |
as selenium reaches the include command, it will load
<location-of-TestSuite.html>/testpiece.html into you current test, replacing ${name} with joe and ${userId} with 3445
and your test will become
includeExpanded | testpiece.html | name=joe,userId=3445 |
open | myurl?userId=3445 | |
verifyTextPresent | joe |
moreover if you click on the line with "includeExpanded", it will show/hide included lines !
notes
this extension is based upon XMLHttpRequest so your browser has to support it.
license
This user extension is available as part of the public domain.
-
Dec 14, 2005
Brant LeClercq says:
It's actually better to just update the regex. baseUrl = document.URL.match(new ...
It's actually better to just update the regex.
baseUrl = document.URL.match(new RegExp("^([^?\n]+/).+$"))[1] // base uri = char - / - chars other than /Is it more appropriate just to apply any fixes and update the attachment?
-
Dec 22, 2005
Philip Tran says:
First of all, thanks Thoughtworks people for sharing a great UAT tool. Second, ...
First of all, thanks Thoughtworks people for sharing a great UAT tool.
Second, some reports with the include command:
Got a bug when passing stored variables to the parameter list, e.g.
<tr><td>store</td><td>a001</td><td>nick</td>
<tr><td>include</td><td>tests/core/createAgent.html</td><td>name=${nick}, pwd=12345</td></tr>
}}}Fix it: modify xpathExpr to accept anything in the third column instead of "text". ('cause all variables in "text" are replaced with stored values, hence "text" is no longer the same -> old xpathExpr failed).
New xpathExpr:
var xpathExpr = "//td/preceding-sibling::td[contains(text(),'" + locator + "')]/preceding-sibling::td[text()='include']/parent::tr"
Return if locateElementByXPath failed:
...
var includeCmdRow = PageBot.prototype.locateElementByXPath(xpathExpr, testDocument); //if (!includeCmdRow) return
...------------------------
MERRY X'MAS TO EVERYONE -
Jan 12, 2006
Peter Bernier says:
Could someone please post an updated version of user-extensions.js.sample ? I've...
Could someone please post an updated version of user-extensions.js.sample ? I've made the above changes and I'm still having issues.
Guillaume, I believe SVN Changeset above requires other changes as I'm getting a 'currentTest' is undefined error...
(Or if I'm completely wrong on this, and someone can correct me, I'd appreciate it).
Also, I haven't been able to track down the root cause, I'm seeing behaviour where nested includes (in my tests) work in Firefox, but not in IE (6.0.2800). (The tests included with the package do pass however...)
Thanks for the great work, this is a terrific extension to Selenium.. (previously I was using server-side includes to achieve the same results...)
-
Jan 27, 2006
Eustache says:
Just spent some time trying to debug a problem with include command resulting in...
Just spent some time trying to debug a problem with include command resulting in : "'document.URL.match(...).1' is null or not an object"
Actually this is because we were calling the tests without specifying any file name like http://localhost/qa/
It works if we call http://localhost/qa/index.html
It is also strange that we have to use ./path/testfile.html and not /path/testfile.html which will fail resulting in a "not found"
-
Feb 16, 2006
Andy Lawrence says:
I have attached a patch against 0.6.0 containing the fixes mentioned above (http...
I have attached a patch against 0.6.0 containing the fixes mentioned above (http://wiki.openqa.org/display/SEL/include?focusedCommentId=326#comment-326
and http://wiki.openqa.org/display/SEL/include?focusedCommentId=352#comment-352)as well as another fix I made which was to include support for tests located in subdirectories. That is, I had a URL like so: http://localhost:7001/selenium/TestRunner.html?test=andy/TestSuite-andy.html and wanted to include a file (with a relative path name) that is also in the andy directory.
Patch can be found here: http://wiki.openqa.org/download/attachments/283/subdir.patch
Enjoy
-
Mar 17, 2006
alex says:
I have attached a new version of selenium. It integrates all the patches list...
I have attached a new version of selenium.
- It integrates all the patches listed above.
- you can include tests with a complete http url (say http://localhost:8000/selenium/tests/myTest.html)
- works with selenium IDE in 'play in selenium runner' mode (see above)
-
Jun 29, 2006
Sandy Demi says:
The include extension is working great on Firefox. But it fails with IE.&n...
The include extension is working great on Firefox. But it fails with IE. When executed in Test Runner, the commands in the included file are lost; I only see two columns, which contain the target and value.
The error message is: 'currentTest.currentRow.cells.2' is null or not an object
Any workaround for this?
-
Jul 06, 2006
Sandy Demi says:
The changes in this portion of the code work for me. I'm sure the code cou...
The changes in this portion of the code work for me. I'm sure the code could be improved, but I don't have time right now...
// first element is empty -> j=1 // sdemi: changed j=1 to j=0 to insert command in first column for (var j = 0 ; j < testCols.length; j++) { var newCol = testDocument.createElement("td") var colText = testCols[j] newCol = targetRow.appendChild(newCol) newCol.innerHTML = colText } // sdemi: if row has only 2 columns, add empty third column if (testCols.length < 3) { var newCol = testDocument.createElement("td") var colText = testCols[j] newCol = targetRow.appendChild(newCol) newCol.innerHTML = "" }
-
Aug 10, 2006
lance says:
try &nb...
try
Unknown macro: { targetRow.innerHTML = newText; }catch (e)
{
// doing it the hard way for ie
// parsing column, doing column per column insertion
//lance fix the display issue in IE 07/13/2006
// remove < td>
newText = newText.replace(/<\s*td[^>]*>/ig,"");
// split on < /td>
var testCols = newText.split(/<\/\s*td[^>]*>/i);
// first element is empty -> j=1
//for (var j = 0 ; j < testCols.length; j++)
for (var j = 0 ; j < 3; j++)
Unknown macro: { var newCol = testDocument.createElement("td"); var colText = testCols[j]; if(colText == undefined) colText = ""; newCol = targetRow.appendChild(newCol); newCol.innerHTML = colText; }}
newRows.push(newRow);
} -
Aug 16, 2006
Raja says:
Hello all, Hey guys, gone through the Selenium RC and found a really nice tool....
Hello all,
Hey guys, gone through the Selenium RC and found a really nice tool.
Well I have a small doubt. I want to do data driven test for my web application.
I tried the below following steps:
In my script, I added manually the data using store command and executed it worked fine.
Now what I want is if I have more than 1000 record, do i need to store all the 1000 records in my script? I hope this is disgusting... Well I should not... Can you please let me know how do I call all the 1000 records from a file (include and CSV). Please give me a bullet example.
Thanks,
Raja (From TP)
-
Aug 16, 2006
Konrad Pawlus says:
Hi, I have version 1.3 of include, in Selenium IDE I'm geting such error messag...
Hi,
I have version 1.3 of include, in Selenium IDE I'm geting such error message:
[info] Executing: |include | http://localhost:8080/selenium/tests/helpRegisterUser.html | email=new1@register.com,nickname=new1 |
[error] Unexpected Exception: message -> testDocument not avalaible., fileName -> file:///C:/work/projects/mindmatcher/v0.1/friendswebapp/resources/selenium/scripts/user-extensions.js, lineNumber -> 87, stack -> Error("testDocument not avalaible.")@:0 ("http://localhost:8080/selenium/tests/helpRegisterUser.html","email=new1@register.com,nickname=new1")@file:///C:/work/projects/mindmatcher/v0.1/friendswebapp/resources/selenium/scripts/user-extensions.js:87 call([object Object],"http://localhost:8080/selenium/tests/helpRegisterUser.html","email=new1@register.com,nickname=new1")@:0 ([object Object],[object Object])@chrome://selenium-ide/content/selenium/scripts/selenium-commandhandlers.js:306 ()@chrome://selenium-ide/content/selenium/scripts/selenium-executionloop.js:107 ()@chrome://selenium-ide/content/selenium/scripts/selenium-executionloop.js:78 @chrome://selenium-ide/content/selenium/scripts/selenium-executionloop.js:68 , name -> Error
I tried to look at the line 87, and then at special future for IDE (document.URL.match(/^chrome:/))
Unfortunately - no results
Someone knows what the problem can be?Best regards
Konrad -
Sep 14, 2006
Yelena says:
Hi, I'm a little bit confused. Following the comments i had the idea that this ...
Hi,
I'm a little bit confused. Following the comments i had the idea that this extension works also for Selenium IDE, but then i tried it and it didn't work (similar error as the comment before). Can somebody guide me in this? Can I use this in IDE and if yes, why would the error be? It looked like the source path error, but i've tried everything, still no satisfying results.
Thanks in advance,
Yelena
-
Sep 28, 2006
Robert Zimmermann says:
This is a quick fix. For me it works. I am not sure if this is the right solutio...
This is a quick fix. For me it works. I am not sure if this is the right solution.
I made the following changes to get this extension work with selenium 0.8.0:
user-extensions.js.sample (the include extension):
replace:testDocument = getIframeDocument(getTestFrame())
with:
testDocument = testFrame.getDocument()
root cause:
the function getIframeDocument() has been removed from selenium-core (selenium-testrunner.js)Robert
-
Sep 28, 2006
Robert Zimmermann says:
The fix I posted is incomplete. My previous post fixes loading of the tests, bu...
The fix I posted is incomplete.
My previous post fixes loading of the tests, but selenium skips the included test rows from execution.
I'll try to find the cause and after that a possible solution for that.
Robert
-
Sep 29, 2006
Robert Zimmermann says:
To get the included rows executed in selenium 0.8.0 use following patch. Make su...
To get the included rows executed in selenium 0.8.0 use following patch.
Make sure to apply the change I previously posted first.Only tested with firefox 1.5
- newRows.push(newRow) + //(rz WEB.DE) changed to work with selenium 0.8.0 + newRows.push(new HtmlTestCaseRow(newRow)) } // for selenium > 0.6 try { - currentTest.commandRows = newRows.concat(currentTest.commandRows) + //(rz WEB.DE) changed to work with selenium 0.8.0 + // Leave previously run commands as they are + seleniumCmdRowsPrev = currentTest.htmlTestCase.commandRows.slice(0, currentTest.htmlTestCase.nextCommandRowIndex) + seleniumCmdRowsNext = currentTest.htmlTestCase.commandRows.slice(currentTest.htmlTestCase.nextCommandRowIndex) + newCommandRows = seleniumCmdRowsPrev.concat(newRows) + + // New commandRows with the included ones + currentTest.htmlTestCase.commandRows = newCommandRows.concat(seleniumCmdRowsNext)
-
Oct 10, 2006
rajesh says:
hi, I have applied both the patches mentioned in the thread and when I run the t...
hi, I have applied both the patches mentioned in the thread and when I run the test through TestRunner it is giving:
- debug: Command found, going to execute include
- error: Unexpected Exception: message -> Error while fetching file://H:/Regression%20Testing/includeCommand/SeleniumSampleTest-1.html server response has status = 0, , fileName -> file:///H:/Regression%20Testing/includeCommand/user-extensions.js, lineNumber -> 152, stack -> Error("Error while fetching file://H:/Regression%20Testing/includeCommand/SeleniumSampleTest-1.html server response has status = 0, ")@:0 ("SeleniumSampleTest-1.html","")@file:///H:/Regression%20Testing/includeCommand/user-extensions.js:152 call([object Object],"SeleniumSampleTest-1.html","")@:0 ([object Object],[object Object])@chrome://selenium-ide/content/selenium/scripts/selenium-commandhandlers.js:296 ()@chrome://selenium-ide/content/selenium/scripts/selenium-executionloop.js:110 (21)@chrome://selenium-ide/content/selenium/scripts/selenium-executionloop.js:78 apply([object Object],[object Array])@:0 (21)@chrome://selenium-ide/content/selenium/lib/prototype.js:48 @:0 , name -> Error
- warn: currentTest.recordFailure: Selenium failure. Please report to selenium-dev@openqa.org, with error details from the log window. The error message is: Error while fetching file://H:/Regression%20Testing/includeCommand/SeleniumSampleTest-1.html server response has status = 0,
I used the BaseUrl: file://H:/Regression Testing/includeCommand/ and <td>include</td><td>SeleniumSampleTest-1.html</td> in my master script
Please let me know how to solve this error, is it a problem with the extension or the way in which I approach it???
Thanks & regards,
Rajesh -
Oct 12, 2006
rajesh says:
include user-extension worked when I hosted my selenium scripts in a server, whi...
include user-extension worked when I hosted my selenium scripts in a server, which I'm calling from my master script. Then in my master test script where I call my hosted script using include cmd which accepts only the HTTP request as of now, like http://localhost:8080/Selenium/testscript.html
I would like to know, how we can use include extension to fetch the script from the local disk using file:/// protocol???? I beleive in this case we have to modify the include user extension to accept the request from generic protocol.
Anyone working on this, please do share your knowledge on the same...
Thanks & regards,
Rajesh -
Oct 17, 2006
Robert Zimmermann says:
Solution to use include with file:// replace: if ( requester.status != 200 ...
-
Oct 23, 2006
Robert Zimmermann says:
I am currently refactoring the include command to: be easier to maintain work...
I am currently refactoring the include command to:
- be easier to maintain
- work in IE (currently an complex xpath will cause IE to hang in an busy loop)
- use as many fixes posted here as I am aware of
- use more selenium functionality and so do less by it's own
- ... and more
Someone interested in this work?
I would package an, say "includeCommand_2_0.zip"
Is there interest in updates to include?
Does the original author (alex?) agree with that?
Robert
-
Nov 22, 2006
Vijay says:
Hi, We are currently using Selenium Core 0.8.1 on our project. Is anyone working...
Hi, We are currently using Selenium Core 0.8.1 on our project. Is anyone working on tweaking the user-extension.js file to make the include command work on Selenium Core 0.8.1?
Also, it would be awesome if its tweaked to work on IE.
Robert seems to be working on refactoring the include command. I am curious to know as to how far have you got with the refactoring.Vijay
-
Nov 23, 2006
Robert Zimmermann says:
As always I am short of time to work on the include command 2.0 I will try to b...
As always I am short of time to work on the include command 2.0
I will try to block some time today to package and upload the current work, which contains many fixes.
sorry for the delay
robert
-
Nov 23, 2006
Robert Zimmermann says:
I have attached a raw user-extensions.js (named user-extensions.js.includeComman...
I have attached a raw user-extensions.js (named user-extensions.js.includeCommand_2_0_alpha) wich should contain all fixes posted previously.
It should work in IE, though I have some problems with the file protocol in IE.
As soon as I have a little more time for this I will package a fully zip.
Also it works with selenium 0.8.0 and 0.8.1
It does not work with seleniumRC and I did not test it with seleniumIDE
robert
-
Dec 12, 2006
Robert Zimmermann says:
I've just attached version 2.1 of includeCommand as a full zip. since 2.0-alpha...
I've just attached version 2.1 of includeCommand as a full zip.
since 2.0-alpha there are a some new fixes mainly in constructing urls.
take a look at the tests for more examples (and most of the fixes/enhances)
the testsuite is adjusted to run with selenium 0.8.2
- I have left (commented out) the old open-urls to run it with previous releases of selenium
tested with firefox 1.5.08 and firefox 2.0
Not (yet) tested:
- IE and other user-agents
- seleniumRC nor seleniumIDE - though the fixes in constructing urls are to get this working
note: I changed the naming after inclusion, to be able to re-run already run tests
- -included changed to includeExpanded
- +included to includeCollapsed
robert
-
Dec 27, 2006
malthusian says:
Hi. Fooling around with using include 2.1 with IDE without immediate luck. I did...
Hi. Fooling around with using include 2.1 with IDE without immediate luck. I did notice that the fix mentioned above to get file:/// protocol working (http://wiki.openqa.org/display/SEL/include?focusedCommentId=1425#comment-1425) has a typo in the .js file on line 292; "!=="
When I fix that, it doesn't quite work but I get the refactoring work in progress warn from rz. It'd rock to be able to use this extension with IDE and the file:/// protocol.
-
Jan 04, 2007
Robert Zimmermann says:
"!==" is not an typo, read this for details: http://developer.mozilla.org/en/doc...
"!==" is not an typo, read this for details: http://developer.mozilla.org/en/docs/Core_JavaScript_1.5_Reference:Operators:Comparison_Operators
Could You give me more details what is not working?
Testing include with seleniumIDE (and other like seleniumRC) is still on my todo list.
-
Jan 08, 2007
malthusian says:
Ah... I'm not a Javascript person and didn't know about the strict equals. It wa...
Ah... I'm not a Javascript person and didn't know about the strict equals. It was a strange assumption for to make that this was a typo, I should have paid closer attention.
When running a script with the include command from the chrome testrunner, I get:
warn currentTest.recordFailure: Selenium failure. Please report to selenium-dev@openqa.org, with error details from the log window. The error message is: Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) nsIXMLHttpRequest.send
IDE also doesn't show/hide, and complains about user-extensions.js. Unfortunately I can't post much of the log output on this wiki without it getting really garbled, but if you want I could send it to you in a different medium.
-
Jan 09, 2007
Robert Zimmermann says:
Could You post the url your are using with include? and if it is relative the ba...
Could You post the url your are using with include?
and if it is relative the base url you are using in seleniumIDE? -
Jan 09, 2007
malthusian says:
The message from above is from using chrome://selenium-ide/content/selenium/Tes...
The message from above is from using
chrome://selenium-ide/content/selenium/TestRunner.html?baseURL=http://localhost&test=file:///c:/selenium/includeCommand_2_1/tests/includecommand/testsuite.html&userExtensionsURL=file:///c:/selenium/includeCommand_2_1/user-extensions.js&auto=true
The test file and the user-extensions.js are the ones from the zip. I don't know what you mean about the relative url in IDE
-
Jan 10, 2007
Robert Zimmermann says:
ok, i see. there are a couple of bugs in handling urls with the chrome protocol....
ok, i see.
there are a couple of bugs in handling urls with the chrome protocol.as a workaround you could change your url slightly to get it work:
chrome://selenium-ide/content/selenium/TestRunner.html?test=file:///c:/selenium/includeCommand_2_1/tests/includecommand/testsuite.html&baseURL=file:///c:/selenium/includeCommand_2_1/tests/&userExtensionsURL=file:///c:/selenium/includeCommand_2_1/user-extensions.js&auto=true
does this work for you?
the bugs are in handling the baseUrl:
1. baseUrl is not expected to be the first call-parameter
2. baseUrl is expected to end with a slash ("/")i think not a bug is:
- baseUrl has to point to the directory containing TestSuite.html
thanks for reporting
-
Jan 10, 2007
Robert Zimmermann says:
correction: the explanation is right, but the expample url is not: chrome://sel...
correction: the explanation is right, but the expample url is not:
chrome://selenium-ide/content/selenium/TestRunner.html?test=file:///c:/selenium/includeCommand_2_1/tests/includecommand/testsuite.html&baseURL=file:///c:/selenium/includeCommand_2_1/tests/includeCommand/&userExtensionsURL=file:///c:/selenium/includeCommand_2_1/user-extensions.js&auto=true
so now: does this work for you?
-
Jan 10, 2007
malthusian says:
Haha. That does work. Thanks for the explanation.
Haha. That does work. Thanks for the explanation.
-
Feb 02, 2007
Sandy Demi says:
Version 2.1 is not working correctly for me with IE (v6.0). I have 'open' comma...
Version 2.1 is not working correctly for me with IE (v6.0). I have 'open' commands in my include file that are ignored during execution. (They were executed with the old include extension.)
-
Feb 05, 2007
Robert Zimmermann says:
Hello Sandy, Could You post exapmles, so I can reproduce this problem?
Hello Sandy,
Could You post exapmles, so I can reproduce this problem?
-
Feb 05, 2007
Sandy Demi says:
Sure. I have a setup.html file that I include at at the beginning of every test...
Sure. I have a setup.html file that I include at at the beginning of every test, similar to the following:
deleteCookie JSESSIONID /test setTimeout 30000 open <baseURL>/logout open <baseURL> storeText name=test test-name When I run my test, the included rows appear, but the 'open' commands are not executed. The rows remain white in the test table, and there are no 'info: Executing: | open | ...' calls logged to the console.
After looking at this again, I see that the setTimeout command is not executed either. Maybe the 2-column rows aren't getting added to the execution stack?
-
Feb 06, 2007
Robert Zimmermann says:
Maybe the 2-column rows aren't getting added to the execution stack? Yes, that'...
Maybe the 2-column rows aren't getting added to the execution stack?
Yes, that's a selenium feature.
Only rows with at least 3 columns are treated as selenium commands. -
Feb 06, 2007
Sandy Demi says:
I don't get it. Are you saying that 'setTimeout' and 'open' are not selenium co...
I don't get it. Are you saying that 'setTimeout' and 'open' are not selenium commands?
All of the rows in my included file (setup.html) are executed in Firefox. It's only in IE that the 2-column rows are not executed.
-
Feb 07, 2007
Robert Zimmermann says:
I don't know why it is only in IE in your case. But any row less than 3 columns ...
I don't know why it is only in IE in your case.
But any row less than 3 columns is treated as an comment by selenium, so does include.Did you try it with all rows having 3 columns?
Which selenium version are you using?
-
Feb 07, 2007
Sandy Demi says:
I'm using SC 0.8.2. I think I caused some confusion by saying that the row has...
I'm using SC 0.8.2.
I think I caused some confusion by saying that the row has 2 columns. The HTML table row does have 3 columns, but it only has values in the first 2:
<tr>
<td>setTimeout</td>
<td>60000</td>
<td></td>
</tr>I tried putting a dummy value in the 3rd column (even though the setTimeout command doesn't require a value in the 3rd column):
<tr>
<td>setTimeout</td>
<td>60000</td>
<td>blah</td>
</tr>In this case, the included row is executed correctly on IE. So with IE, included files that contain a 3-column row with an empty 3rd column treat the row as if it only had 2 columns. Weird.
-
Feb 08, 2007
Robert Zimmermann says:
It seems that IE removes empty table columns. I recommend putting an ...
It seems that IE removes empty table columns.
I recommend putting an in empty columns.
-
Feb 08, 2007
steve dunning says:
Tried the Chrome URL noted above for running a script with and include statement...
Tried the Chrome URL noted above for running a script with and include statement in IDE testrunner but get an "Unknown command: 'include'" error. I set the Selenium Core Extensions setting to point the the appropriate include_command user-extensions.js file.
What am I missing, is there some other configuration needed to get include_command to work with the IDE?
-
Feb 09, 2007
Robert Zimmermann says:
If You get an "Unknown command" your path to or the user-extension.js itself see...
If You get an "Unknown command" your path to or the user-extension.js itself seems to be wrong.
Did You check the paths and the user-extension.js?
-
Feb 15, 2007
steve dunning says:
Should I have the include_command js listed in the IDAE's options\Selenium Core ...
Should I have the include_command js listed in the IDAE's options\Selenium Core path? Interestingly, I get an error when starting the IDE "Failed to load user-extensions.js! files=... error=ReferenceError: HtmlRunner TestLoop is not defined"
The path and file are valid as the extension does work when using Selenium core.
-
Feb 15, 2007
Robert Zimmermann says:
OK, I see The include Command is not designed to work inside the IDE, as includ...
OK, I see
The include Command is not designed to work inside the IDE, as include uses the HTMLTestRunner to inject the included rows.
However the HTMLTestRunner is not available inside the IDE. -
Mar 02, 2007
Robert Zimmermann says:
The baseURL does not have to be a file. Can also be http.
The baseURL does not have to be a file. Can also be http.
-
Mar 16, 2007
Don Vawter says:
I am getting a 404 error. The calling and called scripts are in the same directo...
I am getting a 404 error. The calling and called scripts are in the same directory. The error is:
Selenium failure. Please report to selenium-dev@openqa.org, with error details from the log window. The error message is: Error while fetching http://10.77.62.197:83/selenium/core//ctc-selenium/tests/logon.html server response has status = 404, Not Found
The calling script has:
<table><tr><td>include</td><td>logon.html</td><td>userid=TEST01,password=TestPW01,username=TEST USER</td></tr></table>The contents of the dir are:
/tandem/web_applications/ctc/ctc83/webserver/root/ctc-selenium/tests: ls -ltr
total 108rw-rw-rw1 SUPER.WEBMASTR SUPER 6315 Dec 5 18:09 TestUserMaintenance.htmlrw-rw-rw1 SUPER.WEBMASTR SUPER 7790 Dec 6 15:31 TestSecurityMaintenance.htmlrw-rw-rw1 SUPER.WEBMASTR SUPER 6957 Dec 21 20:26 TestSimulationEnvironment.htmlrw-rw-rw1 SUPER.WEBMASTR SUPER 4806 Jan 2 16:34 TestUploadFiles.htmlrw-rw-rw1 SUPER.WEBMASTR SUPER 3483 Jan 2 20:59 TestAutoScriptSetup.htmlrw-rw-rw1 SUPER.WEBMASTR SUPER 3984 Jan 9 17:11 TestSystemManager-ExtSystemMgmt.htmlrw-rw-rw1 SUPER.WEBMASTR SUPER 7360 Jan 16 17:18 TestManualScriptSetup.htmlrw-rw-rw1 SUPER.WEBMASTR SUPER 2239 Mar 14 17:44 TestIncorrectLogin.htmlrw-rw-rw1 SUPER.WEBMASTR SUPER 3838 Mar 14 18:41 TestSuite.htmlrw-rw-rw1 SUPER.WEBMASTR SUPER 2835 Mar 14 20:30 TestAddUser.html
drwxrwxrwx 1 SUPER.WEBMASTR SUPER 4096 Mar 16 15:20 snippetsrw-rw-rw1 SUPER.WEBMASTR SUPER 647 Mar 16 15:25 logon.htmlrw-rw-rw1 SUPER.WEBMASTR SUPER 640 Mar 16 15:26 TestLogin-LogoutFunctions.htmlThe calling page is: http://10.77.62.197:83/selenium/core/TestRunner.html?test=%2Fctc-selenium%2Ftests%2FTestSuite.html&multiWindow=on&resultsUrl=..%2FpostResults
Any clues?
TIA -
Mar 16, 2007
Robert Zimmermann says:
if you are using includeCommand_2_1 then have a look at the log window. include ...
if you are using includeCommand_2_1 then have a look at the log window.
include command should write the url it is using to get the tests to include.
is this url correct? -
Mar 16, 2007
Don Vawter says:
It appears the constructed url has a double slash notice selenium/core//ctc-tes...
It appears the constructed url has a double slash notice selenium/core//ctc-tests...
If I put in absolute url that works but I have other issues (will add as a separate comment to keep things clean)debug: IncludeCommand: include URL seems to be relative determined baseUrl='http://10.77.62.197:83/selenium/core/'
debug: IncludeCommand: using url to get include document='http://10.77.62.197:83/selenium/core//ctc-selenium/tests/logon.html'
error: Unexpected Exception: Error while fetching http://10.77.62.197:83/selenium/core//ctc-selenium/tests/logon.html server response has status = 404, Not Found
error: Exception details: name -> Error, description -> Error while fetching http://10.77.62.197:83/selenium/core//ctc-selenium/tests/logon.html server response has status = 404, Not Found, message -> Error while fetching http://10.77.62.197:83/selenium/core//ctc-selenium/tests/logon.html server response has status = 404, Not Found
warn: currentTest.recordFailure: Selenium failure. Please report to selenium-dev@openqa.org, with error details from the log window. The error message is: Error while fetching http://10.77.62.197:83/selenium/core//ctc-selenium/tests/logon.html server response has status = 404, Not Found -
Mar 16, 2007
Don Vawter says:
The first two commands of my include file are not being executed: Here is calli...
The first two commands of my include file are not being executed:
Here is calling code:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>TestLogin-Admin</title>
</head>
<body>
<table>
<tr>
<td>include</td>
<td>http://10.77.62.197:83/ctc-selenium/tests/logon.html</td>
<td>userid=TEST01,password=TestPW01,username=TEST USER</td>
</tr>
<tr>
<td>clickAndWait</td>
<td>link=Logout</td>
<td></td>
</tr>
<tr>
<td>selectWindow</td>
<td>null</td>
<td></td>
</tr>
<tr>
<td>waitForTextPresent</td>
<td>Password:</td>
<td></td>
</tr>
</table>
</body>
</html>Here is the include file:
<table>
<tr>
<td>open</td>
<td>http://10.77.62.197:83/servlet_jsp/CTC/form/login.jsp</td>
<td> </td>
</tr>
<tr>
<td>type</td>
<td>username</td>
<td>$Unknown macro: {userid}</td>
</tr>
<tr>
<td>type</td>
<td>password</td>
<td>$Unknown macro: {password}</td>
</tr>
<tr>
<td>clickAndWait</td>
<td>link=Login</td>
<td></td>
</tr>
<tr>
<td>selectFrame</td>
<td>id=ctcHeader</td>
<td></td>
</tr>
<tr>
<td>assertTextPresent</td>
<td>Welcome to Centralized Translations Control, $Unknown macro: {username}</td>
<td></td>
</tr>
</table>The first thing that happens is it tries to type in a password. It never opens the page. The include file works fine as a standalone (of course it fails the test because it is using $
as the user rather than evaluating it but the test still runs.
Probably a newb error on my part but I am stumped.
-
Mar 19, 2007
Robert Zimmermann says:
Did You try to use the url on it's own in an separate browser window: http://10....
Did You try to use the url on it's own in an separate browser window: http://10.77.62.197:83/selenium/core//ctc-selenium/tests/logon.html
is it really the double "/" the causes the error or is the whole location wrong?
-
Mar 19, 2007
Robert Zimmermann says:
The problem with the two not executed commands is the third empty column. try to...
The problem with the two not executed commands is the third empty column.
try to put an in empty columns. -
Mar 19, 2007
Don Vawter says:
You are correct that the double / is not the issue, the whole url is is wrong. G...
You are correct that the double / is not the issue, the whole url is is wrong. Guess I was sleepy when I looked at it. the http://10.77.62./197:83 is correct as is /ctc-selenium/tests/logon.htl but in between the "/seleinum/core/" shouldn't be there.
-
Mar 19, 2007
Don Vawter says:
--The problem with the two not executed commands is the third empty column. --tr...
--The problem with the two not executed commands is the third empty column.
--try to put an in empty columns.There are three columns already.
<td>open</td>
<td>http://10.77.62.197:83/servlet_jsp/CTC/form/login.jsp</td>
<td> </td>and
<td>TYPE</td><td>username</td><td>dollar brace userid brace</td> -
Mar 19, 2007
Don Vawter says:
there is a nonbreaking space in that table but the wiki is rendering it as a spa...
there is a nonbreaking space in that table but the wiki is rendering it as a space
-
Mar 19, 2007
Robert Zimmermann says:
--The first two commands of my include file are not being executed The only cau...
--The first two commands of my include file are not being executed
The only cause I can think of is: is your to be included testtable written the same way as any other selenium testtable?
is there an tbody element (important for usage in IE)
do you have an heading row (as in normal selenium testcases the first row is treated as an heading and ignored in execution, so does include)--Url construction in include command:
If I understand right absoulte urls do work
Using relative urls be aware, that the url to get the document to be included is treated relative to Your TestSuite
So the url is constructed like this: <URL-to-TestSuite.html>/<relative-include-URL>hope that helps.
-
Mar 19, 2007
Don Vawter says:
Thanks for your help. All issues are now resolved. All were newb operator errors...
Thanks for your help. All issues are now resolved. All were newb operator errors: a) relative url didnt have leading / so was relative to selenium/core b) include file did not have a heading row or a tbody
-
Mar 28, 2007
steve dunning says:
I am launching the testrunner using the chrome protocol with the test parameter ...
I am launching the testrunner using the chrome protocol with the test parameter pointing to a file location and the baseURL parameter pointing to an http address. Selenium runs fine but include is having a problem it is trying to find my include script relative to the baseURL and not the test file location. Is there a way to tell include to look in the same location that the test script is running from?
Example chrome url:
chrome://selenium-ide/content/selenium/TestRunner.html?test=file:///D:/ivhm/sdsapps/apps/ivhm/web/test_scripts/TestSuite-IVHM.html&baseURL=http://localhost:8080/ivhm/&userExtensionsURL=file:///D:/ivhm/sdsapps/apps/ivhm/web/core/scripts/user-extensions.js&auto=falseSelenium log message:
debug: IncludeCommand: using url to get include document='http://localhost:8080/ivhm/manage-create-mission.html'
error: Unexpected Exception: Error while fetching http://localhost:8080/ivhm/manage-create-mission.html server response has status = 404, /ivhm/manage-create-mission.htmlAs you can see it is trying to load the file from the http address when I really want it to get it from the test script location.
Thanks in advance for any assistance.
Regards,
Steve -
Mar 29, 2007
Robert Zimmermann says:
In chrome mode the baseURL is always the first part of the composed include url ...
In chrome mode the baseURL is always the first part of the composed include url even if the include url is absolute.
I will put this on the todo list, but it may take some time to be done.
You could try to adjust it yourself. The function to look at is IncludeCommand.prepareUrl
-
Mar 30, 2007
steve dunning says:
I modified the prepareUrl function to use the path in the 'test' parameter when ...
I modified the prepareUrl function to use the path in the 'test' parameter when chrome: is being used AND also a new parameter 'getUrlFromTestDir' is equal to true. I felt that using a new URL parameter was the least intrusive option for setting a new test condition. The code could probably stand to be refactored but it does work.
This modification currently meets my needs. Feel free to use, abuse, or ignore my input as you see fit though. I will attach my js file to this wiki thread as user-extensions.js.includeCommand_2_1.modified
Regards,
Steve -
Mar 30, 2007
Robert Zimmermann says:
Thanks Steve, I will take a look at this as soon as I have some time for it.
Thanks Steve, I will take a look at this as soon as I have some time for it.
-
May 03, 2007
Chris Astall says:
There are few comments on here about IE not always expanding an include properly...
There are few comments on here about IE not always expanding an include properly and Robert mentions that it's because the third column has a blank between the td start and end tags (i.e. <td></td> ). He states that if a is put between the tags this will solve the problem.
It does however I have a large number of scripts and didn't fancy changing them all from <td></td> to <td> </td> so have fixed the code to do it.
What you need to do is change the IncludeCommand.prepareTestCaseAsText method to include the following:
// Replace <td></td> with <td> </td> for IE testText = testText.replace(/<\s*td[^>]*>\s*<\s*\/td[^>]*>/ig,"<td> </td>");
between the
// Replace <td></td> with <td> </td> for iE testText = testText.replace(/<\s*td[^>]*>\s*<\s*\/td[^>]*>/ig,"<td> </td>");
and
// LOG.debug(IncludeCommand.LOG_PREFIX + "replace vars with their values in testText");
Hope this helps
Chris.
-
May 04, 2007
Robert Zimmermann says:
Thanks Chris, I'll give Your fixes a try.
Thanks Chris, I'll give Your fixes a try.
-
Jun 17, 2007
dhwang says:
I had trouble using include command in IE6. The document.URL seems to give URL ...
I had trouble using include command in IE6. The document.URL seems to give URL with windows "\" path. So, the url "file://c:/dir/blah" became "file://c:\dir\blah".
"The complete Javascript Reference" book suggest that developer not rely on mapping of windows.location with document object's equivalent.
I changed it to use windows.location.href instead.
-
Jul 10, 2007
dhwang says:
in IE 7 when Native XMLHTTP is enabled. Include command is failing with "Access ...
in IE 7 when Native XMLHTTP is enabled. Include command is failing with "Access Denied" on a file:/// URL, security feature I suppose.
So I changed the order of XMLHTTP creation to check for ActiveX firstIncludeCommand.newXMLHttpRequest = function() { // TODO -- should be replaced by impl. in prototype.js or xmlextras.js? var requester = 0; var exception = ''; // see http://developer.apple.com/internet/webcontent/xmlhttpreq.html // native XMLHttpRequest object try { // for IE/ActiveX if(window.ActiveXObject) { try { requester = new ActiveXObject("Msxml2.XMLHTTP"); } catch(e) { requester = new ActiveXObject("Microsoft.XMLHTTP"); } } else if(window.XMLHttpRequest) { requester= new XMLHttpRequest(); } } catch(e) { throw new Error("Your browser has to support XMLHttpRequest in order to use include \n" + e); } return requester; };
-
Jul 11, 2007
dhwang says:
Does this complete one of the TODO // TODO maybe there is an api-way to g...
Does this complete one of the TODO
// TODO maybe there is an api-way to get this element instead of digging in members //htmlTestRunner.currentTest.htmlTestCase; var currentSelHtmlTestcase = testFrame.getCurrentTestCase();
-
Jul 12, 2007
dhwang says:
Include 2.1 also cannot operate in the TestRunner.hta. I made following change t...
Include 2.1 also cannot operate in the TestRunner.hta. I made following change to prepareUrl
initialize: function() { this.queryString = document.location.search.substring(1, document.location.search.length); if (browserVersion.isHTA) { this.queryString = htmlTestRunner.controlPanel.queryString; } },
-
Jul 18, 2007
dhwang says:
No problem, I just hope I didn't break anything.. This is just a very useful ext...
No problem, I just hope I didn't break anything.. This is just a very useful extension. I know what Dan would say "..use RC.. ", but I also want to extend the idea further to TestSuite level. It would be nice to be able to see all the TestSuites at once instead of loading them one at a time.
-
Jul 18, 2007
dhwang says:
We ran into a problem regarding the construction of baseUrl from document.locati...
We ran into a problem regarding the construction of baseUrl from document.location.
When the test suite is loaded using absolute path like "test=c:/blah/foo/TestSuite.html" on IE or "test=/c:/blah/foo/TestSuite.html" for Firefox.. the URL return by prepareUrl() is wrong.prepareUrl needs to check if subdir start with /[a-z]:/ or /\// and make these into file://c:/blah baseUrl. and if subdir start with http,https,file url already then use subdir as baseUrl.
-
Aug 07, 2007
Bill says:
Hi all, I was wondering, is it still the case that this extension works with S-...
Hi all,
I was wondering, is it still the case that this extension works with S-Core but not necessarily with S-RC or IDE?
I started using selenium recently. I primarily use the IDE to create test and RC to run them.Thanks.
-
Aug 08, 2007
robertz says:
Hi includeCommand users, Release 2.2 is ready for download. There have been fo...
Hi includeCommand users,
Release 2.2 is ready for download.
There have been following fixes and updates sinces 2.1:
- URL handling has been completely replaced by using selenium-core handling of URLs. This should also fix the following suggestions:
- http://wiki.openqa.org/display/SEL/include?focusedCommentId=2292#comment-2292
- http://wiki.openqa.org/display/SEL/include?focusedCommentId=2450#comment-2450
- http://wiki.openqa.org/display/SEL/include?focusedCommentId=2480#comment-2480
Enhancements are:
- http://wiki.openqa.org/display/SEL/include?focusedCommentId=2448#comment-2448
- http://wiki.openqa.org/display/SEL/include?focusedCommentId=2440#comment-2440
- http://wiki.openqa.org/display/SEL/include?focusedCommentId=2082#comment-2082 Though I have no problems with empty rows in IE 7.0. But as it does not break something it's part of the new release.
Thanks guys for reporting and suggesting fixes.
I've tested the extension with it's own TestSuite with FF 2.0.0.6 (also with chrome) and IE 7.0 (also with HTA). I've not have an IE 6 handy so if someone could run the tests on this and post, if all tests succeed I would be thankful.
Note on selenium-IDE: There is still no code for use include in the IDE itself. Only testrunner mode will work.
-
Aug 08, 2007
Alec Munro says:
Hi Robert, Thanks for the new release, but I'm having a little problem. Regard...
Hi Robert,
Thanks for the new release, but I'm having a little problem.
Regarding line 297:
var preparedUrl = absolutify(includeUrl, selenium.browserbot.baseUrl);
selenium.browserbot.baseUrl seems to be "chrome://selenium-ide/content/" which isn't where my files are. I replaced it with this:
var preparedUrl = absolutify(includeUrl, testRunnerConfig.baseURL);
and that seems to work, at least when using the TestRunner.
Beyond that, what needs to be done to get the include command working in the IDE? We are just beginning to seriously use Selenium, and while we really need an include command, most of our users are not technically inclined, so it's very important that it "just work". As such, I would be happy to do a little development on the extension, if you could give me a little guidance.
-
Aug 09, 2007
robertz says:
– selenium.browserbot.baseUrl seems to be "chrome://selenium-ide/content/"...
– selenium.browserbot.baseUrl seems to be "chrome://selenium-ide/content/"
Sorry but I cannot reproduce this
selenium.browserbot.baseUrl points to where your TestSuite is.
All relative include URL are expected to be relative to the used TestSuite.I use the testrunner mode of S-IDE with an absolute file-url for the test-parameter (my TestSuite) and an empty baseURL-parameter. This way include works perfect.
– what needs to be done to get the include command working in the IDE
include is tightly chained with html files and the related testrunner classes in selenium-core
selenium-IDE has its own classes to handle selenese commands to be displayed in the firefox-extension windowso first of all IncludeCommand.prototype.doInclude and some of it called methods have to be refactored and adapted to the corresponding classes of IDE
-
May 20, 2008
Paul Grandjean says:
Hi Robert, I'm also having trouble using Include with the IDE Test Runner mode....
Hi Robert,
I'm also having trouble using Include with the IDE Test Runner mode. I've tinkered a lot but cannot make it work. Can you explain what you mean by...
"absolute file-url for the test-parameter"?
An example would be great.
For instance, I'm running on XP and by scripts are located in a folder under My Documents. My initial scripts runs fine but Include cannot recognize other script files in the same folder. I also see in the error message
"chrome://selenium-ide/content/"
mentioned in the previous post.
Here's the complete error....
Error while fetching url 'chrome://selenium-ide/content/EI-Footer.html' details: [Exception... "Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsIXMLHttpRequest.send]" nsresult: "0x80004005 (NS_ERROR_FAILURE)" location: "JS frame :: file:///C:/Documents%20and%20Settings/PGrandjean/My%20Documents/QA%20Docs/DynamoExtract/scripts/EI/user-extensions.js :: anonymous :: line 286" data: no]
Any help is much appreciated.
Paul
-
May 20, 2008
robertz says:
Hi Paul, First of all I'm not using include for a long time now (more than half...
Hi Paul,
First of all I'm not using include for a long time now (more than half a year), so I can not provide support for include any longer. In fact I do not even have include handy for some quick tests any more.
But trying to answer your question:
If you "play with testrunner" from S-IDE the URL has an "test" parameter pointing to an automatically generated TestSuite. As far as I can remember this path has to be absolute and must start with file://
Did you try to have your own TestSuite.html file and the test URL parameter pointing to it with an absolute file-path?
-
May 29, 2008
Paul Grandjean says:
Hi Robert, Well thanks very much for responding even while you're not using/sup...
Hi Robert,
Well thanks very much for responding even while you're not using/supporting include anymore. Much appreciated.
I still have a problem here, but it's a different error message now.
I found part of my problem in that I learned the hard way that user-extensions.js must be stored in the selenium/core/scripts folder (I had it in the current working directory).
Now it seems that include cannot locate the file it's trying to load. I get a 404 error on the include. So I'm wondering if you remember where include looks for it's files when running under the IDE-TestRunner option. Does it use the same location as the test suite?
When I get a chance I'll try to figure it out by reading your sourcecode. Still any advice you can offer will really help,
thanks
Paul
P.S. I am using include now in Selenium Core though and its working great. This will be hugely helpful. I'm hoping to have some IDE solution though as each time I improve a script I'll have to remove and thing reinsert the include statements.
-
Jan 15, 2009
olan says:
Hi Jerry, I have just tried out your includeCommand4IDE.zip but I have no...
Hi Jerry,
I have just tried out your includeCommand4IDE.zip but I have noticed the following problems:
1) apparently the statements after the include statement (in the "main" test) are executed before the included ones
2) I always get the following error message at the end of the execution
- [error] command is undefined
- [error] Unexpected Exception: message -> testCase.debugContext.currentCommand() is undefined, fileName -> chrome://selenium-ide/content/selenium-runner.js, lineNumber -> 141, stack -> ([object Object])@chrome://selenium-ide/content/selenium-runner.js:141 ()@chrome://selenium-ide/content/selenium/scripts/selenium-executionloop.js:159 ()@chrome://selenium-ide/content/selenium-runner.js:117 (-3)@chrome://selenium-ide/content/selenium/scripts/selenium-executionloop.js:79 (-3)@chrome://selenium-ide/content/selenium/scripts/htmlutils.js:60 , name -> TypeError
Any idea?
Thanks,
Olan
-
Jan 16, 2009
Jerry Qian says:
Hi Olan, Which IDE version did you use? I create extension for Selenium-IDE1.0b...
Hi Olan,
Which IDE version did you use? I create extension for Selenium-IDE1.0b2 on Firefox3. I haven't tested on Selenium-IDE0.8.7.
Thanks,
Jerry
-
Feb 11, 2009
jedli says:
Hi, Is it possible to include a page with querystring? something like this, &n...
Hi,
Is it possible to include a page with querystring? something like this,
Thanks,
-Jed
include ../_etinc/levelcheck.asp?level=L0b&isdesc=1&istarget=0&isadvice=1 -------------
<tr>
<td>include</td>
<td>../_etinc/levelcheck.asp?level=<%=level%>&isdesc=1&istarget=0&isadvice=1</td>
<td> </td>
</tr> -
Feb 17, 2009
gordonconroy says:
Getting the same 2 issues as Olan above. Using Firefox 3.0.6 and Selenium...
Getting the same 2 issues as Olan above.
Using Firefox 3.0.6 and Selenium-IDE1.0b2
-
Mar 04, 2009
Paul says:
I'm using FireFox 3.0.6 and SeleniumIDE 1.0b2 and when I open SeleniumIDE I get ...
I'm using FireFox 3.0.6 and SeleniumIDE 1.0b2 and when I open SeleniumIDE I get a javascript error:
error loading Selenium IDE extensions: ReferenceError: Selenium is not defined
In SeleniumIDE/Options/Selenium IDE extensions I've set:
c:\user-extensions.js.includeCommand
Am I missing something?
-
Mar 13, 2009
Jerry Qian says:
Please COPY test case html to 'source tab' rather than OPEN test case from file ...
Please COPY test case html to 'source tab' rather than OPEN test case from file directly.
There is a known issue when OPEN test case from file: step cursor is incorrect. We are fixing it.
NOTES:
1) rename to user-extensions.js and set Selenium Core Extension instead of Selenium IDE Extension.
2) base url ends with '\' is used for template root.
-
Mar 13, 2009
kanika says:
I have taken the latest user-extensions.js from includeCommand4IDE_1_1. when i ...
I have taken the latest user-extensions.js from includeCommand4IDE_1_1.
when i say include test.html, selenium ide shows -- [info] Executing: |include | test.html | un=un01,password=pw01 |
[info] Executing: |begin$Template$ | test.html | |
[info] Begin Template test.html
[info] Executing: |<tablecellpadding="0"cellspacing="0"><tbody> | | |
[error] Unknown command: '<tablecellpadding="0"cellspacing="0"><tbody>' Can you please help me in resolving this error. -
May 06, 2009
Daniel says:
How can I access variables passed via include from the javascript curly brackets...
How can I access variables passed via include from the javascript curly brackets?
For example:
include testpiece.html name=joe,userId=3445 In the test I need to use javascript{...} instead of ${...}.
I tried javascript{storedVars['userID']}, but it did not work.
-
Jul 20, 2009
brianl says:
Using IDE: I have several test cases that use the flow control user extension ...
Using IDE:
I have several test cases that use the flow control user extension and the while/endWhile command (http://wiki.openqa.org/display/SEL/flowControl). Does this include extension work with the flow control extensions? When I include a test case that has while/endWhile, I get an error:
- [error] testCase.debugContext.currentCommand() is undefined
- [error] Unexpected Exception: message -> testCase.debugContext.currentCommand() is undefined, fileName -> chrome://selenium-ide/content/selenium-runner.js, lineNumber -> 141, stack -> ([object Object])@chrome://selenium-ide/content/selenium-runner.js:141 ()@chrome://selenium-ide/content/selenium/scripts/selenium-executionloop.js:159 ()@chrome://selenium-ide/content/selenium-runner.js:117 (3)@chrome://selenium-ide/content/selenium/scripts/selenium-executionloop.js:79 (3)@chrome://selenium-ide/content/selenium/scripts/htmlutils.js:60 , name -> TypeError
Any ideas? I've tried using both the goto_sel08.gs and goto_sel_ide.js code...
-
Jan 15, 2010
amor says:
How can I get the include command to run without expanding ? Or, else ensu...
How can I get the include command to run without expanding ? Or, else ensure that the expanded steps are not duplicated and run every time the include command is executed ?
I am using include to call re-usable commands in Selenium IDE. The problem I'm having is that it runs fine the first time, as it runs the recorded steps only once. The next time I execute the include command it actually runs the included commands twice, as it again expands the recorded steps called by the include command.
-
Feb 09, 2010
Ragavendra says:
thanks Sir for the script...........
thanks Sir for the script...........
-
Jul 23, 2010
Adam Pritchard says:
I modified Jerry Qian's 4IDE code. Instead of the injected code staying in the I...
I modified Jerry Qian's 4IDE code. Instead of the injected code staying in the IDE test case (and breaking subsequent executions), it is removed after execution. You can the included lines popping in and out of existence while the test case runs.
This makes include work for me under Selenium IDE 1.0.7.
At the bottom of injectIncludeTestCommands() (replacing the old editor.view.refresh() call):
// Don't inject if it appears the injection has already been done // (i.e., if the next command is the BEGIN). if (testCase.commands.length <= testCase.debugContext.debugIndex+1 || beginCommand.toString() != testCase.commands[testCase.debugContext.debugIndex+1].toString()) { // The include command cannot be the last command in the TestCase, or else // the de-injection code in doEnd$Template$ will cause an error. So we'll // add a simple echo if it is the last. if (testCase.commands.length == testCase.debugContext.debugIndex+1) { // Using concat instead of push so that we don't trigger the TestCase's set-modified flag. testCase.commands = testCase.commands.concat(new Command("echo", "The include command cannot be the last line in a TestCase, so this command was added. It can be left in place or removed, as desired.", "The include command cannot be the last line in a TestCase, so this command was added. It can be left in place or removed, as desired.")); } // This is original code. var cmsBefore = testCase.commands.slice(0,testCase.debugContext.debugIndex + 1); var cmdsBehind = testCase.commands.slice(testCase.debugContext.debugIndex + 1, testCase.commands.length); testCase.commands = cmsBefore.concat(newCommands).concat(cmdsBehind);//Injection } editor.view.refresh();//Must refresh to syncup UI
And at the bottom of doEnd$Template$() (after the LOG line):
// Delete the commands that we injected in injectIncludeTestCommands. testCase.commands = testCase.commands.slice(0, beginTemplateIndex).concat( testCase.commands.slice(testCase.debugContext.debugIndex+1, testCase.commands.length)); // Set the current command to the next one after the injected block. testCase.debugContext.debugIndex = beginTemplateIndex-1; //Must refresh to syncup UI editor.view.refresh();
-
Sep 23, 2010
Ivan evseev says:
Jul 23 [Adam Pritchard|../../../../../../../../../display/~vesper76\||...
Jul 23
[Adam Pritchard|../../../../../../../../../display/~vesper76\||] says:
I modified Jerry Qian's 4IDE code. Instead of the injected code staying in the I...
I modified Jerry Qian's 4IDE code. Instead of the injected code staying in the IDE test case (and breaking subsequent executions), it is removed after execution. You can the included lines popping in and out of existence while the test case runs.This makes include work for me under Selenium IDE 1.0.7.
[error] Unexpected Exception: message -> beginTemplateIndex is not defined, fileName -> chrome://selenium-ide/content/tools.js -> file:///home/ivan/www/_tools/selenium_IDE/js/user-extensions.js, lineNumber -> 303, stack -> ("_tools/selenium_IDE/UTILS_RestoreDB","")@chrome://selenium-ide/content/tools.js -> file:///home/ivan/www/_tools/selenium_IDE/js/user-extensions.js:303 ("_tools/selenium_IDE/UTILS_RestoreDB","")@chrome://selenium-ide/content/selenium/scripts/htmlutils.js:60 ([object Object],[object Object])@chrome://selenium-ide/content/selenium/scripts/selenium-commandhandlers.js:310 ()@chrome://selenium-ide/content/selenium/scripts/selenium-executionloop.js:112 (156)@chrome://selenium-ide/content/selenium/scripts/selenium-executionloop.js:78 (156)@chrome://selenium-ide/content/selenium/scripts/htmlutils.js:60 , name -> ReferenceError
-
Sep 30, 2010
Sam Hasler says:
The following solved the "beginTemplateIndex is not defined" problem with Adam P...
The following solved the "beginTemplateIndex is not defined" problem with Adam Pritchard's fix for Jerry Qian's 4IDE code:
var beginTemplateIndex = null; Selenium.prototype.doBegin$Template$ = function(locator){ LOG.info("Begin Template " + locator); beginTemplateIndex = testCase.debugContext.debugIndex; };
-
Oct 01, 2010
Sam Hasler says:
I used the following in the prepareUrl function to make the include relative to ...
I used the following in the prepareUrl function to make the include relative to the test case file
//include relative to Test Case file preparedUrl = absolutify(includeUrl, editor.suiteTreeView.currentTestCase.file.path);
-
Oct 04, 2010
Sam Hasler says:
I've found that if I use characters in the include file that get escaped/encoded...
I've found that if I use characters in the include file that get escaped/encoded for storage as html they are not converted back when included. i.e. "<" comes back as "<"
-
Oct 29, 2010
Richlv says:
ok, whis one is seriously missing installation instructions i did not get it wo...
ok, whis one is seriously missing installation instructions
i did not get it working yet, but my steps so far :- download latest zip archive;
- extract it;
- open selenium ide, choose options -> options;
- in "selenium core extensions" field (not plugins tab !), insert full path to the extracted javascript file;
- close & reopen selenium ide window.
that's how far i got. if i attempt to use "include" command, it does not complain that it is unknown, but instead throws at me "Unexpected Exception: message -> testFrame is undefined"
edit : looks like somebody else stumbled upon the same problem as well : http://old.nabble.com/Why--Open-Test-Suite...--in-TestSelenium-IDE-1.0-does-not-support-%22include%22-command--td21407217.html
-
Oct 29, 2010
gabe says:
I am having the same problem as Sam in regards to characters being encoded but n...
I am having the same problem as Sam in regards to characters being encoded but not decoded when included in a test case. Does anyone know a work around that does not involve a lot of duct tape? :) Thanks!
-
Oct 29, 2010
gabe says:
Richlv, Here are the changes I made to the JS to get includes to work for me us...
Richlv,
Here are the changes I made to the JS to get includes to work for me using Selenium IDE v1.07 and play nice with the goto extension. All of these changes were written by others in this forum and it took me a bit to get them all in the right places:
open the js,
----
find: IDEIncludeCommand.prototype.prepareUrl"
change the line: preparedUrl = absolutify(includeUrl, selenium.browserbot.baseUrl);
to: preparedUrl = absolutify(includeUrl, editor.suiteTreeView.currentTestCase.file.path);
this allows you to reference your includes in relation to your test cases rather than the baseURL you are testing.
----
find: Selenium.prototype.doInclude
add to bottom of this function:
//Jerry Qian: add flowControl support for include template steps try { htmlTestRunner.currentTest.gotoLabels = {}; htmlTestRunner.currentTest.whileLabels = { ends: {}, whiles: {} }; htmlTestRunner.currentTest.initialiseLabels(); } catch (e) { } //End flowControl if (this.initialiseLabels) { this.initialiseLabels(); } //fixes goto extension commands and removes include code after it runs I think
find: Selenium.prototype.doEnd$Template$
add to the bottom of this function:
if (this.initialiseLabels) { this.initialiseLabels(); } //fixes goto extension after running include...
Hope this helps!
Gabe
-
Nov 02, 2010
gabe says:
For anyone who cares, I have been trying to fix the issue I was having with incl...
For anyone who cares, I have been trying to fix the issue I was having with included tests getting parsed and the escape characters getting transformed into HTML code. I tried all sorts of things, including using CDATA (<![CDATA[...]]> tags which also get parsed, a lot of 'creative' js writing, and everything else I could think of. Finally I broke down and added a few lines to the include extension js to change the HTML escaped characters back to their original format. It feels dirty but it is working. I will just add a new line for each character issue I run into. There is probably a better way to go about this, but I am not a developer and I need to move on. :)
If you are having the same issue, here is what I did. Hope it helps:
FIND: IDEIncludeCommand.prototype.injectIncludeTestCommands
JUST AFTER: newText = newText.replace(/<\/\s*td[^>]*>/ig, "");
ADD YOUR FIXES (I have three so far):
//when includes are saved, special/escape characters are getting parsed, then inserted using HTML codes. //Following lines replace HTML code back to escape characters before insertion newText = newText.replace(/<br \/>+/g, "\n"); //'<br />' to '\n' newText = newText.replace(">", ">"); //'>' to '>' newText = newText.replace("<", "<"); //'<' to '<'
EDIT: on further reflection, you may be able to simply add a javascript unescape() function on the string. I may play with that later...
-
Nov 04, 2010
Marcin Fałek says:
I've noticed a problem for nested include function. When I use include in alread...
I've noticed a problem for nested include function. When I use include in already included html file, selenium ide doesn't hide line with include command. Re-execution of scpits doubles number of include calls. As a result of test all the lines with nested include are visible with begin$Template$ and end$Template$ vars and in the other hand, individual calls of include are hidden correctly.
command target value include selHotelsSearchFormQsfReset.html Structure of selHotelsSearchFormQsfReset.html
command target value type dom=document.getElementsByName('City')[0] type dom=document.getElementsByName('CheckInDate')[0] type dom=document.getElementsByName('CheckOutDate')[0] include selHotelsConfigureScreenCapture.html selTestCaseId=1 The problem is in Selenium.prototype.doEnd$Template$ function. How can I check there is more then one begin-end block and delete all of them. Now if I have for example 5 begin-end blocks all four internal blocks will be removed... except external one. Function removed End$Template$ line, but every line after Begin$Template$ remains.
Selenium.prototype.doEnd$Template$ = function(locator){ LOG.info("End Template " + locator); // Delete the commands that we injected in injectIncludeTestCommands. testCase.commands = testCase.commands.slice(0, beginTemplateIndex).concat( testCase.commands.slice(testCase.debugContext.debugIndex+1, testCase.commands.length));
Is there any chance to delete all lines from End$Template$ to first instance of Begin$Template$? If I have more than one instance of Begin$Template$ there is problem with find the first one:
command target value include selHotelsSearchFormQsfEdit.html begin$Template$ selHotelsSearchFormQsfEdit.html type dom=document.getElementsByName('City')[0] type dom=document.getElementsByName('CheckOutDate')[0] include selHotelsConfigureScreenCapture.html selTestCaseId=1 The red marked line is a command remains after completion of include [selHotelsSearchFormQsfEdit.html]
I used Adam Pritchard's modification for include
-
Jan 24, 2011
John Witchel says:
To make nested includes work you have to use an array of Begin indexes, pushing ...
To make nested includes work you have to use an array of Begin indexes, pushing and popping the values as you go. Like this:
// Array to hold the starting position of the Begin$Template$ marker. Pushing and popping the position onto an array // allows us to correctly handle nested includes during clean up. var beginTemplateIndex = new Array(); // Mark the beginning of the include Selenium.prototype.doBegin$Template$ = function(locator){ LOG.info("Begin Template " + locator + " at position " + testCase.debugContext.debugIndex); // Add the current position to the tail of the beginTemplateIndex beginTemplateIndex.push(testCase.debugContext.debugIndex); }; // Clean up everything between the closest Begin$Template$ and this $End$Template$, and pop the position off the array. Selenium.prototype.doEnd$Template$ = function(locator){ // Remove the last Begin$Template$ from the tail of the beginTemplateIndex var currentBeginTemplateIndex = beginTemplateIndex.pop(); LOG.info("End Template " + locator + " at position " + currentBeginTemplateIndex); // Delete the commands that we injected in injectIncludeTestCommands. testCase.commands = testCase.commands.slice(0,currentBeginTemplateIndex).concat( testCase.commands.slice(testCase.debugContext.debugIndex+1, testCase.commands.length)); // Set the current command to the next one after the injected block. testCase.debugContext.debugIndex = currentBeginTemplateIndex-1; //Must refresh to syncup UI editor.view.refresh(); };
-
Jan 24, 2011
John Witchel says:
I posted an updated version (includeCommand4IDE_1_2.zip) to reflect these change...
I posted an updated version (includeCommand4IDE_1_2.zip) to reflect these changes above.
-
Jan 26, 2011
Mary Ann May-Pumphrey says:
OUCH! The 1.1 version of this extension, in conjunction with goto_sel_...
OUCH! The 1.1 version of this extension, in conjunction with goto_sel_ide.js and datadriven.js, worked beautifully to perform data-driven testing within Selenium-IDE. The 1.2 version of this extension causes a massive sea of red ink in the IDE's log window as soon as the "loadTestData" command is executed:
- [info] Executing: |loadTestData | file:///Users/mamp/Desktop/BLOG/saucelabs-footer.xml | |
- [error] Unexpected Exception: message -> editor.suiteTreeView.currentTestCase.file is undefined, fileName -> chrome://selenium-ide/content/tools.js -> file:///Users/mamp/Desktop/BLOG/extensions/user-extensions.js.includeCommand4IDE, lineNumber -> 103, stack -> ("file:///Users/mamp/Desktop/BLOG/saucelabs-footer.xml")@chrome://selenium-ide/content/tools.js -> file:///Users/mamp/Desktop/BLOG/extensions/user-extensions.js.includeCommand4IDE:103 ("file:///Users/mamp/Desktop/BLOG/saucelabs-footer.xml")@chrome://selenium-ide/content/tools.js -> file:///Users/mamp/Desktop/BLOG/extensions/user-extensions.js.includeCommand4IDE:75 ("file:///Users/mamp/Desktop/BLOG/saucelabs-footer.xml")@chrome://selenium-ide/content/tools.js -> file:///Users/mamp/Desktop/BLOG/extensions/datadriven.js:53 ("file:///Users/mamp/Desktop/BLOG/saucelabs-footer.xml","")@chrome://selenium-ide/content/tools.js -> file:///Users/mamp/Desktop/BLOG/extensions/datadriven.js:102 ("file:///Users/mamp/Desktop/BLOG/saucelabs-footer.xml","")@chrome://selenium-ide/content/selenium/scripts/htmlutils.js:60 ([object Object],[object Object])@chrome://selenium-ide/content/selenium/scripts/selenium-commandhandlers.js:310 ()@chrome://selenium-ide/content/selenium/scripts/selenium-executionloop.js:112 (0)@chrome://selenium-ide/content/selenium/scripts/selenium-executionloop.js:78 (0)@chrome://selenium-ide/content/selenium/scripts/htmlutils.js:60 , name -> TypeError
-
Jan 31, 2011
John Witchel says:
@Mary Ann: Thank you for pointing this out. I fixed the bug you were refer...
@Mary Ann: Thank you for pointing this out. I fixed the bug you were referring to and corrected the tests to show (hopefully) that this update works with both goto_sel_ide.js and datadriven. Here's the link: includeCommand4IDE_1_3.zip
Let me know if you're still having trouble.
-j
-
Feb 23, 2011
Mary Ann May-Pumphrey says:
John: Thanks a bunch for the quick fix! I made a second blog pos...
John: Thanks a bunch for the quick fix! I made a second blog post about data-driven testing with html test cases today, in which I simply told everyone to use the 1.3 version. And I added a Comment to my first blog post on the same topic, in which I mentioned your quick fix.
I'm not sure what the conventions and "rules" are here, so I don't want to do this myself, but could you please update the "downloads" section above so that it points to the 1.3 version? It's still pointing to the 1.1 version, and I personally think locating the "Attachments" link is a tad difficult.
Thanks again!
-
May 09, 2011
Mary Ann May-Pumphrey says:
John: A couple readers of my most popular blog post (how to do data-driven testi...
John: A couple readers of my most popular blog post (how to do data-driven testing with RC & HTML tests) have detected a few issues when using IE-7 & IE-8. Reader "marco" has all three points nicely documented in a Comment on my blog. I was able to reproduce all three problems on IE-8/XP.
He also sent me his modified user-extensions.js file with fixes for the first two changes. I made the third change in my test case, and ran it with his new extension on both IE-8/XP and FF/XP, and the test case now works on both.
So, could you please take a look at his modifications and either bless them or otherwise address the two issues in a new release of t his extension? I'll mail you a copy of the modified user-extensions.js that works so you can see the changes.
-
Jun 27, 2011
Guy Schreiber says:
I encountered a problem when using Include and DataDriven with Selenese (html te...
I encountered a problem when using Include and DataDriven with Selenese (html test) on RC (i use v2.0rc2)
When the include command is wrapped with a while command, where inside the while the parameters to the include command change due to the DataDriven file, the included test case will always see the variables of the firsts datadriven record.to overcome this i added the following code to the Include command:
// takes a parameter string and store each of its variables with its value Selenium.prototype.storeParams = function(paramString) { var paramPairs = paramString.split(","); for ( var i = 0 ; i < paramPairs.length ; i++ ) { var paramPair = paramPairs[i].split('='); this.doStore(paramPair[1], paramPair[0]); } } // this one is an existing method. just add a call to storeParams Selenium.prototype.doIncludeExpanded = function(locator, paramString) { this.storeParams(locator); }
Hope that helps.
Guy
-
Oct 03, 2012
Keisha Shepherd says:
Hi, I'm trying to do a data driven test but keep getting the following error on...
Hi,
I'm trying to do a data driven test but keep getting the following error on the loadTestData step.
[error] Unexpected Exception: fileName -> chrome://selenium-ide/content/tools.js -> file:///C://user-extensions.js?1349279237932, lineNumber -> 62
I looked in the Include user-extensions.js file and line 62 is the following in the function IDEIncludeCommand.prototype.prepareUrl:
preparedUrl = absolutify(includeUrl, htmlTestRunner.controlPanel.getTestSuiteName());
Based on Gabe's comments I tried to change it to preparedUrl = absolutify(includeUrl, editor.suiteTreeView.currentTestCase.file.path)
then added a lot of things based on his comments above, but I still keep getting the same error.
I've tried changing the file names and locations so they were simpler but I still keep getting the same error.I really think it's not working on this part htmlTestRunner.controlPanel.getTestSuiteName()
but i don't know anything about this or why it wouldn't work. Also, I'm using includeCommand4IDE_1_3.zip.If anyone could help that would be great.
Thanks!
-
Oct 27, 2012
Bimal Patel says:
Hi, When include command is executed, the included test case steps are hidden. ...
Hi,
When include command is executed, the included test case steps are hidden. It does scroll in the Selenium IDE screen though, but nothing is visible for the included test case. Is there anybody experiencing this? I am using includeCommand4IDE_1_3.zip. I used include command extension back in 2009, it used to show all steps from the included test case, has anything got changed in the include command or in Selenium IDE? Any response is highly appreciated!
Thanks,
Bimal
-
Oct 30, 2012
Albert Fabregat says:
Hi, I have been working with Selenium 1.9.0 and everything was fine. My require...
Hi,
I have been working with Selenium 1.9.0 and everything was fine. My requirements in my testing process need new functionalities like flowcontrol (labels,if/else,while..) and also include test in runtime. I found this great extension but It has not been possible to make a test with labels included from the main test. I have tested versions 1.1, 1.2 and 1.3 of includeCommand4IDE and goto_sel_ide.js (19/6/2009) and other modified versions found over the net... I have read all the comments found here and also the comments on the flowcontrol extension site ../SEL/flowControl.. No solution found . Could anyone help me?
This is a simple example of the problem.. If you wish I could post another example with gotoIf... And other..
mainTest.html
echo "main" Include script.html echo "end" script.html
echo "includedTest" gotoLabel lab1 echo "echo not viewed" label lab1 echo "echo viewed" I always get incorrect jumps in the test..
Thanks in advance.
File:
Attachment | Size |
---|---|
![]() | 11.25 KB |
![]() | 10.35 KB |
![]() | 7.16 KB |
![]() | 7.13 KB |
![]() | 12.26 KB |
![]() | 18.77 KB |
![]() | 1.73 KB |
![]() | 20.01 KB |
![]() | 9.48 KB |
![]() | 12.62 KB |
Dec 13, 2005
Brant LeClercq says:
Found a bug where the command breaks if testrunner.html is called with querystri...
Found a bug where the command breaks if testrunner.html is called with querystring parameters. The querystring is not chopped off the baseUrl before appending the include locator. To fix, I made the following change:
//Need to remove possible query string. Eg: testrunner.html?test=myTestSuite.html&auto=true
var docLoc = document.location;
docLoc = docLoc.href.substr(0, docLoc.href.length - docLoc.search.length);
baseUrl = docLoc.match(new RegExp("^(.+/)[^/]+$"))[1] // base uri = char - / - chars other than /