Error when running selenium test case using jenkins - java

Encountered the following error. Cannot identify the exact root cause.
Error Message
Failed to connect to binary FirefoxBinary(/usr/lib64/firefox/firefox) on port 7055; process output follows:
Error: cannot open display: :99
Error: cannot open display: :99
Build info: version: '2.45.0', revision: '32a636c', time: '2015-03-05 22:01:35'
System info: host: 'nila.ejyothi.net', ip: '192.168.202.35', os.name: 'Linux', os.arch: 'amd64', os.version: '3.10.0-229.20.1.el7.x86_64', java.version: '1.7.0_91'
Driver info: driver.version: FirefoxDriver
Stacktrace
org.openqa.selenium.WebDriverException: Failed to connect to binary FirefoxBinary(/usr/lib64/firefox/firefox) on port 7055; process output follows:
Error: cannot open display: :99
Error: cannot open display: :99
Build info: version: '2.45.0', revision: '32a636c', time: '2015-03-05 22:01:35'
System info: host: 'nila.ejyothi.net', ip: '192.168.202.35', os.name: 'Linux', os.arch: 'amd64', os.version: '3.10.0-229.20.1.el7.x86_64', java.version: '1.7.0_91'
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.(RemoteWebDriver.java:114)
at org.openqa.selenium.firefox.FirefoxDriver.(FirefoxDriver.java:193)
at org.openqa.selenium.firefox.FirefoxDriver.(FirefoxDriver.java:186)
at org.openqa.selenium.firefox.FirefoxDriver.(FirefoxDriver.java:182)
at com.fetchinglife.application.modules.utilities.CommonFunctions.initBrowser(CommonFunctions.java:74)
at com.fetchinglife.application.modules.employee.EmployeeScheduleFunctionalTest.StartBrowser_NavURL(EmployeeScheduleFunctionalTest.java:34)
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:
Error: cannot open display: :99
Error: cannot open display: :99
at org.openqa.selenium.firefox.internal.NewProfileExtensionConnection.start(NewProfileExtensionConnection.java:118)

This is likely to happen when Selenium webDriver API can't load Firefox driver.
Possible cause could be compatibility between Firefox version and Selenium server version.
Use the latest Selenium Server 2.51.0

Related

Getting exception org.openqa.selenium.WebDriverException: java.net.ConnectException:

I am using Cucumber and Java to automate Selenium test cases. Using Jenkins to execute the job. The job is scheduled to run every day. However, after a few test case runs, my task failed with the following error, which is an intermittent problem. Is there anything that can be done in this scenario?
Error:
org.openqa.selenium.WebDriverException: java.net.ConnectException: Failed to connect to localhost/0:0:0:0:0:0:0:1:29896
Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:17:03' System info: host: 'QTSAUTOMATION', ip: '10.2.0.166', os.name: 'Windows Server 2012 R2', os.arch: 'amd64', os.version: '6.3', java.version: '1.8.0_241'
Driver info: driver.version: RemoteWebDriver at com.TestAutomation.TestRunner.TestRunner.runScenario(TestRunner.java:38) Caused by: java.net.ConnectException: Connection refused: connect

How to write config.yml file in circleCI for java-maven based appium scripts? Unable to write configyml in circleCI for java-mave based appium scripts

