i have got a problem with my executable jar on my cubietruck running on cubian.
I want to start the jar when the cubietruck starts. The Jar itselfs uses selenium-server-standalone-2.43.1.jar to control firefox.
For starting my jar i created a simple bash script ('/usr/local/bin/startplt.sh')
#!/bin/bash
PATH=/bin:/sbin:
JAVA=/usr/bin/java
JARFILE=/home/cubie/plt/plt.jar
USER=cubie
/bin/su -$USER -c "$JAVA -jar $JARFILE"
Executing this script in Console works and opens firefox successful.
For getting my jar to start at startup i created a service ('/etc/init.d/startjar')
#! /bin/sh
### BEGIN INIT INFO
# Provides: startjar
# Required-Start: $all
# Required-Stop: $remote_fs $syslog $local_fs $network
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Starts plt.jar
# Description: starts a the main jarfile
### END INIT INFO
NAME="startjar"
DESC="Starts /home/cubie/plt/plt.jar"
case "$1" in
start)
export DISPLAY=:0.0
sudo /usr/local/bin/startplt.sh
;;
stop)
pkill -f /home/cubie/plt/plt.jar
pkill -f iceweasel
;;
*)
exit 1
;;
esac
exit 0
And inserted it to system by:
insserv /etc/init.d/startjar
The service gets executed at startup but it doesnt start firefox.
Instead its writing in the logfile :
org.openqa.selenium.firefox.NotConnectedException: Unable to connect to host 127.0.0.1 on port 056 after 45000 ms. Firefox console output:
No protocol specified
Error: cannot open display: :0.0
No protocol specified
Error: cannot open display: :0.0
at org.openqa.selenium.firefox.internal.NewProfileExtensionConnection.start(NewProfileExtensionConnection.java:118)
at org.openqa.selenium.firefox.FirefoxDriver.startClient(FirefoxDriver.java:246)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:114)
at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:193)
at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:186)
at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:182)
at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:95)
at de.etc.plt.display.DisplayManager.<init>(DisplayManager.java:20)
at de.etc.plt.display.DisplayManager.getInstance(DisplayManager.java:26)
at de.etc.plt.service.impl.DisplayService.<init>(DisplayService.java:25)
at de.etc.plt.MainThread.run(MainThread.java:33)
at java.lang.Thread.run(Thread.java:745)
2014-10-09 12:25:27 [ERROR]:Firefox konnte nicht gestartet werden
2014-10-09 12:25:27 [org.openqa.selenium.WebDriverException]:Failed to connect to binary FirefoxBinary(/usr/bin/firefox) on port 7056; process output follows:
No protocol specified
Error: cannot open display: :0.0
No protocol specified
Error: cannot open display: :0.0
Build info: version: '2.43.1', revision: '5163bce', time: '2014-09-10 16:27:33'
System info: host: 'Cubian', ip: '127.0.0.1', os.name: 'Linux', os.arch: 'arm', os.version: '3.4.79-sun7i', java.version: '1.7.0_65'
Driver info: driver.version: FirefoxDriver
org.openqa.selenium.WebDriverException: Failed to connect to binary FirefoxBinary(/usr/bin/firefox) on port 7056; process output follows:
No protocol specified
Error: cannot open display: :0.0
No protocol specified
Error: cannot open display: :0.0
Build info: version: '2.43.1', revision: '5163bce', time: '2014-09-10 16:27:33'
System info: host: 'Cubian', ip: '127.0.0.1', os.name: 'Linux', os.arch: 'arm', os.version: '3.4.79-sun7i', java.version: '1.7.0_65'
Driver info: driver.version: FirefoxDriver
at org.openqa.selenium.firefox.internal.NewProfileExtensionConnection.start(NewProfileExtensionConnection.java:130)
at org.openqa.selenium.firefox.FirefoxDriver.startClient(FirefoxDriver.java:246)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:114)
at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:193)
at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:186)
at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:182)
at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:95)
at de.etc.plt.display.DisplayManager.<init>(DisplayManager.java:20)
at de.etc.plt.display.DisplayManager.getInstance(DisplayManager.java:26)
at de.etc.plt.service.impl.DisplayService.<init>(DisplayService.java:25)
at de.etc.plt.MainThread.run(MainThread.java:33)
at java.lang.Thread.run(Thread.java:745)
Caused by: org.openqa.selenium.firefox.NotConnectedException: Unable to connect to host 127.0.0.1 on port 7056 after 45000 ms. Firefox console output:
No protocol specified
Error: cannot open display: :0.0
No protocol specified
Error: cannot open display: :0.0
at org.openqa.selenium.firefox.internal.NewProfileExtensionConnection.start(NewProfileExtensionConnection.java:118)
... 11 more
I really dont understand why the simple script startplt.sh is working even without the extra added line export DISPLAY=:0.0 to get rid of the error "no display specified"
Maybe the service is starting before even the xserver started? I dont know how to find that out. Some Help would be really appreciated.
If you have another working solution for executing scripts after boot on cubian i would be happy too.
EDIT: I got firefox working via enabling multiple users to use the xserver with xhost + and then service startjar start. But still have the problem that it isnt working on start of the system
I fixed my issue by changing the startplt.sh to
#!/bin/bash
PATH=/bin:/sbin:
JAVA=/usr/bin/java
JARFILE=/home/cubie/plt/plt.jar
USER=cubie
DISPLAY=:0
export DISPLAY
xhost +
/bin/su -$USER -c "$JAVA -jar $JARFILE"
and removed that one line from the startjar service.
the xhost + was needed to allow m< jar to use my xserver for setting up the firefox
Related
I am trying to create a simple AWS based java selenium app.
I have installed java JDK, and google-chrome
I have created a sample app which runs fine from windows (with chrome-driver ofc)
But when I copy the code to AWS and try to run I always get this error.
Any idea how to solve this?
[root#ip-172-31-43-139 ec2-user]# java -version
java version "1.7.0_151"
OpenJDK Runtime Environment (amzn-2.6.11.0.74.amzn1-x86_64 u151-b00)
OpenJDK 64-Bit Server VM (build 24.151-b00, mixed mode)
[root#ip-172-31-43-139 ec2-user]# google-chrome --version
Google Chrome 60.0.3112.113
My sample code
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.chrome.ChromeOptions;
/**
* Hello world!
*
*/
public class App
{
public static void main( String[] args )
{
System.out.println( "Hello World!" );
WebDriver driver = null;
// System.setProperty("webdriver.chrome.driver", "chromedriver");
//Set up
ChromeOptions options = new ChromeOptions();
options.setBinary("/usr/bin/google-chrome");
options.addArguments("--headless");
options.addArguments("--disable-gpu");
options.addArguments("--screenshoot");
driver = new ChromeDriver(options); // dies here <-
driver.get("http://www.google.com");
//Tear down
driver.quit();
}
}
Console output:
Hello World!
/opt/google/chrome/google-chrome: symbol lookup error: /opt/google/chrome/lib/libgtk-3.so.0: undefined symbol: g_log_structured
Nov 06, 2017 1:44:12 PM org.openqa.selenium.os.UnixProcess checkForError
SEVERE: org.apache.commons.exec.ExecuteException: Process exited with an error: 127 (Exit value: 127)
Exception in thread "main" org.openqa.selenium.remote.UnreachableBrowserException: Could not start a new session. Possible causes are invalid address of the remote server or browser start-up failure.
Build info: version: '2.52.0', revision: '4c2593cfc3689a7fcd7be52549167e5ccc93ad28', time: '2016-02-11 11:22:43'
System info: host: 'ip-172-31-43-139', ip: '172.31.43.139', os.name: 'Linux', os.arch: 'amd64', os.version: '4.9.51-10.52.amzn1.x86_64', java.version: '1.7.0_151'
Driver info: driver.version: ChromeDriver
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:665)
at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:249)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:131)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:144)
at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:170)
at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:159)
at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:148)
at hu.csani.aws_test.App.setUp(App.java:33)
at hu.csani.aws_test.App.main(App.java:19)
Caused by: org.openqa.selenium.WebDriverException: Timed out waiting for driver server to start.
Build info: version: '2.52.0', revision: '4c2593cfc3689a7fcd7be52549167e5ccc93ad28', time: '2016-02-11 11:22:43'
System info: host: 'ip-172-31-43-139', ip: '172.31.43.139', os.name: 'Linux', os.arch: 'amd64', os.version: '4.9.51-10.52.amzn1.x86_64', java.version: '1.7.0_151'
Driver info: driver.version: ChromeDriver
at org.openqa.selenium.remote.service.DriverService.waitUntilAvailable(DriverService.java:178)
at org.openqa.selenium.remote.service.DriverService.start(DriverService.java:166)
at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:78)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:644)
... 8 more
Caused by: org.openqa.selenium.net.UrlChecker$TimeoutException: Timed out waiting for [http://localhost:22678/status] to be available after 20005 ms
at org.openqa.selenium.net.UrlChecker.waitUntilAvailable(UrlChecker.java:107)
at org.openqa.selenium.remote.service.DriverService.waitUntilAvailable(DriverService.java:175)
... 11 more
Caused by: com.google.common.util.concurrent.UncheckedTimeoutException: java.util.concurrent.TimeoutException
at com.google.common.util.concurrent.SimpleTimeLimiter.callWithTimeout(SimpleTimeLimiter.java:143)
at org.openqa.selenium.net.UrlChecker.waitUntilAvailable(UrlChecker.java:80)
... 12 more
Caused by: java.util.concurrent.TimeoutException
at java.util.concurrent.FutureTask.get(FutureTask.java:201)
at com.google.common.util.concurrent.SimpleTimeLimiter.callWithTimeout(SimpleTimeLimiter.java:130)
... 13 more
The google-chrome works fine from terminal...
try to update your java to JAVA 8 (1.8)
faced same issue, but with slightly different error
SEVERE: org.apache.commons.exec.ExecuteException: Process exited with an error: 139 (Exit value: 139)
Something were wrong with driver extraction from archive - right size is ~8MB
for failed
drwxrwxr-x 2 jenkins jenkins 4096 Mar 12 10:01 .
drwxrwxr-x 6 jenkins jenkins 4096 Oct 10 10:10 ..
-rwxrw-r-- 1 jenkins jenkins 1376159 Oct 10 10:10 chromedriver
for successful
drwxrwxr-x 2 jenkins jenkins 4096 Oct 10 10:11 .
drwxrwxr-x 7 jenkins jenkins 4096 Oct 10 10:11 ..
-rwxrw-r-- 1 jenkins jenkins 8950080 Oct 10 10:11 chromedriver
I m trying to launch Safari Browser on iPhone 6 using Appium along with Selenium.
Please find the configuration details I m using.
iPhone : 6
MAC : 10.12.4
Xcode : 8.3.2
Appium : 1.5.3
Below is the code I have written to start driver.
desCapabilities = DesiredCapabilities.safari();
desCapabilities.setCapability("platformName","iOS");
desCapabilities.setCapability("deviceName", "iPhone 6");
desCapabilities.setCapability("browserName", "Safari");
desCapabilities.setCapability("platformVersion", "10.3.1");
desCapabilities.setCapability("app", "com.apple.mobilesafari");
desCapabilities.setCapability("udid", "*******");
public static RemoteWebDriver iOSDriver = new IOSDriver<MobileElement>(new URL("http://" + nodeUrl + ":" + nodeUrlPort + "/wd/hub"), desCapabilities);
While Running the test, it throws the below error. Kindly provide the suggestions to solve this issue.
org.openqa.selenium.WebDriverException: An unknown server-side error occurred
while processing the command. Original error: Command failed: ideviceinstaller
-u <udid> i./Applications/Appium.app/Contents/Resources/node_modules/appium/node_modules/appium-ios-driver/build/SafariLauncher/SafariLauncher.app(WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 8.13 seconds
Build info: version: '2.53.1', revision:'a36b8b1cd5757287168e54b817830adce9b0158d', time: '2016-06-30 19:26:09'
System info: host: 'MacBook.local', ip: '****', os.name: 'Mac OS X', os.arch:'x86_64', os.version: '10.12.4', java.version: '1.7.0_71'
Driver info: io.appium.java_client.ios.IOSDriver
You are using the appium version 1.5.3 which is not compatible from xcode 8 and ios 10. Update your appium to 1.6 or above.
To know how to start the appium server after installing appium 1.6 refer the below link:
Launch and run appium in Mac
I am currently trying to let Jenkins run a selenium-test I have written.
If I execute the jar-file with my user in command line, it works: Firefox opens and the actions I have defined in the script are taking place, but when I login as jenkins-user and execute the jar I get the following error:
org.openqa.selenium.firefox.NotConnectedException: Unable to connect to host 127.0.0.1 on port 7055 after 45000 ms. Firefox console output:
No protocol specified
No protocol specified
Error: cannot open display: :0
at org.openqa.selenium.firefox.internal.NewProfileExtensionConnection.start(NewProfileExtensionConnection.java:122)
at org.openqa.selenium.firefox.FirefoxDriver.startClient(FirefoxDriver.java:271)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:117)
at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:218)
at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:211)
at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:207)
at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:120)
at com.example.tests.test_login_logout.setUp(test_login_logout.java:24)
at com.example.tests.test_login_logout.testLoginLogout(test_login_logout.java:40)
at com.example.tests.test.main(test.java:8)
Exception in thread "main" org.openqa.selenium.WebDriverException: Failed to connect to binary FirefoxBinary(/usr/bin/firefox-bin) on port 7055; process output follows:
No protocol specified
No protocol specified
Error: cannot open display: :0
Build info: version: '2.48.2', revision: '41bccdd', time: '2015-10-09 19:55:52'
System info: host: 'CAPSIDT410', ip: '127.0.1.1', os.name: 'Linux', os.arch: 'amd64', os.version: '3.2.0-97-generic', java.version: '1.7.0_91'
Driver info: driver.version: FirefoxDriver
at org.openqa.selenium.firefox.internal.NewProfileExtensionConnection.start(NewProfileExtensionConnection.java:134)
at org.openqa.selenium.firefox.FirefoxDriver.startClient(FirefoxDriver.java:271)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:117)
at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:218)
at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:211)
at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:207)
at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:120)
at com.example.tests.test_login_logout.setUp(test_login_logout.java:24)
at com.example.tests.test_login_logout.testLoginLogout(test_login_logout.java:40) at com.example.tests.test.main(test.java:8)
Caused by: org.openqa.selenium.firefox.NotConnectedException: Unable to connect to host 127.0.0.1 on port 7055 after 45000 ms. Firefox console output:
No protocol specified
No protocol specified
Error: cannot open display: :0
at org.openqa.selenium.firefox.internal.NewProfileExtensionConnection.start(NewProfileExtensionConnection.java:122)
... 9 more
I already tried to add Xvfb, changed the displayname, checked that I have the latest versions of Firefox and Selenium-server, downgraded my Firefox to previous versions, but nothing solved the problem.
I suspect it has something to do with the fact that jenkins is not a regular user but a "service user" instead. I can only login with this user via command line, and only after I modified the user to require a password.
How can I make this test work with Jenkins?
I have a selenium code that uses chromedriver in windows. I have set the chromedriver using following:
ChromeDriverManager.getInstance().setup();
When i execute it in Windows, It works fine.
But when i create a jar for my code and execute it in unix using (java -cp xyz.jar classname). I get following error:
SEVERE: org.apache.commons.exec.ExecuteException: Process exited with an error: 127 (Exit value: 127)
Exception in thread "main" org.openqa.selenium.remote.UnreachableBrowserException: Could not start a new session. Possible causes are invalid address of the remote server or browser start-up failure.
Build info: version: '2.44.0', revision: '76d78cf323ce037c5f92db6c1bba601c2ac43ad8', time: '2014-10-23 13:11:40'
System info: host: 'sample.home.com', ip: '10.1.30.207', os.name: 'Linux', os.arch: 'amd64', os.version: '3.14.35-28.38.amzn1.x86_64', java.version: '1.7.0_75'
Driver info: driver.version: ChromeDriver
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:593)
at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:240)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:126)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:139)
at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:171)
at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:160)
at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:117)
at com.snapdeal.hadoop.monitoring.hdfs_monitoring.HadoopM.main(HadoopM.java:68)
Can someone please confirm what changes should be done in my script so that it can be run on unix machine?
I have a testing server for my phpunit, and now we want to add our codeception acceptance testing with selenium.
But as you the remote server has no "desktop" so it will not open a browser like in our developers computers.
I tried installing firefox on the machine but I still get this error:
Cannot find firefox binary in PATH. Make sure firefox is installed. OS appears to be: LINUX
Build info: version: '2.44.0', revision: '76d78cf', time: '2014-10-23 20:02:37'
System info: host: 'testdev', ip: '127.0.1.1', os.name: 'Linux', os.arch: 'amd64', os.version:
'3.2.0-23-generic', java.version: '1.7.0_65'
Driver info: driver.version: FirefoxDriver
so now I did this
WebDriver:
url: 'http://example.com/'
browser: firefox
capabilities:
binary: "/usr/bin/firefox"
and I get this error:
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
is it possible what I'm doing?
or I must have a "screen"?
In order to use Selenium with Firefox, or Chrome, etc - you need a linux distro that has a User Interface.
If you are on a linux machine that doesn't have a display (aka, just a terminal), then you can research Selenium HTMLUnit (headless browsing).
You could do headless browsing via the PHPBrowser, or you could install a GUI like xfce4 vnc4server, which will give you a virtual desktop to run Firefox in. This has the added bonus that you can watch the test run graphically.