Trying to use Selenium RC - testing

I'm pretty newbie to selenium.
Im trying to configure selenium for a project in my university like the one configured with phppgadmin.
There is no .jar file, I dont need to run anything, dont even need to install libraries, etc... I dont know if this is a RC Server or Webdriver.
Also, I want to use the PHPUnit format, cause this way I can just export test cases from the Firefox Selenium IDE plugin. There is a way to do that?
There is a lot of information, webdrivers, etc in Internet but I believe the way phppgadmin do this is the best way.

If you're just looking for something quick and dirty Selenium 1 imported off of the IDE is probably for you. If in the future you plan on continuing your university project I would highly recommend learning about Selenium Webdriver (Selenium 2).
Just as a small aside: You can export your tests from the selenium IDE in any language you desire, PHP is just one of the many choices that include (Java (JUnit), Java (TestNG), Ruby, and Python). If you're interested in PHPUnit look here http://www.phpunit.de/manual/3.1/en/selenium.html, this will give you the back drop on how to start coding your Selenium Tests.
If you're going to be using the selenium RC you want to go to http://seleniumhq.org/download/. Download Selenium server. You start the server with a java -jar command. So java -jar /path/to/sel/selenium-server-standalone-2.24.1.jar. This will start the RC server and when you're interested in running some tests execute the tests and then selenium server will take care of the rest

Related

Porting part of Selenium IDE to chrome extension

I have been trying to port Selenium IDE into a chrome extension I have been working on but to no avail. Specifically, I want to be able to execute selenium-built commands (e.g. click, assertElementVisible, etc.) in my extension.
I am aware that porting Selenium into another extension has been done before (Katalon Recorder), but I could find absolutely nothing online on how the porting was done.
That said, can anyone give me some pointers on:
Specifically what files I should port from the IDE repository
How to set up and call Selenium commands in my extension
How I may properly accredit Selenium in my use of its code
I am aware that the old Selenium IDE is deprecated, so I plan on using the new Selenium IDE on github. The new IDE is still under development, but I believe that the functionalities that I require are ready to be used at this moment (I only require running commands on DOM elements).

Selenium IDE or Builder, can they connect with Selenium Server 2?

