running multiple test case in Selenium at the same time - java

I created 2 test suites with Selenium IDE and I would like to run those test suites at the same time. Just like firing threads at the same time. Is it possible without entering programming ?
P.S : I couldn't open 2 selenium IDE in Firefox.
Thanks.
Altug.

No it's not possible. Selenium IDE takes over the firefox control. And this is similar to 2 users clicking into same window.
The rule is 1 Firefox = 1 Selenium IDE
For parallel run you can setup Selenium grid. But it's more complicated solution than Selenium IDE.

It is possible, you have to run multiple profiles of the Firefox browser. You can do it by command
firefox -p Profile_Name -no-remote
make use of profile manager if you need:
firefox -profilemanager -no-remote
You can run as many profiles simultaneously you want... or your memory can handle. For each profile you have to install Selenium addons separatedly.

You will have to use Selenium Grid

Related

How can I capture the screenshot of an Alert in Selenium WebDriver (Java) while executing the code remotely?

I'm able to get the screenshot of Alert by using Robot class when the code is running from server machine (where the code is present). But its not capturing the screen when I'm trying to run through Jenkins.
I guess this is because your code on Jenkins is running in headless mode while Robot doesn't work in headless mode.
At least I had exactly the same problem.
You can use a TakesScreenshot method instead.
It is based on WebDriver and supports headless mode as well.

Confusion about Selenium and WebDrivers

I got into a project which requires a WebGUI to be tested. Selenium is used for this in combination with Jenkins to schedule tasks and run the tests. All of this is handled by one server (Linux).
Regular tests work fine but WebGUI tests fail and I am supposed to make them work. However I'm very confused by the roles of Jenkins' Plugin "Selenium Grid" (is it even neccessary), the JUnit tests inside the project utilizing a selenium libary and the setup of the headless browser required.
What exactly are the roles of the plugin "Selenium Grid" for Jenkins and how does the Selenium libary communicate with a headless browser (Role of WebDrivers?)?
I already know about the Selenium hub and nodes but have no idea how to approach this.
I hope somebody can help me cleaning up my confusion...
A Selenium Grid can be used to set up a scalable automated browser environment. It is often used for automated GUI testing. It consists of a Hub and one or more Nodes.
A Selenium Hub should be started and the resulting URL should be stored.
Then a desired number of Selenium Nodes should be started with a reference to the Url of the Hub. The nodes will register themselves to the Hub.
Then you could use Selenium Java to create a RemoteWebDriver instance, optionally specifying the url of the Selenium Hub. This webdriver is just a Java API, the actual work will be done in the Selenium Node environment(s).
You can use the Java API to implement your desired operations on the WebDriver instance. When running, the code will delegate all calls to the running Selenium environment.
There are multiple ways to actually start the hub and nodes. A Jenkins Plugin could do it, you could use Docker, a local process, or many more. I'd advise to not bind your setup directly to Jenkins unless you are certain that you will never switch.
The Jenkins Selenium Plugin specifies the URL that you should create a WebDriver with:
new RemoteWebDriver(new URL("http://jenkins.mydomain:4444/wd/hub"), capability);
Where jenkins.mydomain will probably be the IP of your Linux server. Just above it is a line that says that it "also" accepts external nodes. I am not familiar with the plugin, so I dont know whether this means that it sets up one or more nodes itself by default.
taken from the following website.
https://wiki.jenkins.io/display/JENKINS/Selenium+Plugin
This plugin sets up Selenium Grid in the following way
On master, Selenium Grid Hub is started on port 4444, unless configured otherwise in Jenkins global configurations. This is where all your tests should connect to.
For each slave, necessary binaries are copied and Selenium RCs are started.
RCs and the Selenium Grid Hub are hooked up together automatically.
Now the question is do you need this?
This is upto the requirement of the project. You just need to ask this question to yourself
do you need to run tests in parallel (to cutdown time or for browser compatibility testing), either now or in near future.

How to move iMacro script to Selenium?

We have been using iMacro for our QA Automation, at a recent discussion it was decided to shift to Selenium.
Selenium provides a comparison thus neglected to mention how to migrate scripts to their platform..http://wiki.imacros.net/Selenium
is there any tools available for this purpose?
There is currently no tool that I know of that can help you with this.
There a couple of alternatives for migrating from iMacros to Selenium:
If you have a small amount of scripts re-record them using selenium IDE
If you have a large amount of test you could write a script that can map equivalent commands, you may still need to do some manual clean up but it may at least save you some time.
The easiest way (if you are using firefox) is to select Tools->Selenium IDE. This will open Selenium IDE in a separate window. Use the Imacros sidebar to "play" the script while Selenium IDE is recording. I just did this myself. It works like a charm. Obviously, this won't do any Imacros specific text-scraping, but if your script is a simple set of actions it works fabulously.

Selenium WebDriver Multi-Threading & Browser Hiding using Java

I'm using the Java API of the Selenium WebDriver:
Is it possible to create multiple instances of the Selenium WebDriver from different threads simultaneously without conflict?
How do I change the path of the firefox installation directory that WebDriver uses if I installed firefox in a different directory?
How can I hide all the instances of the browsers(e.g firefox) that those threads started?
Thank you.
I can give you an answer to your first question.
Yes, you can run multiple driver instances simultaneously. However it is not recommended to run more than 5 or so instances at once in a single selenium server. Selenium Grid was designed specifically for this (it is bundled with the Selenium Server).

How to capture a screenshot when not actually logged into the machine during running Selenium tests with Jenkins on Windows?

We have a CI environment with Jenkins running a test suite of Selenium Tests in a Windows (XP and/or Windows 7) VM. If I am not physically logged into the VM running these tests via RDP, all I see are black (blank) PNGs. I've tried all of the 'capture' methods available (both Base 64 encoded and file based) for multiple Selenium RC 2ish releases (e.g 2.0b2, 2.0rc3, 2.0.0, 2.1.0) and I get the same results for everything I've tried. Is anyone else running Selenium in a Windows CI deployment and able to capture screens? Or better stated, can anyone shed light on how I can capture screens in Windows, using the Selenium API without having to be physically on the box"?
If you are not logged onto the box, or you either closed or minimized the RDP connection, there is no desktop, and screen captures will be blank.
What you need to do is use a VNC server/viewer, so that the machine/vm in question has a visible desktop session.
We are also doing something very similar. We have a windows VM setup which is running Hudson and Selenium Grid.
When our test cases fail we capture a screenshot of the browser so we get more detail of why a test case failed.
We are using the #captureEntirePageScreenshotToString method
We're doing it, and it works for us. We're using JetBrains' TeamCity instead of Jenkins, running on Windows Server 2003. We run the Selenium RC server as a Windows service, using the Java Service Launcher.

Categories

Resources