Hello I'm having trouble running Selenium test created by Selenium IDE.
My main problem is that I don't know where to go.
I created a test in the Selenium IDE. I can make it work on Firefox from the IDE and save it in HTML, java, python, C#, Perl. That was the first ( easy ) part.
I would now like to execute the same test on another browser ( doesn't matter the language but I will focus on letting the test himself either in HTML or java).
That's where I don't know where to go. The IDE documentation talk about " using a simple command-line interface that invokes the Selenium-RC server. " but on other part of the website you can see that Selenium RC is officially deprecated.
Things seems to be replaced by Selenium 1.0 + Selenium WebDriver where Selenium WebDriver fits in the same role as RC did.
Then on the download page you have this line:
-To run Selenium tests exported from IDE, use the Selenium Html Runner.
with a link to a jar and no documentation at all.
So, today which one should I use :
Selenium-RC server , Selenium WebDriver or the Selenium Html Runner ?
and how do they work, do my test cases need to stay in HTML or move to java?
The final goal is to run those tests using Jenkins, which also contains plugin for Selenium that may help.
Thanks for your answers.
Export you testcase as java file
Save this file some where in you machine
Download following jars:
TestNG (http://www.java2s.com/Code/Jar/t/Downloadtestng60jar.htm)
WebDriver (https://selenium-release.storage.googleapis.com/3.4/selenium-server-standalone-3.4.0.jar )
Open eclipse
Create a java project , add a package (Check your exported java file copy the package name and create a package)
6. Copy the java file to the newly created package , change the class name's first letter as small case
Add required jar file as follow: Both testng jar & selenium satndalone jar
Now change the driver, whcih ever you want: I have changed the ff driver to chrome
If you get any error like this:
add this following: You need to provide the chrome.exe location(in my case its 'C:/Program Files (x86)/Google/Chrome/Application/chrome.exe')
System.setProperty("webdriver.chrome.driver", "C:/Program Files (x86)/Google/Chrome/Application/chrome.exe");
To run Selenium HtmlSuite by using Selenium-Standalone Server (Selenium RC):
http://www.seleniumhq.org/docs/05_selenium_rc.jsp#run-selenese-directly-within-the-server-using-htmlsuite
java -jar selenium-server.jar -htmlSuite "*firefox" "http://10.8.100.106" "C:\mytestsuite\mytestsuite.html" "C:\mytestsuite\results.html"
But I think WebDriver has retired/changed that format.
Related
Till now I am running multiple scripts in parallel in selenium using testNG framework. Now I have to run these scripts in parallel using only java with out using any framework. Is there any possible way?
Firstly, You have to do is to set Global env. variable "ClassPath", in which you have to mention path of all classes(Selenium Jars and other classes also if used) which is used in Selenium Script.
Then you can run multiple Selenium Scripts from CMD at same time and to make process easy you can also create BAT files. You can also schedule Selenium Script with BAT files.
Hope my answer will help you.
Thank You,
Ed D, India.
I have created a java project to run automated test cases for native app using appium and selenium.
Now our clients want to run that java project through .NET.
I have tried using ikvm.net but it says "Manifest doesn't contain a Main-class" because testNG class doesn't contain main class.
Can anybody suggest another way to achieve this?
As testng is for java you can do something like this:-
You can create a bash file for testng which is execute testng for java
Refer:-
http://stackoverflow.com/questions/32120102/bash-file-is-running-fine-in-windows-for-testng-but-it-is-not-working-in-linux-m
Now you need to execute that bash from a C# code
http://raspberrypi.stackexchange.com/questions/9474/how-can-i-run-a-terminal-command-bash-from-c-mono
Hope it will help you :)
I am new to selenium and so i want to seek advice for setting up my framework.
What i want to achieve is i want a test suite setup using selenium webdriver and eclipse in testNG format. I am looking for a test suite that runs through all the test listed in there (I will record and export script to java/test NG format using IDE and tweak as needed). So that on single click i can run through a series of tests for regression testing. And generate a report stating what passed and what failed
Any ideas how to do it or set it up or any small code required to invoke that whole test will be appreciated.
Thanks
The following is a good tutorial on how to set up selenium webdriver and testNG framework.
http://www.toolsqa.com/selenium-webdriver/download-and-install-java/
Hope it helps!
I wrote a simple regression test for a website with a little GUI to launch the test. Works fine in eclipse but for some reason it will stall after pressing the launch button on the GUI when I try to run it from the terminal. The web driver will launch firefox but the page stays blank when its supposed to go to the URL of the site I'm testing. I believe this has to do with error in configuring the classpath, I have the following in a shell script
javac -classpath ":ojdbc6.jar:selenium-server-2.33.0.jar:selenium-server-standalone-2.33.0.jar" Test.java
java -classpath ":ojdbc6.jar:selenium-server-2.33.0.jar:selenium-server-standalone-2.33.0.jar" Test
Why does it stall and how to fix it?
I use the Junit ant task to run my tests. It will run my tests and print a nice looking html report at the other end for clear results.
Use Ant or Maven build tool with Junit or TestNG framework as both framework has capability of running test from terminal and generating nice html formated report. Here is a sample project with ant build script you can get from my github account.
Is it possible to programmatically, in java, convert Selenium HTML file to JUnit test source code?
I need my own program which gets only resources of these html files, converts them to java code and automatically runs the JUnit test. Is there any way to do that?
In Selenium IDE, it is possible to export test cases to JUnit, I know that, but I don't want to use IDE, I need to do this programmatically as I said once before.
I believe that someone needed this before and someone can help me...
How about http://code.google.com/p/selenium4j/ ??
How does Selenium4j work?
In short Selenium4j translates the HTML tests to Java JUnti tests.
UPDATE
Maven port of this project available through https://github.com/willwarren/selenium-maven-plugin:
<dependency>
<groupId>com.gbi.maven</groupId>
<artifactId>selenium-maven-plugin</artifactId>
<version>1.0.2</version>
<scope>test</scope>
</dependency>
Also it mirrored at warious MVN repos:
http://mojo.codehaus.org/selenium-maven-plugin/
There exists a Firefox plugin for the Selenium IDE called Test Suite Batch Converter which can convert batches of HTML files to any export format the IDE supports.
I took the selenium4j project and turned it into a maven plugin for those who want to take the html test cases and automatically have them run with your maven test phase. You can also separate the tests out using a profile override with surefire.
Readme is here: https://github.com/willwarren/selenium-maven-plugin
The short version of the readme:
Converts this folder structure:
./src/test/selenium
|-signin
|-TestLoginGoodPasswordSmoke.html
|-TestLoginBadPasswordSmoke.html
|-selenium4j.properties
Into
./src/test/java
|-signin
|-firefox
|-TestLoginGoodPasswordSmoke.java
|-TestLoginBadPasswordSmoke.java
This is only tested on windows with Firefox and Chrome.
I couldn't get the IE version to pass a test, but I'm new to selenium so hopefully, if you're a selenium guru, you can get past this.
Look at the selenese4J-maven-plugin. Similar to selenium4j (https://github.com/RaphC/selenese4j-maven-plugin).
Provides many features : Selenium 1/2 (WebDriver) conversion Test Suite generation Internationalisation of your html file Possibility to use snippet into your html file for specific test (e.g : computing working day, write custom generation of values, handle dynamic values ...) Use of tokenized properties