Is there any possible way to execute the output of either Selenium IDE browser plugin or Selenium Builder plugin with the selenium-server-standalone.jar?
When I try to execute the Selenium IDE selenese output with the -htmlSuite flag of the selenium-server JAR, the server complains that sendKeys is not a valid command. sendKeys is a selenium V1 command, but the Selenium IDE outputs V2. You'd think the server could execute V2 syntax, but it can't.
When I save V1 syntax from Selenium Builder, and try to execute that with the -htmlSuite flag I get an error that "click" does not implement the event interface. (I'm guessing some other v1/v2 incompatibility)
There doesn't seem to be a way to execute the JSON output of Builder against the server either (there's a Jenkins plugin that claims to do this, but it doesn't seem to have enough logging or debug information to tell if it did anything at all).
Is there anyway to run the output of any GUI tool against Selenium Server 2?
UPDATE:
According to this bug, the selenese runner part of selenium server is abandoned. https://code.google.com/p/selenium/issues/detail?id=4349 But why would someone bother compiling, packaging and shipping abandoned code that doesn't work? I find it really hard to believe that something as popular as Selenium doesn't work with its own IDE browser plugin.
Yes, you can. First, do your research in the Selenium documentation and start a Selenium Grid on your computer. Then, you can use Maven to run Selenium Builder scripts (using a method like what I have done here: http://djangofan.github.io/maven-selenium-builder/ )
Of course, for the Builder scripts to connect to the Grid hub you need to change the calls to:
new FirefoxDriver();
to this instead:
new RemoteWebDriver( "http://hubIP:4444/wd/hub", capabilities );
, or something similar.
Thats it.
The correct answer is, "no, Selenium Server v2 does not support Selenium IDE output nor Selenium Builder output".
If you want to use the output of Selenium IDE browser plugin you need the incredible Selenese Runner project.
https://github.com/vmi/selenese-runner-java
Why this requires a 3rd party tool and isn't part of the Selenium family of products is beyond me.

Launching Selenium test from bookmark?

I have some Selenium IDE scripts for automating tasks (deploying to an internal server via it's web interface), and I want to have bookmarks to launch them.
Don't want go to Tools -> Selenium IDE -> search test -> launch test, just want to click a bookmark and let the script run.
How can I achieve this? Am I missing a point?
Don't know if it makes a difference, but I'm currently using Firefox (if I have to change browser for this, it wouldn't be a problem).
Thanks
Not sure whether you be able to run tests pressing on a bookmark as browser plugins are usually run with a key combo. And bookmark is URL. Well the main issue in your question how to associate bookmark
with browser addon launching.
Well, I've investigated a lil bit workaround. Speaking about getting Selenium HTML Test Suites Running Automatically (i mean an alternative to bookmarks) some solutions are possible:
solution 1:
Patch the Selenium server code to support HTML suites.
Build a script to execute your HTML test suites.
Build a script to read the suites’ output reports and consolidate
the information for inclusion into your CC.NET report.
Setup details you can get here
Solution 2:
Selenium IDE plugin for Firefox to create tests
Java to run Selenium Server
Selenium Server to run test suites
Nant to generate reports for CruiseControl.NET
CruiseControl.Net as a continuous integration engine
Setup details here
Hope this be useful for you.
Bookmarks are nothing else than URLs, which makes it impossible to "bookmark" a functionality of a plugin, such as the Selenium IDE.
However, there might be other plugins out there that do what you want. I haven't had a closer look at it, but one candidate could be the Favorites (Selenium IDE) Firefox Add-on.

Selenium: Is there any JS (JavaScript) code coverage tool which we can integrate with Selenium Server/RC

Selenium: Is there any JS (JavaScript) code coverage tool which we can integrate with Selenium Server/RC
Hi,
I want to JS code coverage done by my Selenium Test Suite
Is there any code coverage tool which can be integrated with my existing selenium rc framework??
In theory, you can use any coverage tool that instruments JavaScript code to collect coverage data.
For example, you can use JSCoverage either in proxy mode (for real-time instrumentation) or for static instrumentation to run your Selenium tests off the instrumented code.
One technical hurdle could be to devise a way to accumulate coverage data across multiple pages. The coverage tool of your choice could already have support for accumulation of data from multiple page runs. If not, you might have to handle that bit yourself, but this is probably not something trivial.
I have found the solution for my need, there are multiple tools available but I want a tool which can be integrated with my existing automation easily
Tool is JSCover
http://tntim96.github.io/JSCover/
Just run the Server
Run Server
java -cp JSCover-all.jar jscover.server.SimpleWebServer . 8080
Run Proxy Server
java -jar target/dist/JSCover-all.jar -ws --proxy --port=3128 --report-dir=target
Add Proxy in your Webdriver for port specified, 3128 in my case
After execution of test Generate Reports using
((JavascriptExecutor) driver).executeScript("jscoverage_report();");
You can add this line where you exit WebDriver or Test Case
Not aware of a tool for Selenium, but JsTestDriver has a design very similar to Selenium RC (can launch tests from the command line and they are run on a server that drives browsers headlessly) and provides code coverage information.
IntelliJ integrates with JsTestDriver and provides a visual display of coverage information.
Take a look at https://github.com/yui/yuitest/wiki/Code-Coverage
I've integrated this tool in my Selenium tests a time ago. You need a bit of work to gather coverage info before page changes (in any case js trigger a page reload, link etc...)
Once you set up everything, it will fully coverage any js executed while Selenium load and test your website pages.
PS : Even if it was specially adapted for YUI test, you can use it with selenium.
I don't know what you are trying to achieve, but:
Selenium is testing the final output, as seen on the page itself.
So it really does not matter if its PHP, HTML, JSP, ASP or .NET - the Selenium is designed to mimick the end user and click the final application - the final HTML code generated by whatever is under the hood.
Selenium is also not that good for code coverage tests - one piece code can be on many pages - so better approach with selenium is to do the "user" coverage - try to cover all the possible actions which living human could possibly do with your page
There is no particular tool that can integrate with Selenium to do JS coverage. However there are lots of tools which test JS on every page which can tell if the JS that executing on your web page had any errors. This may not ideal solution but on each page you will have the measure of uptil which point JS executed properly on your webpage under test. There are two solutions for that:
1.) JSErrorCollector API: It will integrate directly with Selenium and let you know if there were any error on the page. Can be found at: http://mguillem.wordpress.com/2011/10/11/webdriver-capture-js-errors-while-running-tests/
2.) Full fledged JS coverage tools: There is an excellent list of tools here which will essentially help you in covering JS on on your web pages. Can be found at: JavaScript unit test tools for TDD

Help with Selenium Webdriver download?

I have Selenium IDE and i want to install Selenium Webdriver.
1) Can anyone tell me where can i download selenium webdriver. i don't see any link available in the documentation.
2)Can i use selenium webdriver with PHPUnit? I see some materials saying php is not supported in selenium 2 however there are some download links available for phpbindings for webdriver what is this exactly?
3)If i have Selenium webdriver do i still need selenium server to run test cases in different browsers?
I would appreciate your answers...
I completely agree with you. They have a ton of documentation, but they do a horrible job of explaining what you actually need. It took me about 2 days to put all the pieces together. You will need a few things...
If you are running tests with C#, download NUnit, C# client drivers. Create a class library project in Visual Studio and reference the dlls (assemblies) for NUnit (for appropriate dotnet version) and the C# client drivers. Compile your class library. It should create a dll inside of the bin\Debug directory. Then go into NUnit, create a project, and then open your assembly in that bin\Debug directory. That should get you started.
If you're developing using Java, download JUnit (not NUnit) and then download the Java Client Drivers, and use Eclipse instead of Visual Studio. You can launch JUnit right from Eclipse.
I've only tried NUnit and JUnit before. But I'm sure PHPUnit can also be launched from Eclipse (educated guess). There seems to be the most documentation for Java and Python.. from experience, but I've been doing everything in .NET and I haven't had anything I couldn't solve.
The Unit Testing software isn't required, but the code the format add-ins for Firefox Selenium IDE will build the code for NUnit (C#) or JUnit (Java), etc... so most use those tools.
If you want to get some boilerplate code, go into Selenium IDE and turn on experimental features under options. Then export your C# code (or Java code) from the format menu after you've recorded your commands. It won't all convert 100%, so be aware of that. Just google from there to get questions answered.
One thing to watch out for... clickAndWait commands won't convert to click and wait in the code. You will either need to do an implicit wait or a thread.sleep wait after certain commands before you'll be able to access the next element if you're waiting for an action to occur. You will also want to turn on native events so you can fire certain JavaScript events. Your fire events won't work if the driver doesn't have this turned on. The WebDriver driver.
If you have any other questions, let me know.
You can download Selenium server as well as client driver from the following:
http://code.google.com/p/selenium/downloads/list
You can download "php-webdriver-bindings-0.9.0.zip" from the following source:
http://code.google.com/p/php-webdriver-bindings/downloads/detail?name=php-webdriver-bindings-0.9.0.zip
In C# context:
Now the better way of including packages in C# project is using nuGet. nuGet is packaging utility which when executed from its powershell command window, quickly downloads the dll files and links them to project. Below link details on how to use nUGet to install packages of selenium webdriver, selenium support and nUnit.
How to invoke/run different type of web driver browser using remote webdriver in C#