In Grid selenium, do I need to start Hub? - java

Accidentally, I start using the node without starting the Hub.. and it is work... flawlessly, with IE, Firefox & chrome.
I'm new for Selenium Grid, so I'm not sure if it is OK or not and if there are any drop back?
using : Selenium 2.45, Java

Ok, it's possible and will work fine as I understand. This option is used for investigating problems with configuration. You can find section Hub diagnostic messages. It recommends to connect directly to node if 'CREATIONFAILED' message is shown in hub log.

Related

WebPage works if opened manualy. Returns "Window language could not be determined" if opened via Selenium

I am dealing with a small problem. I am working on automating few tasks in a web application,i can open the webpage,enter the login,click login,BUT then it starts to act strange. If i click on the login manualy it logs in without a problem.
But if i try to do it via selenium (JAVA jdk1.7.0_75,selenium-java-2.53.1,running on IEDriverServer_Win32_3.4.0) the page opens with error An error has occured.
java.lang.NullPointerException. and with "Window language could not be determined "
The page is on the intranet. I guess the application has a problem with the Webdriver (everything works if i try to automate the task using the VBS).
Dont you know any "workaround" for that?
(I can use only IE,because chrome no longer supports NPAPI so the application does not work in chrome)
InternetExplorerDriver driver = new InternetExplorerDriver();
driver.get("*the webpage*");
driver.findElementByName("userid").sendKeys("*login*");
driver.findElementByName("password").clear();
driver.findElementByName("password").sendKeys("*password*");
driver.findElementByName("ctr").sendKeys("*number*");
driver.findElementByName("menuType").click();
driver.findElementByLinkText("OK").click();
I think the problem is somewhere in the settings,because as i mentioned,if o open the browser manualy and login,it works,no errors and i get into the app.
But the webdriver "browser" has somehow different settings (i think) so it does not work. Problem is,that we have restricted access to the settings of browser,so i cant do much about that.
Thank you very much for any suggestions/answers/tips!!
Kind Regards,
Jerry Woodburn

Arquillian Drone + Selenium Grid 2.0: Keep unused Browser alive

I am using Arquillian Drone + Graphene (standalone) for driving automated Browser Tests on a Selenium Grid 2.0 hosted on another machine. The tests are run via Arquillian in client mode (the server to be tested is already running)
Some of my tests require using two browsers at once, therefore i added a second Browser according to the Graphene Documentation.
So far everything is working.
The Problem:
Running a test which has both browsers injected has both of them started up before any test of the class is run. As there may be a few tests before the second browser is used, it most likely has already timed out.
Of course i could set the Selenium Grid Settings to never (or very late) close the browser via timeout, but that cannot be the solution.
Is there a way to check if the WebDriver is still up and restart it via Drone?
Without Drone i simply could check if the driver quit (e.g. like this) and create a new instance. But i want to have it injected via Drone.
In the best case i would like to be able to define when Drone should open the browser or even better keep it open until the test is finished.
If thats not possible a way to restart it would be sufficient.
I solved the Problem by directly injecting the WebDriver into the test method.
public void test(#Drone #Browser2 WebDriver webdriver){...}
I am still not completely happy with this solution but it does work.

Use new temp firefox profile each time with selenium server

Im using the selenium server 2.35.0 which im starting using
java -jar selenium-server-standalone-2.35.0
And then running my tests from a php script using the Testing_Selenium binding.
It seems to be opening in the same Firefox profile each time, how can i change this ? I understand this is not the default, but it has been changed somewhere down the line and im not sure how to undo it.

how to update already running selenium RC test from a Java client?

How to approach the following scenario?
Say a test is already running in selenium rc node on a remote server using RemoteWebDriver.
The test encounters a missing element (slightest xpath change across different pages).
User provides the correct xpath for that element (this part is done in the Java application running on the user's computer) and selenium test searches for the element again and continues with rest of the test.
First thing that comes to mind is that Selenium server is using Jetty server. How would I communicate between by client java application and this server? can Jetty be ignored and somehow make the client communicate directly with the running selenium test?
When the element can not be located by a given xpath the webdriver will throw an exception which will bubble back to where you are running your test. As long as you catch this exception you will have the chance to check different xpaths.
i guess you are looking for , halt the execution in the browser and continue that execution from where ever you want (from previous statement ), instead of the browser responding back to selenium RC and to client program.
-- you want to completely stop the browser response to the request made by the selenium RC
if this is correct can you please confirm, may be i can help you.

How to launch Selenium htmlSuite on a distant RC server?

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.

Categories