I work for a Music company and have my Automation/Regression suite built on Java, jUnit, Selenium WD, Ant framework.
I use Selenium Grid to run the tests on Various Grade A browsers.
Now we are moving to Continuous Integration (Jenkins) setup and I need to run tests on a Linux machine(CentOS) which does not have a UI.
I started off with the following setups to run regression
Run the above mentioned tests (Java, SeleniumWD, JUnit and Ant) in Linux box using Xll, xvfb and Firefox headless browser.
Run the tests on the Linux box using a PhantomJS browser setup.
IN BOTH THE CASES ALL THE TEST THAT REQUIRE FLASH CONTENT TO BE LOADED AND TESTED Fails.
I am NOT ABLE TO ACCESS THE WINDOWS/MAC Machine via/through LINUX BOX (using Hub/node Selenium grid options), connection timed out error is consistent.
IT WOULD BE REALLY HELPFUL IF THERE IS SUGGESTIONS/WORK AROUND/Frameworks TO HANDLE this situation.
Not having windows shouldn't be a problem. Can you setup XWindow sessions and run slave agent there to run real browser session?
Both Firefox and Chromium should work with CentOS.
Related
I want to run my selenium scripts through Jenkins(Linux server) in actual browser but right now it is running in headless mode. I am not able to see the execution of scripts on UI. Can someone help me into this ?
I wanted to know if Chrome GUI browser can be installed in EC2 instances - Linux. I have a situation to run some Selenium java tests and company wants running it on AWS EC2 instance. So wanted to know if a GUI Chrome browser can be installed in EC2 instance?
What are the requirements for executing selenium scripts in Chrome GUI browser in EC2 instances.
I google many stuffs but didn't get perfect guide to this.
Please help.
I have given a scenario of automating winscp, putty and database verification.
winscp - Need to move files from local to server - So planning to do this via AutoIT tool.
Putty - Need to run commands in linux to batch run the moved files - Please provide information on how to automate this part through selenium with Java?
Database - need to wait for 10 minutes after running the commands in putty to verify in tables.
Selenium WebDriver is used for browser automation testing (hence the name WebDriver), so calling PuTTY, database, WinSCP are slightly out of scope for it.
However, this doesn't mean your automated 'Selenium' tests just need to run Selenium, as it's all Java you can use whatever libraries you see fit in your test. So as part of your test, you can use libraries (e.g. AntBuilder to both run SSH and SCP and JDBCTemplate to query databases) to run these parts of the test!
$pip install selenium
$sudo apt-get install firefox xvfb
from selenium import webdriver
from selenium.common.exceptions import NoSuchElementException
from selenium.webdriver.common.keys import Keys
browser = webdriver.Firefox()
browser.get("http://www.yahoo.com")
This is what I have so far, for Selenium. It seems to work, except it says, "Error: no display specified"
My question is: Do I need to run the selenium jar? It doesn't seem to matter whether I run it or not...
First let me define for you client mode and server mode:
Client mode: where the language
bindings connect to the remote
instance. This is the way that the
FirefoxDriver and the RemoteWebDriver
client normally work.
Server mode:
where the language bindings are
responsible for setting up the
server, which the driver running in
the browser can connect to. The
ChromeDriver works in this way
In the current trunk all of the browsers can run in client mode although you must specify the ChromeDriver.exe path. Server mode can be used to do the same thing. You can set up the jar to run to act as a server for a particular browser. You then connect to that server. If you do this you'll see a Jetty server being set up and it handling requests. If this is not happening then you are not using server mode. As I can see from your code you are currently using client mode so there is no need to run the jar unless you want the extra remote functionality of it.
Running the jar is useful if you want to run tests on a remote machine in which case you run the jar there then connect to it from your local machine. The jar will then deal with launching browsers on the machine it is running on and forwarding actions to it.
I believe in the past with the Selenium RC API, it was necessary to always run the jar but with WebDriver this is not the case.
No, you don't need to run Selenium RC server. You can also use the Webdriver method instead, the preferred method for functional testing, which is a "direct" control of the browser as far as I can tell.
I think the server method "Selenium RC server" is more useful for load testing or multiple user testing, especially in the context of using it with Selenium Grid .
We have a huge amount of htmlsuite deisgned by business analyst and we want to launch them during continuous integration (or every night) automatically. The problem is that the machine with selenium-RC is not the same one than the continuous integration :
In java, we used the client-driver and it works fine :
selenium = new DefaultSelenium(serverAddress, SERVER_PORT, browser, url);
selenium.start();
and then selenium.click(..) etc ..
If I use a seleniumServer that I created and launched in java, I can launch HTMLSuite, it works fine too :
RemoteControlConfiguration rcc = new RemoteControlConfiguration();
rcc.setPort(SelHelper.SERVER_PORT);
seleniumServer = new SeleniumServer(rcc);
seleniumServer.start();
HTMLLauncher launcher = new HTMLLauncher(seleniumServer);
If I launch a selenium server independantly (e.g. distant server) and I try to use the htmlLauncher, I does not because it takes as an argument a SeleniumServer that I can not access...
Anyone has a solution ?
The plan B would be to launch in SSH from continuous integration a .cmd file on selenium RC machine containing something like :
java -jar "X:\01_Robot\SELENIUM_RC\selenium-server-1.0.1\selenium-server.jar" -htmlSuite "*firefox" "http://www.myapplication.com" "X:\mytestsuite.html"
But it would be ugly and I want to do that only if I don't have any choice.
I finally found a "HtmlClientDriver" (similar to javaClientDriver) on : https://github.com/takamori/selenium-html-client-driver/wiki which parse html selenese and launch commands on a rc server.
I have implemented an example of a remote webdriver grid configuration in this project on Github here. You might be able to glean some good info from it. See the two .bat scripts "startWebDriverGridHub.bat" and "startWebDriverGridNode.bat". Run the former on your local machine where you are developing (or on your Jenkins server) and run the latter on the remote machine.
I wouldn't recommend starting the grid the way that you have done it, although it is doable, I would say its beyond the scope of a simple Stack question.
Also, don't use HtmlClientDriver. If you want headless, look at PhantomJS driver. If your real intention is to drive a browser on the remote computers desktop, I would use "RemoteWebDriver" in the form of Firefox driver, Chrome, or IE driver, via the scripts I provided above.