I have written my RF testcases using reusable keywords (built using native selenium webdriver not using Selenium2Library) and It works fine on single instance for what so ever browser I run.
But, I would like to execute these testcases in parallel on
1) Same machine different browsers
2) Different machine all browsers
Does Selenium Grid have native support to Robot Framework test cases? Or have any body found an alternative?
Yes, Robot Framework has native support for Java and Selenium2 within your defined "keyword" code blocks. All you do is use RemoteWebDriver in your keyword phrases instead of using WebDriver . This requires you run a Hub and a Node for the RemoteWebDriver to refer to, of course, or you can use a Sauce Labs account. Using Grid and Node you can run parallel tests with very little effort.
If you don't want to use RemoteWebDriver, you can still use WebDriver locally but you need to run parallel tests using "Maven surefire with threads" or a Gradle task with --parallel-threads=3" option. I have examples of this that you can see in my GitHub account.
Related
I have a requirement where I want to switch between multiple drivers to execute tests. For e.g. Launch android app, perform some steps and do the validation in desktop browser. Once done, switch back to android app and continue with rest of the flow. There can be multiple instances, where I have to switch between multiple drivers
Use setDriver method of QAFTestBase to swich between drivers.
QAFTestBase testBase = getTestBase(); //TestBaseProvider.instance().get()
//switch to another driver
testBase.setDriver("firefoxDriver");
//do the needfull
testBase.setDriver("appiumDriver");
//switch back to mobile driver
Refer answer for similar question and notes from QAF.
Using QMetry Automation Studio, a user can execute the same feature file on different platforms like Web, MobileWeb, Android using CI/CD. The following blogs have detailed step to set up your QAS project to achieve it:
Executing test case by switching multiple drivers.
Executing a test case in multiple browsers in a parallel session.
Executing test case on multiple mobile platforms.
I have 7 testsuites that are specific to languages something like German, Finish, Italy etc., I would like to execute all at one time. Kindly provide me solution on this. Referred to many materials, but having confusions that how we should work with RED Editor.
AFAIK the only possibility to add parallel execution to robot tests is to
parallelize code inside python classes or
make each test suite a
separate test call (i.e. with ctest execution) and call several of
them separately (ctest -j)
RIDE does not provide this, nor does robotframework natively.
In the recent releases of RED it is possible to use a custom script to launch robot from RED. The documentation shows some examples in the Launch Scripting section. In the section about launching using Gradle there is a nice Windows batch example.
This could be used to have RED launch Pabot to run several Robot sessions in parallel. This would allow you to achieve the parallelisation from RED you seek.
The Selenium Grid can help with this, but I'd consider it if the testing load needs to be spread across multiple machines. If only running locally, then pabot itself is sufficient.
In using .net selenium webdrivers, I have been stumbling in 2 main issues, each for a different specific webdriver.
The table below shows the issues Chrome and Firefox webdrivers have been falling short with me:
I am using RellYa's selenium jquery extensions.
Chrome webdriver randomly throws a jQuery not found exception. If I try a couple of times, I eventually succeed.
With Firefox's webdriver, this never happened.
On the other hand, firefox throws a
Unable to bind to locking port 7054 within 45000 ms
Research shows that the reason behind this is that I must have left another firefox webdriver not closed/not quit. But this defeats my using selenium to automate web tasks, in a multi threaded manner. I mean, after a couple of threads are opened, seems it reaches some limit and waits for one of the opened webdrivers to close.
Actually, from this firefox webdriver's documentation, they make it clear that only one instance is supposed to be running. What one is supposed to do then if he had in mind multi threading ?
Does any one have working solutions for the problems singled out in the table, for each specific webdriver implementations ?
No, you can run multiple instances of firefox, chrome, or whatever from your machine at any one time. If you research "Selenium Grid", you will see that it is designed to do that.
So:
The unable to bind message on firefox is not caused by another driver locking a port. Each driver instance starts on its own open port.
If you are not using Selenium Grid, or not using the grid, and are trying to handle the multi-threading yourself, just be careful of how you open and close your browsers in your #Configuration phases in your test runner.
As a educated guess, if you have instability, its more likely because you are trying to control a newer browser with a too-old version of Selenium? We need more info on your question, such as an example project to look at.
I'm using protractor for testing. 99% of the times there's no need to actually see the browser, the tests take a long time, and all we're interested in is the final outcome.
Is there a way to hide the browser opened for testing (e.g. run in the background)?
As stated before, docker-selenium works wonders. The only browser not supported by docker-selenium is Internet Explorer, for obvious reasons.
From what I understand, you cannot really reliably control the way browser windows are opened via protractor/webdriverjs/selenium.
A common way to approach the problem is to use a virtual display, see:
Can Selenium Webdriver open browser windows silently in background?
An alternative way to accomplish that, would be to run tests inside a docker-selenium container, here is a quite detailed introduction:
protractor with any headless browser?
Or, as pointed out here and if you are on Mac OS X, you can run selenium tests on the same machine but under a different user which would not interfere with your current display.
You can also run protractor tests in a docker container in a headless firefox:
Protractor-Firefox-Headless-Docker
Another alternative would be to use a remote selenium server, as, for example, BrowserStack or Sauce Labs services provide.
You can try headless browser like PhantomJS for this purpose. PhantomJS runs in background and failures can be captured using screenshot.
Refer following link to know more about phantomjs:
Protractor running tests on PhantomJS
By default phantomjs uses chrome capabilities. Is it possible to run it with IE capabilities .If so, I need to use it for page-object gem like:
#browser = Watir::Browser.new(:phantomjs, args: '--ignore-ssl-errors=true')
Can any body please provide me any solution for it.
The quick answer is no: Phantom is using the same WebKit rendering engine that Chrome/Safari uses (*), so cannot act like IE.
You might be interested in TrifleJS which is a headless IE port of PhantomJS. (The project is in the early stages, and (AFAIK) won't work with CasperJS yet, and does not seem to support selenium integration either yet.)
*: More precisely, Phantom 1.9 is equivalent to about Chrome 13. And recent versions of Chrome use Blink, not WebKit. So Phantom 2.x, when finally released, won't be equivalent to any version of Chrome.