I have written scripts using appium java client and maven and i need to run the with circleCI
can anyone help me with this?
Below is the yml file I wrote but its not working for me
version: 2
jobs:
build:
docker:
# specify the version you desire here
- image: circleci/openjdk:8-jdk-node
- image: appium/appium-emulator
environment:
# Customize the JVM maximum heap limit
MAVEN_OPTS: -Xmx3200m
steps:
- checkout
# Download and cache dependencies
- restore_cache:
keys:
- v1-dependencies-{{ checksum "pom.xml" }}
# fallback to using the latest cache if no exact match is found
- v1-dependencies-
- run: mvn dependency:go-offline
- save_cache:
paths:
- ~/.m2
key: v1-dependencies-{{ checksum "pom.xml" }}
# run tests!
- run: mvn clean
- run: mvn test
workflows:
maven_test:
jobs:
- maven/test
here is the error it gave
Its showing the app is not present at given location but i have checked manually its there
is there a way to solve this?
Unable to create a new remote session. Please check the server log for more details. Original error: An unknown server-side error occurred while processing the command. Original error: Could not find app apk at /home/circleci/project/App/eezy-uat-2.apk (WARNING: The server did not provide any stacktrace information) Command duration or timeout: 38.57 seconds Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:17:03' System info: host: '8908ccb13df1', ip: '192.168.0.3', os.name: 'Linux', os.arch: 'amd64', os.version: '4.15.0-1092-aws', java.version: '1.8.0_265' Driver info: driver.version: AndroidDriver Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:17:03' System info: host: '8908ccb13df1', ip: '192.168.0.3', os.name: 'Linux', os.arch: 'amd64', os.version: '4.15.0-1092-aws', java.version: '1.8.0_265' Driver info: driver.version: AndroidDriver
org.openqa.selenium.SessionNotCreatedException: Unable to create a new remote session. Please check the server log for more details. Original error: An unknown server-side error occurred while processing the command. Original error: Could not find app apk at /home/circleci/project/App/app.apk (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 38.57 seconds
Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:17:03'
System info: host: '8908ccb13df1', ip: '192.168.0.3', os.name: 'Linux', os.arch: 'amd64', os.version: '4.15.0-1092-aws', java.version: '1.8.0_265'
Driver info: driver.version: AndroidDriver
Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:17:03'
System info: host: '8908ccb13df1', ip: '192.168.0.3', os.name: 'Linux', os.arch: 'amd64', os.version: '4.15.0-1092-aws', java.version: '1.8.0_265'
Driver info: driver.version: AndroidDriver
at io.appium.java_client.remote.AppiumCommandExecutor$1.createSession(AppiumCommandExecutor.java:208)
at io.appium.java_client.remote.AppiumCommandExecutor.createSession(AppiumCommandExecutor.java:217)
at io.appium.java_client.remote.AppiumCommandExecutor.execute(AppiumCommandExecutor.java:239)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:552)
at io.appium.java_client.DefaultGenericMobileDriver.execute(DefaultGenericMobileDriver.java:41)
at io.appium.java_client.AppiumDriver.execute(AppiumDriver.java:1)
at io.appium.java_client.android.AndroidDriver.execute(AndroidDriver.java:1)
at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:213)
at io.appium.java_client.AppiumDriver.startSession(AppiumDriver.java:336)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:131)
at io.appium.java_client.DefaultGenericMobileDriver.<init>(DefaultGenericMobileDriver.java:37)
at io.appium.java_client.AppiumDriver.<init>(AppiumDriver.java:88)
at io.appium.java_client.AppiumDriver.<init>(AppiumDriver.java:98)
at io.appium.java_client.android.AndroidDriver.<init>(AndroidDriver.java:94)
at com.eezy.generics.BaseTest.beforeMethod(BaseTest.java:132)
at java.util.ArrayList.forEach(ArrayList.java:1259)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
at io.appium.java_client.remote.AppiumCommandExecutor$1.createSession(AppiumCommandExecutor.java:186)
... 42 more
Caused by: org.openqa.selenium.WebDriverException: An unknown server-side error occurred while processing the command. Original error: Could not find app apk at /home/circleci/project/App/app.apk (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 38.57 seconds
Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:17:03'
System info: host: '8908ccb13df1', ip: '192.168.0.3', os.name: 'Linux', os.arch: 'amd64', os.version: '4.15.0-1092-aws', java.version: '1.8.0_265'
Driver info: driver.version: AndroidDriver
at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:214)
at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:166)
at org.openqa.selenium.remote.JsonWireProtocolResponse.lambda$errorHandler$0(JsonWireProtocolResponse.java:54)
at org.openqa.selenium.remote.HandshakeResponse.lambda$getResponseFunction$0(HandshakeResponse.java:30)
at org.openqa.selenium.remote.ProtocolHandshake.lambda$createSession$0(ProtocolHandshake.java:126)
at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193)
at java.util.Spliterators$ArraySpliterator.tryAdvance(Spliterators.java:958)
at java.util.stream.ReferencePipeline.forEachWithCancel(ReferencePipeline.java:126)
at java.util.stream.AbstractPipeline.copyIntoWithCancel(AbstractPipeline.java:499)
at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:486)
at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:472)
at java.util.stream.FindOps$FindOp.evaluateSequential(FindOps.java:152)
at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
at java.util.stream.ReferencePipeline.findFirst(ReferencePipeline.java:531)
at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:128)
... 47 more
... Removed 33 stack frames

