I can execute html script and html suite through RC. Now I would like to execute javascript through Selenium RC. I have few question related to this.
Should I need to set class path for that?
After writing test script in javascript, what is the format of javascript suite. Please provide example.
What will be the comment to execute the suite from command prompt? I think the command I used to execute html suite may not work. The command I used java -jar selenium-server.jar -multiwindow -javaSuite "*iexplore" "http://www.google.co.in/" "C:\Tests_suite.html" "C:\results.html"
The way I've used Javascript with Selenium RC id to use the User extensions.
There's some info. here as well.
Or you can use the getEval method of selenium API to execute Javascript from Selenium RC.
From the command line, remember to add:
-userExtensions : indicates a JavaScript file that will be loaded
into selenium
Related
We have a maven plugin that runs selenium with scala. The arguments passed are formatted as such:
<argLine>-Dbrowser=chrome -Dwebdriver.chrome.driver=${project.basedir}/browser/drivers/chrome/2.25/mac64/chromedriver</argLine>
I've tried adding
-DmaxInstances=5
, as well as using
-browser="browserName=chrome,maxInstances=5,chromeDriver=theDriver"
however they have returned errors.
Does anyone know the correct command line argument using the -D... format?
An example execution would be:
java -Dwebdriver.chrome.driver=theDriver -jar selenium-standalone-server-3.0.1.jar ${SE_OPTS}
where ${SE_OPTS} are the options that selenium takes. the options depend on which role you are running.
Options for Standalone
Options for Hub
Options for Nodes
(see the #Parameter's)
Since version 3.0, we are using JCommander, so ensure that your -D... options are specified before -jar
I edited my target scheme to run a script action after testing as below
Target Scheme -> Test (Debug) -> Post Actions
The script hw.sh had a simple command line call:
open /Applications/Safari.app/
It worked fine for the above script. When I changed it to the following
groovy http://frankencover.it/with -s /Users/sasokan/Downloads/MyProject
Nothing happened. How can I call this groovy application using a script.
I am also trying to run frankencover.it and had the same problem you did. I eventually found this answer on SO that lead me to a solution. I added the following before calling frankencover.it and it fixed the issue.
PATH=${PATH}:/usr/local/bin
I will further note that even if you use the full path to groovy in the command frankencover.it will fail internally because it cannot find 'lcov' for the same reason.
I wrote a few tests with casperjs. They run just fine with phantomjs. However, when I tried to use slimerjs with the following command:
casperjs --verbose --engine=slimerjs test create-project-suite.js
A small window appers with the SlimerJs logo and version number but the console seems to hang with the following line:
Test file: create-project-suite.js
Is there anything else I need to do? Here are the version numbers:
Mozilla Firefox 28.0
CasperJS version 1.1.0-beta3
Innophi SlimerJS 0.9.1
3.8.0-37-generic #53~precise1-Ubuntu
Update:
I removed code until I got slimerjs to open the browser and execute tests. It seems that it hangs whenever I require a js file (I'm following the page objects pattern):
var Login = require('./objects/login');
I think require.paths could be helpful. Any ideas on how to get around this?
Using full paths makes slimerjs happy:
var path = fs.absolute(fs.workingDirectory + '/objects/login');
var Login = require(path);
It is plain simpler to move all modules to the same directory where the script is.
I tried your command and it works for me, maybe in your file you use an instruction specific to phantom :
http://docs.slimerjs.org/0.8/differences-with-phantomjs.html
But it should open the window(at least the start() ).
Anyway the command is fine.
I have written my script specifically for FF. Now I wish to run that same script on Chrome as well as IE. Also I want to run my tests in following order :
Open browser1.
Run script on that browser.
Close browser1.
Open browser2.
Run script on that browser.
Close browser2.
Please help.
In order to run your tests on :
1.Chrome : you will need to install latest Chrome driver, unzip it and paste its path in the environment variables.
2.IE : you will need to install IEDriver server unzip it and paste its path in the environment variables and enable protected mode for each zone in following way (Internet options->security tab->enable protected mode checkbox).
For running your tests as per the way you mentioned, not sure what framework you're using or whatever, but you can do this with a loop. You can do the following :
def all_browsers
browsers = [:firefox,:chrome,:ie].each do |br|
$driver = Selenium::WebDriver.for br
$driver.manage.window.maximize
$driver.navigate.to("http://google.com")
end
$driver.quit
end
How do i post the results to a URL via the "selenium-server.jar"
java -jar selenium-server.jar -htmlSuite "*firefox" "https://www.myserver.com/rc/" "/selenium/Tests/TestSuite2.html" "http://myserver.com/readSeleniumResults"
chrome://src/content/TestRunner.html?auto=true&multiWindow=true&defaultLogLevel=info&baseUrl=https%3A%2F%2Fwww.myserver.com%2Frc%2F&resultsUrl=http://localhost:4444/selenium-server/postResults&test=http%3A%2F%2Flocalhost%3A4444%2Fselenium-server%2Ftests%2FUI_TestSuite2.html
I would like the &resultsUrl to be "&resultsUrl=http://myserver.com/readSeleniumResults"
There's no way Selenium can be able to report the results of the tests to an online site.
If you think it, you'll soon notice there isn't a standard way for which selenium could take care of such task.
I recommend you wrapping that system call inside a script, that once selenium finished takes care of sending the results html file through FTP or the method you've chosen.
This is what I'm doing.
java -jar selenium-server.jar -htmlsuite *iexplore http://yourwebsite c:\testsuite\BasicTestSuite c:\testsuite\results.html