Selenium not opening virtual browser window on Linux - linux

I am using Selenium to conduct user interface tests with JUnit, in a Maven project. The project is located on a Linux box running IEs4Linux and Wine to allow us to run the tests in IE.
Right now I'm using Xming along with Putty to view the virtual browser windows, and I am able to open an IE window with the command "ie6", and I can see it functioning correctly in Xming.
When setting up the Selenium RC using the *iexplore browser mode, I get the following in the RC server window:
INFO - Command request: getNewBrowserSession[*iexplore, http://asdfasdfasdf.com:7011/, ] on session null
INFO - creating new remote session
INFO - Allocated session asdfasdfasdfasdfasdfasdfadsf for http://asdfasdfasdf.com:7011/, launching...
INFO - Launching Embedded Internet Explorer...
INFO - Launching Internet Explorer HTA...
Which is normal, except the browser never opens and the tests never run. Using *iexploreproxy or *piiexplore, I get the following error from the RC:
13:46:06.957 INFO - Got result: Failed to start new browser session: org.openqa.selenium.server.browserlaunchers.WindowsUtils$WindowsRegistryException: Problem while managing the registry, OS Version '2.6.18-164.11.1.el5', regVersion1 = null on session null
Is there any reason Selenium would fail to launch the IE window using *iexplore? I would use *firefox or *chrome but the application I am testing is only compatible with IE. Also note that these test cases run perfectly fine on my local Windows machine.
Please let me know if you need more details.

Got it working...in case anybody else attempts to use a similar configuration to mine...for whatever reason it seems you cannot start up the server with the Http.proxyName and Http.proxyPort settings when using IEs4Linux to open IE6...it will just ignore them. You have to manually open the IE6 browser and enter the proxy settings yourself (most likely localhost and 4444).
I think I'll start looking into IE7 for Linux...apparently IE6 doesn't like Selenium's use of XPaths.

Related

How to set xdg-settings (or some other setting) to launch different web browsers based on launching application

I would like to have default launching of a browser to be different when launching from different programs.
For instance:
when I open a link from Discord I'd like it to be launched in
Firefox.
When I run npm run dev, I want my development app to
launch in Brave.
As for the second example, the issue I run into is that the browser window gets hi-jacked every time the code is updated. So I'd like the default launch from the npm application to launch a different browser than the one I'm using for research.

Stop node-debug from opening a new browser window

The command:
node-debug sls offline
opens a new browser window every time it is run.
How do we stop it from opening a new window every time? I want to reuse the existing window!
This is a known issue with node inspector. Take a look here.
Since 0.9.0 we use https://github.com/benderjs/browser-launcher2 to
start the browser, and make sure it's Chrome/Chromium/Opera (i.e. the
browsers that can properly render node inspector; we detect installed
browsers in the system and choose the most appropriate one; earlier we
used opener module which just delegated opening the browser to the OS,
which would open the defaul browser, which could have been e.g.
Firefox) and this could be the reason why the behavior has changed.
browser-launcher2 actually does a bit more than just launching a
browser, for instance it creates a new profile for Chrome in a
subfolder of ~/ - this is probably the issue that #CalvinScott
reported (i.e. Chrome that was opened was the new profile created by
browser-launcher, not your original profile; you should be able to
open your original profile of Chrome normally)
Also, you may consider this:
Since version 6.3, Node.js provides a buit-in DevTools-based debugger
which mostly deprecates Node Inspector, see e.g. this blog post to get
started. The built-in debugger is developed directly by the
V8/Chromium team and provides certain advanced features (e.g.
long/async stack traces) that are too difficult to implement in Node
Inspector.

How to make webDriver testsuite created in windows machine to run in a linux box

I have got selenium WebDriver testsuite done using TestNg framework. I have used selenium webDriver 2.44.0 & FF32.
Now my build team wants my test to run in their demo box which is linux machine. 10..*.248 box
What i have done till now. I am not using any other tools like jenkis, maven etc.
Created java project 'myproject' testsuite in ecplise luna using
TestNg frame in my windows machine
Created a runnable Jar for myproject( myproject-version-1.0.1.jar)
Placed the runnable jar in 248 box using winSCP in a folder /home/project/
In 248 machine FF37 is available. So i upgraded my script with selenium 2.45.0 . It runs fine in my windows machine with FF32 version also.
Now using putty i logged into 248 machine and reached the folder /home/project/ where my runnable jar is placed.
I executed the shell command java -jar myproject-version-1.0.1.jar
Console shows the following exception:
[TestNG] Running:
Command line suite
org.openqa.selenium.firefox.NotConnectedException: Unable to connect to host 127.0.0.1 on port 7055 after 45000 ms. Firefox console output:
Error: no display specified
Error: no display specified
I know i have not done correctly. I read few links posted here about about setting display in linux machine , using Xvfb – the X Virtual FrameBuffer.
Webdriver Unable to connect to host 127.0.0.1 on port 7055 after 45000 ms
I think the person who posted the question in above link had done the similar settings. !
Can somebody please help me with this as i am not able to understand :( Step by step process so that i can run my script in build team's machine.
I am very new to this field and doing all this for the first time. I read someting about headless GUI etc. I am not able to understand.
Would really appreciate if you could help me understand the steps involved.
You have done pretty much the right things as specified in the question
One thing that I came to observer that you have not specified complete URL in the get method. This might cause you some trouble. So first edit
driver.get("docs.seleniumhq.org/");
to
driver.get("http://docs.seleniumhq.org/");
If the code still doesn't works. Then try bundling latest selenium-java.jar and selenium-standalone.jar
But from the error it also seems that may be port 7055 is not free. (but I think you already checked that.)
So the problem gets a little bit confined to the selenium jars which are often incompatible if they are of different versions.

Run Selenium RC script on any browser that is available on user's system

I have a selenium script which i want to run on some other user's machine. I have set 'firefox' as my default browser in the selenium script.
Now the user's machine does not have 'firefox' installed on his machine.
Is there any code available that can fetch which browser is installed on that user's machine and run the script in that browser?
I want to have 3 browsers in my script like IE, Firefox and Chrome.
The script must run on any one browser which is installed on user's machine.
Any help will be appreciated. Thanks
You would either have to have some code that looks for each kind of browser (e.g. looking for the executable such as chrome.exe or firefox.exe) or you might be able to get away with some try-catch blocks that try to get Selenium to launch the browser, and treat any exceptions as 'browser didn't exist'.
I would suggest that specifically checking for each browser type is the better option though.
You could then build up a list of the available browsers and have some code to select one of them (based on some kind of priority/preference) as the target for Selenium

How can I control in which of my desktops the browser called by selenium remote server will pop up?

I am running tests from phpunit using selenium. Since the tests take a couple of minutes proceed, I would like to switch to another desktop and do some tasks while the tests are running in the background.
However, since every test calls a new browser via selenium remote server, and a new test management window and a application window are started, these new windows do not appear in the desktop which I started the php tests from, but in my current desktop taking the focus away from the window I am working in.
How can I control that the browsers are always opens in the desktop that is in the background (where I start phpunit)? I am using Kubuntu i.e. the KDE Desktop.
Thanks for any suggestions!
This is probably a bit late, but for anyone reading this: When you launch your selenium RC server, you could try exporting to a specific display using the command:
export DISPLAY="somedisplay" && java -jar /path/to/selenium-server.jar
Using this, you could also export it to for instance an X virtual frame buffer (Xvfb), effectively running it in the background.

Resources