Failure to launch Internet Explorer 11 using selenium 2.47.1

I am getting the following error when I run this code in my automation suite,
Selenium 2.47.1
Internet Explorer 11
OS: Windows 8
WebDriver driver = new InternetExplorerDriver();
Exception Trace:
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.47.1',
revision: 'unknown', time: '2015-07-30 11:02:44' System info: host:
os.name: 'Windows 8', os.arch: 'amd64', os.version: '6.2',
java.version: '1.7.0_51' Driver info: driver.version:
InternetExplorerDriver at
org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:589)
at
org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:242)
at
org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:227)
at
org.openqa.selenium.ie.InternetExplorerDriver.run(InternetExplorerDriver.java:182)
at
org.openqa.selenium.ie.InternetExplorerDriver.(InternetExplorerDriver.java:174)
at
org.openqa.selenium.ie.InternetExplorerDriver.(InternetExplorerDriver.java:146)
Caused by: org.openqa.selenium.WebDriverException: Timed out waiting
for driver server to start. Build info: version: '2.47.1', revision:
'unknown', time: '2015-07-30 11:02:44' System info: host: os.name:
'Windows 8', os.arch: 'amd64', os.version: '6.2', java.version:
'1.7.0_51' Driver info: driver.version: InternetExplorerDriver at
org.openqa.selenium.remote.service.DriverService.start(DriverService.java:170)
at
org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:63)
at
org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:568)
at
org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:242)
at
org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:227)
at
org.openqa.selenium.ie.InternetExplorerDriver.run(InternetExplorerDriver.java:182)
at
org.openqa.selenium.ie.InternetExplorerDriver.(InternetExplorerDriver.java:174)
at
org.openqa.selenium.ie.InternetExplorerDriver.(InternetExplorerDriver.java:146)
Caused by: org.openqa.selenium.net.UrlChecker$TimeoutException: Timed
out waiting for [http://localhost:23905/status] to be available after
20005 ms at
org.openqa.selenium.net.UrlChecker.waitUntilAvailable(UrlChecker.java:104)
at
org.openqa.selenium.remote.service.DriverService.start(DriverService.java:167)
... 50 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:79)
... 51 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)
... 52 more
I solved the problem by configuring the system property for the internet explorer driver,
System.setProperty("webdriver.ie.driver", "IEDriverServer.exe");
And changed the protected mode setting to be same for all the zones.

PhantomJS driver wont start

