Is there a way to export Selenium code into some sort of file I could send to others to use without selenium? Preferably inserting it into some html file or something they wouldn't have to install on their computers. Thank you!
Kind of, depending on what you use currently.
If you use the IDE, then yes. The steps the IDE records are essentially put into a HTML file that it reads. You can just give that HTML file to someone else, have them import it into the IDE and it would pick up from there. This has the dependency that the user must have an FF version supported by the IDE.
If you use the WebDriver, then no. At least not without much work - even just due to the dependencies. For instance, you have the various drivers, that the user would need to have a copy of for the tests to work. You have the language that the tests were coded in, for instance Java - you'd have to ensure the user has Java.
You could package them up into a nice installer - whereby the installer gets the dependencies for the user, but this will be slow, unreliable and totally not worth the time and effort you place into it. Think of it when you are installing large programs - it's also downloading lots of dependencies for that application too. Visual Studio/Eclipse are prime examples, they depend on hundreds of things. So when you install them, they are not just installing the core files, but the things they depend on too. You could replicate the same thing.
In order to run a Selenium test you would need one this too things:
Selenium IDE running on Firefox, in this case you just export as html and import in the other computer
The runtime of the specific language you are using to export (i.e. for jre, .net for C# etc.) plus the selenium-server running
As for your question, I would say there is no way to export a test case into a single file to be executable by itself.
You Can Export your Test Case Or Test Suite in different languages.
If you are using Selenium IDE follow these steps:
After recording your Test Case click on file menu.
Click on Export Test Suite As.
Save this file.
Now you can send this file.
Related
I have a Sikuli 2 script which is composed of:
an app.sikuli directory
with a app.py in it
and several Things.png images
Most of this structure was auto generated by SikuliX while I was creating the script. If I have to switch to another method of creating a Sikuli project, please say so, it's new to me.
I want to "share" this script to any other OS (say I wrote it on Linux, and I want to share it with MacOSX, Windows...). And I want this script to be straightforward to execute (the less steps, the less complexity), but I can modify anything before sharing.
I found the snippet from the Git Docs for Sikulix. Let me know if you found any other solutions because I only know of distributing the finished code for running the .exe on machines with the IDE or just Java installed (NOT TO EDIT -- UNLESS ANOTHER IDE IS BEING USED LIKE ECLIPSE WITH SELENIUM)
YT OF SELENIUM SIKULIX INTEGRATION https://www.youtube.com/watch?v=k65uCl42hSg&list=PL2EKpjm0bX4LqPht11MRfu9R1qUOSAZn3
https://sikulix.github.io/docs/scripts/running-scripts
Where and how can a SikuliX script be stored#
When you need to distribute your SikuliX scripts you have two options: zip-file and jar-file, both variants pack the SikuliX script content in one file, which makes distribution easier. Both can run with SikuliX.
The jar-file variant has an option to be packed together with the scripting and SikuliX feature support (self contained), so it might be run on systems only having a valid Java installation.
variant zip-file#
It can be created in the SikuliX IDE with the file menu entry “Export packed source” and gets the ending .skl instead of .sikuli. As such it cannot be reopened for editing nor used for import, it can only be run using SikuliX features on systems having a valid SikuliX setup. In fact it is simply a zip-file, which can be brought back to a .sikuli folder using a zip utility. So be aware, that this variant does not really hide your script content.
variant jar-file#
It can be created in the SikuliX IDE (file menu entry “Export as jar”). It can be run using SikuliX features on systems having a valid SikuliX setup. The script source is contained in compiled form (Java byte code) and hence not visible, even if one accesses the jar content. So this variant gives some level of secrecy for your scripted workflow.
1. Intellij is not able to recognize the Run options in the feature file, while able to run the file using the command-line tool.
getting Nothing here.
2. There is even no option in the right-click menu
3. Steps are identified as not implemented while steps are implemented and executing successfully with behave CLI tool
It is not ideal, since as you say the ideal is to have the appropriate version of IntelliJ. However, a workaround that has saved me in these situations is to select the step I want to go to and use Ctrl+Shift+F to search in the whole project the place where the method is declared.
This command is also useful to know in which Scenarios a certain step is used, because even if you have the Professional version of IntelliJ it only allows you to access from the Scenario to the Step and not the other way around.
I am facing a problem. I am good in selenium webdriver. Now i wish to run my datadriven test cases on mac,linux and other machines. my window machine will be my hub. shall i need to copy excel files of my data driven test cases on each machine(say node).?
As mac does not support my xls(not intalled office). Or grid will only fetch data from my machine's xls files and run test on all different mac machines.?
Forget Selenium for a moment, because this is not a Selenium problem.
Your (test) code reads some (.xls) data file. If you move your test code to some remote machine, and it still needs to read the data file, you will probably need to move that file as well.
Regarding your issue about Mac not supporting Excel. I very much doubt that you are using MS-Excel to read the data file. Chances are very good that you are using some kind of library, like Apache-POI, to do this. That library is a Java library. As long as your target machine can run Java, you should be good to go.
I'm trying to do set up some Selenium WebTests using PHPUnit, but php is no longer supported by Selenium IDE, does this mean I have to re-write all my tests into php in order to use this method?
I'm trying to set up a continuous integration system, but have never even used one before, I tried using jenkins-php.org but it wasn't very helpful.
The newer releasee Selenium IDE "claims" it does not support PHP,
But you can still convert your IDE to PHP or PHPUnit.
(In Selenium IDE) Option > Options > Enable Experimental Functions.
With this option checked you can switch your format under Options again.
You may still want to review your code.
Hope this helps and it is what you meant by "Selenium IDE does not support PHP".
I was able to find: https://addons.mozilla.org/en-US/firefox/addon/selenium-ide-php-formatters/
It allows output from Selenium to PHP, either PHPUnit format or Selenium Testing.
However after all this playing around it became apparent that the best way was to use htmlSuite, it has the most support when it comes to automation and seems to work out of the box, whereas PHPUnit testing requires lots of tinkering.
After a lot of hacking around it became apparent that the best solution is this tool:
http://www.enjoyxstudy.com/selenium/autoexec/index.en.html
It works out of the box, supports htmlSuite, works with windows and linux, runs most browsers, sends email reports, can get new tests from SVN, integrates with Jenkins well, and works with Selenium tests, its not PHP based tests but it works wonders compared to the other tools I tried out.
Really, so much easier, very user friendly, free and works out the box.
Is it possible to test a webpage which supports an export mechanism? This export mechanism streams the data displayed in a table via xml to the user. For now it's sufficient to test if the streaming works and the user receives a file, regardless of the file content. Any ideas how I can achieve this with selenium?
I googled around for a while, and according to selenium core FAQ, u may need to use firefox template to do that.
u may take a look of this:
http://oopsnullpointer.wordpress.com/2011/01/14/selenium-handling-testing-downloads-with-a-custom-profile/
I have not yet personally tested that though.
If you're using Selenium script by itself, this would be hard, if not impossible. Luckily, you can run selenium from Java, C# and more and have it integrate with JUnit, NUnit or your favorite unit testing framework. If you use one of these languages, you could use it to cause selenium to export the file to a specific location, then use C#/Java to actually go out on the file system and verify that the file was correctly exported to the location, and do any other validation on it.
For doing this development, you can typically find all the client libraries under the bin directory of Selenium server. If you're using Selenium IDE, you can even export your test cases to C#, Java, Ruby, or whatever else, or just use it as an example to manually write your own in code.
Hope that helps!