Im testing with selenium on ubuntu. Test in invisible workspace - unit-testing

Im testing my code with selenium RC. And every time when i run tests, selenium starts a browser in my active workspase, and i don't like this way. how can i set a selenium workspase to run selenium browsers in another workspace?

For repetitive testing, you should consider using xvfb for having a headless selenium. We've branched it to hudson for CIT
There's a maven plugin available, for example

Related

PyCharm coverage only measures test directory for a GAE app with Selenium tests

I'm developing a GAE app in Python using the PyCharm IDE. I have developed an initial set of Selenium WebDriver unit tests, which are in directory "test", with "test" at the top level of the project directory. Note that my tests do not directly call the GAE modules. They only utilize Selenium, which in turn runs the app thru a browser.
When I use menu option "Run 'Unittests in test' with coverage", I get a report showing coverage within directory "test", and also the colors show up in the left margin for the Python modules in "test". The information looks accurate. Very cool!
However, the rest of the files in my project show "not covered", even though the tests exercise a lot of that code via Selenium remote control of a browser.
In settings, I've tried checking "Use bundled coverage.py" and, after running sudo pip install coverage, I've also tried unchecking "Use bundled coverage.py". My results are the same either way.
Is it possible that you simply cannot obtain coverage of a GAE app being exercised via Selenium?

Lettuce test with django and selenium no run on windows

I have a lettuce test suite using selenium and everything works just fine on linux.
After I installed django and everything that's needed on windows to test the suite on IE8,9 too, and I tried to run the test, it only opens my browser and says that the test passed with 0 features, 0 steps etc. The same test suite on linux runs just fine.
What do I need to make them work on windows 7 too ???
I use python for my test.
Maybe it's not the best solution for you problem, I'm not even sure that it's valid for IE, but you could try to launch IE remotely so you will not need to launch whole application on windows (i.e. if you were using gunicorn as wsgi server, you couldn't launch on windows at all).
Python-selenium has functionality to use remote browsers, I'm just not sure about IE.

Does Selenium support headless browser testing?

I'm looking at Selenium Server at the moment, and I don't seem to notice a driver that supports headless browser testing.
Unless I'm mistaken, it doesn't support it. If you're on X, you can create a virtual framebuffer to hide the browser window, but that's not really a headless browser.
Can anyone enlighten me? Does Selenium support headless browser testing?
you need not use PhantomJS as an alternative to Selenium. Selenium includes a PhantomJS webdriver class, which rides on the GhostDriver platform. Simply install the PhantomJS binary to your machine. in python, you can then use:
from selenium import webdriver
dr = webdriver.PhantomJS()
and voila.
The WebDriver API has support for HTMLUnit as the browser for your testing. Ruby people have been using Capybara for a while for their headless selenium testing so it is definitely doable.
I know this is a old post. Thought it will help others who are looking for an answer.
You can install a full blown firefox in any linux distribution using XVFB. This makes sure your testing is performed in a real browser. Once you have a headless setup, you can use webdriver of your choice to connect and run testing.
Headless browsers are a bad idea. They get you some testing, but nothing like what a real user will see, and they mask lots of problems that only real browsers encounter. You're infinitely better off using a "headed" browser (i.e., anything but HTMLUnit) on a headless environment (e.g., Windows, or Linux with XVFB).
I notice that you say that using an X framebuffer isn't a true headless solution, however, for most, I think it would be acceptable. In addition to that, this service will help get that going for you if you are interested in that as a solution.
Selenium does support headless browser testing in a way. Docker Selenium is maintained by SeleniumHQ. Those docker containers come with xvfb support with them out of the box. There are tools like PhantomJS that you can hook up with Selenium. However, it's not officially supported by Selenium itself.
Much like what others have described, PhantomJS isn't really recommended. The whole point of Selenium is to automate browsers. But why automate a browser no one uses? I never understood how that was overlooked so often by developers..
Yes. Selenium support headless browser testing and it's more faster as well as convient for big amount of test-cases execution.
ChromeOptions cromeOptions = new ChromeOptions();
//Location of browser binary/.exe file
cromeOptions.setBinary("/usr/bin/google-chrome-stable");
cromeOptions.addArguments("--headless");
cromeOptions.addArguments("--no-sandbox");
cromeOptions.addArguments("--disable-gpu");
cromeOptions.addArguments("--window-size=1920,1080");
WebDriver webDriver = new ChromeDriver(cromeOptions);
Yes ,selenium supports headless browser testing...but i found HTMLUnit failing most times...I was searching for an alternative...PhantomJs was really good.you can definitely give it a try it was very fast when compared to other browsers...It is really good for smoke testing...
http://phantomjs.org/
With ruby and macOS: brew install phantomjs then:
driver = Selenium::WebDriver.for :phantomjs
Yes Selenium supports headless browser testing.Headless browsers are faster than real time browsers.
Install chromeDriver and google-chrome-stable version on the linux server, where the tests will be triggered and add the same binaries in your code.
code snippet:
private static String driverPath = "/usr/bin/chromedriver";
static
{
System.setProperty("webdriver.chrome.driver", driverPath);
options = new ChromeOptions();
options.setBinary("/usr/bin/google-chrome-stable");
options.addArguments("headless");
driver = new ChromeDriver(options);
}
Here's a "modern answer" on how to use Selenium with xvfb and Firefox driver in an Ubuntu Linux environment running Django/Python:
# install xvfb and Firefox driver
sudo su
apt-get install -y xvfb firefox
wget https://github.com/mozilla/geckodriver/releases/download/v0.19.1/geckodriver-v0.19.1-linux64.tar.gz
tar -x geckodriver -zf geckodriver-v0.19.1-linux64.tar.gz -O >
/usr/bin/geckodriver
chmod +x /usr/bin/geckodriver
# install pip modules
pip install selenium
pip install PyVirtualDisplay
You can then follow the Django LiveServerTestCase instructions.
To use the driver you just installed, do something like this:
from pyvirtualdisplay import Display
from selenium.webdriver.firefox.webdriver import WebDriver
driver = WebDriver(executable_path='/usr/bin/geckodriver')
display = Display(visible=0, size=(800, 600)).start()
# add your testing classes here...
driver.quit()
display.stop()

Selenium, automated frontend testing on different OS

My complete working environment is Linux based (Ubuntu for desktop and server). I use Hudson and Selenium to execute tests on my EE6/ZK web application with any browser available for Ubuntu.
But how would I test my application with IE (Windows) without setting up a Selenium server in Windows. Thought I could run Windows in a VMWare or Virtualbox, but still it needs a "local" selenium and how would I trigger it ? Install hudson as well and pretty much replicate the complete CI in Windows ? How is MAC ?
Any tips or experience with cross-browser-platform-OS automated testing ?
Sven
You will need to use Selenium Grid. There is a Selenium plug-ins for Hudson available, and this article has a guide how to setup Continuous Integration with Hudson and Selenium Grid. And yes, you will have to install Windows in a virtual machine.

Is there anything similar to Selenium IDE that would run on Internet Explorer 7?

I need to develop Web functional testing for an application that currently supports only IE 7+. I'd also like to have my tests exported in Java so that I can have them integrated with my Java codebase
You can record tests in Selenium IDE on Firefox and then export them to Java (File > Export Test Case As...). You can then using a testing framework such as JUnit or TestNG to run your tests with Selenium RC. To test in Internet Explorer 7, set your browser string to *iexplore (HTA mode) or *iexploreproxy and run the RC on a machine with version 7 installed.
Selenium RC can run on IE 7 and you can do more with it because you can write the tests in high-level languages like Java and Ruby.