I'm having issues starting up the PhantomJS driver. It works just fine on my local machine (OSX) but I'm having issues getting it started on the server (Linux).
Here's the code that causes the issue:
DesiredCapabilities dcap = new DesiredCapabilities();
String[] phantomArgs = new String[] { "--webdriver-loglevel=NONE" };
dcap.setCapability(PhantomJSDriverService.PHANTOMJS_CLI_ARGS, phantomArgs);
dcap.setCapability("phantomjs.binary.path", "/usr/local/bin/phantomjs");
WebDriver driver = new PhantomJSDriver(dcap);
And here's the stack trace of the issue:
[ERROR] [09/09/2015 18:32:45.517] [pipeline-akka.actor.default-dispatcher-11] [akka://pipeline/user/$u] Could not start a new session. Possible causes are invalid address of the remote server or browser start-up failure.
Build info: version: 'unknown', revision: 'unknown', time: 'unknown'
System info: host: os.name: 'Linux', os.arch: 'amd64', os.version: '3.14.48-33.39.amzn1.x86_64', java.version: '1.8.0_60'
Driver info: driver.version: PhantomJSDriver
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: 'unknown', revision: 'unknown', time: 'unknown'
System info: host: os.name: 'Linux', os.arch: 'amd64', os.version: '3.14.48-33.39.amzn1.x86_64', java.version: '1.8.0_60'
Driver info: driver.version: PhantomJSDriver
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:589)
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.phantomjs.PhantomJSDriver.<init>(PhantomJSDriver.java:110)
at org.openqa.selenium.phantomjs.PhantomJSDriver.<init>(PhantomJSDriver.java:99)
at com.example.p.Test.ingest(GoogleGetLinksPipe.java:48)
at com.example.p.Test.ingest(GoogleGetLinksPipe.java:22)
at com.example.p.AbstractPipe.onReceive(AbstractPipe.java:39)
at akka.actor.UntypedActor$$anonfun$receive$1.applyOrElse(UntypedActor.scala:167)
at akka.actor.Actor$class.aroundReceive(Actor.scala:467)
at akka.actor.UntypedActor.aroundReceive(UntypedActor.scala:97)
at akka.actor.ActorCell.receiveMessage(ActorCell.scala:516)
at akka.actor.ActorCell.invoke(ActorCell.scala:487)
at akka.dispatch.Mailbox.processMailbox(Mailbox.scala:238)
at akka.dispatch.Mailbox.run(Mailbox.scala:220)
at akka.dispatch.ForkJoinExecutorConfigurator$AkkaForkJoinTask.exec(AbstractDispatcher.scala:397)
at scala.concurrent.forkjoin.ForkJoinTask.doExec(ForkJoinTask.java:260)
at scala.concurrent.forkjoin.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1339)
at scala.concurrent.forkjoin.ForkJoinPool.runWorker(ForkJoinPool.java:1979)
at scala.concurrent.forkjoin.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:107)
Caused by: org.openqa.selenium.WebDriverException: Timed out waiting for driver server to start.
Build info: version: 'unknown', revision: 'unknown', time: 'unknown'
System info: host: os.name: 'Linux', os.arch: 'amd64', os.version: '3.14.48-33.39.amzn1.x86_64', java.version: '1.8.0_60'
Driver info: driver.version: PhantomJSDriver
at org.openqa.selenium.remote.service.DriverService.start(DriverService.java:165)
at org.openqa.selenium.phantomjs.PhantomJSCommandExecutor.execute(PhantomJSCommandExecutor.java:78)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:568)
... 20 more
Caused by: org.openqa.selenium.net.UrlChecker$TimeoutException: Timed out waiting for [http://localhost:8092/status] to be available after 20000 ms
at org.openqa.selenium.net.UrlChecker.waitUntilAvailable(UrlChecker.java:104)
at org.openqa.selenium.remote.service.DriverService.start(DriverService.java:163)
... 22 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:79)
... 23 more
Caused by: java.util.concurrent.TimeoutException
at java.util.concurrent.FutureTask.get(Unknown Source)
at com.google.common.util.concurrent.SimpleTimeLimiter.callWithTimeout(SimpleTimeLimiter.java:130)
... 24 more
I built the PhantomJS from source and had it working before - it ran through the tests just fine. Additionally, it works locally on my machine. Any thoughts on what could be causing the issue?
The problem was due to the phantomjs's inability to write to the log file. Changing the file permissions of the log file resolved the issue.

Maximum call stack size exceeded, after using: ((JavascriptExecutor)seleniumdriver). executeScript("return arguments[0].attributes);", webElement);

As you can see here I am using
((JavascriptExecutor)seleniumdriver).
executeScript("return arguments[0].attributes);", webElement);
to get all attributes from webElement, but it gives me this error:
Exception in thread "main" org.openqa.selenium.WebDriverException: unknown error: Maximum call stack size exceeded
(Session info: chrome=43.0.2357.134)
(Driver info: chromedriver=2.17.340124 (8cdfc496335a58cfb8bdd672c7dce0c23456384b),platform=Windows NT 6.1 SP1 x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 4.25 seconds
Build info: version: '2.47.1', revision: '411b314', time: '2015-07-30 02:56:46'
System info: host: 'sina-PC', ip: '10.55.0.131', os.name: 'Windows 7', os.arch: 'x86', os.version: '6.1', java.version: '1.8.0_60'
Driver info: org.openqa.selenium.chrome.ChromeDriver
Looks like it was missing a '('.
((JavascriptExecutor)seleniumdriver)
.executeScript("return (arguments[0].attributes);", webElement);

Categories