I am fairly new with jenkins and sonar scanner. I have created a simple hello world gradle project in Intellij. After that was done, i added the Jenkinsfile to the root folder of the project and started working on it. When i try to build it in jenkins, i get an error message looking like this:
05:57:51.485 INFO: Scanner configuration file: /usr/lib/sonar-scanner/conf/sonar-scanner.properties
05:57:51.491 INFO: Project root configuration file: /root/src/sonar-project.properties
05:57:51.506 INFO: SonarQube Scanner 3.3.0.1492
05:57:51.506 INFO: Java 1.8.0_121 Oracle Corporation (64-bit)
05:57:51.506 INFO: Linux 3.10.0-957.5.1.el7.x86_64 amd64
05:57:51.702 DEBUG: keyStore is :
05:57:51.702 DEBUG: keyStore type is : jks
05:57:51.702 DEBUG: keyStore provider is :
05:57:51.702 DEBUG: init keystore
05:57:51.703 DEBUG: init keymanager of type SunX509
05:57:51.877 DEBUG: Create: /root/.sonar/cache
05:57:51.879 INFO: User cache: /root/.sonar/cache
05:57:51.879 DEBUG: Create: /root/.sonar/cache/_tmp
05:57:51.881 DEBUG: Extract sonar-scanner-api-batch in temp...
05:57:51.889 DEBUG: Get bootstrap index...
05:57:51.889 DEBUG: Download: http://10.221.4.33:9000/batch/index
05:57:51.968 DEBUG: Get bootstrap completed
05:57:51.986 DEBUG: Download http://10.221.4.33:9000/batch/file?name=sonar-scanner-engine-shaded-7.7-all.jar to /root/.sonar/cache/_tmp/fileCache3570509839777067796.tmp
05:57:52.323 DEBUG: Create isolated classloader...
05:57:52.333 DEBUG: Start temp cleaning...
05:57:52.338 DEBUG: Temp cleaning done
05:57:52.338 DEBUG: Execution getVersion
05:57:52.345 INFO: SonarQube server 7.7.0
05:57:52.346 DEBUG: Execution execute
05:57:52.801 INFO: Load global settings
05:57:52.879 DEBUG: GET 200 http://10.221.4.33:9000/api/settings/values.protobuf | time=58ms
05:57:52.936 INFO: Load global settings (done) | time=138ms
05:57:52.944 INFO: Server id: C9A263D1-AWnZoCq1phaxFFDSMo0l
05:57:52.966 DEBUG: Create : /root/.sonar/_tmp
05:57:52.967 INFO: User cache: /root/.sonar/cache
05:57:52.971 INFO: Load/download plugins
05:57:52.972 INFO: Load plugins index
05:57:52.981 DEBUG: GET 200 http://10.221.4.33:9000/api/plugins/installed | time=9ms
05:57:53.025 INFO: Load plugins index (done) | time=52ms
05:57:53.027 DEBUG: Download plugin 'scmgit' to '/root/.sonar/_tmp/fileCache4395394311979981807.tmp'
05:57:53.034 DEBUG: GET 200 http://10.221.4.33:9000/api/plugins/download?plugin=scmgit&acceptCompressions=pack200 | time=7ms
05:57:53.112 DEBUG: Download plugin 'jacoco' to '/root/.sonar/_tmp/fileCache6933684684880586527.tmp'
05:57:53.118 DEBUG: GET 200 http://10.221.4.33:9000/api/plugins/download?plugin=jacoco&acceptCompressions=pack200 | time=6ms
05:57:53.119 DEBUG: Download plugin 'ldap' to '/root/.sonar/_tmp/fileCache7133022802065402857.tmp'
05:57:53.128 DEBUG: GET 200 http://10.221.4.33:9000/api/plugins/download?plugin=ldap&acceptCompressions=pack200 | time=8ms
05:57:53.136 DEBUG: Download plugin 'csharp' to '/root/.sonar/_tmp/fileCache9082420825692938062.tmp'
05:57:53.150 DEBUG: GET 200 http://10.221.4.33:9000/api/plugins/download?plugin=csharp&acceptCompressions=pack200 | time=13ms
05:57:53.241 DEBUG: Download plugin 'cssfamily' to '/root/.sonar/_tmp/fileCache293189218006487968.tmp'
05:57:53.246 DEBUG: GET 200 http://10.221.4.33:9000/api/plugins/download?plugin=cssfamily&acceptCompressions=pack200 | time=5ms
05:57:53.301 DEBUG: Download plugin 'clojure' to '/root/.sonar/_tmp/fileCache948669080401350606.tmp'
05:57:53.307 DEBUG: GET 200 http://10.221.4.33:9000/api/plugins/download?plugin=clojure&acceptCompressions=pack200 | time=6ms
05:57:53.379 DEBUG: Download plugin 'flex' to '/root/.sonar/_tmp/fileCache3889788857842376851.tmp'
05:57:53.386 DEBUG: GET 200 http://10.221.4.33:9000/api/plugins/download?plugin=flex&acceptCompressions=pack200 | time=7ms
05:57:53.401 DEBUG: Download plugin 'go' to '/root/.sonar/_tmp/fileCache4205858474210720715.tmp'
05:57:53.408 DEBUG: GET 200 http://10.221.4.33:9000/api/plugins/download?plugin=go&acceptCompressions=pack200 | time=7ms
05:57:53.462 DEBUG: Download plugin 'web' to '/root/.sonar/_tmp/fileCache783608628579300027.tmp'
05:57:53.470 DEBUG: GET 200 http://10.221.4.33:9000/api/plugins/download?plugin=web&acceptCompressions=pack200 | time=8ms
05:57:53.502 DEBUG: Download plugin 'javascript' to '/root/.sonar/_tmp/fileCache895874836559468181.tmp'
05:57:53.523 DEBUG: GET 200 http://10.221.4.33:9000/api/plugins/download?plugin=javascript&acceptCompressions=pack200 | time=20ms
05:57:53.641 DEBUG: Download plugin 'java' to '/root/.sonar/_tmp/fileCache2653809152725468294.tmp'
05:57:53.649 DEBUG: GET 200 http://10.221.4.33:9000/api/plugins/download?plugin=java&acceptCompressions=pack200 | time=8ms
05:57:53.724 DEBUG: Download plugin 'kotlin' to '/root/.sonar/_tmp/fileCache4849792320171587582.tmp'
05:57:53.731 DEBUG: GET 200 http://10.221.4.33:9000/api/plugins/download?plugin=kotlin&acceptCompressions=pack200 | time=7ms
05:57:53.819 DEBUG: Download plugin 'php' to '/root/.sonar/_tmp/fileCache6204606293784138971.tmp'
05:57:53.826 DEBUG: GET 200 http://10.221.4.33:9000/api/plugins/download?plugin=php&acceptCompressions=pack200 | time=7ms
05:57:53.877 DEBUG: Download plugin 'python' to '/root/.sonar/_tmp/fileCache288964667021647401.tmp'
05:57:53.885 DEBUG: GET 200 http://10.221.4.33:9000/api/plugins/download?plugin=python&acceptCompressions=pack200 | time=7ms
05:57:53.910 DEBUG: Download plugin 'ruby' to '/root/.sonar/_tmp/fileCache5281102871587928818.tmp'
05:57:53.915 DEBUG: GET 200 http://10.221.4.33:9000/api/plugins/download?plugin=ruby&acceptCompressions=pack200 | time=4ms
05:57:53.993 DEBUG: Download plugin 'sonarscala' to '/root/.sonar/_tmp/fileCache1960676723457785292.tmp'
05:57:53.998 DEBUG: GET 200 http://10.221.4.33:9000/api/plugins/download?plugin=sonarscala&acceptCompressions=pack200 | time=5ms
05:57:54.070 DEBUG: Download plugin 'typescript' to '/root/.sonar/_tmp/fileCache7183740303261272847.tmp'
05:57:54.076 DEBUG: GET 200 http://10.221.4.33:9000/api/plugins/download?plugin=typescript&acceptCompressions=pack200 | time=6ms
05:57:54.095 DEBUG: Download plugin 'vbnet' to '/root/.sonar/_tmp/fileCache7315453031927695364.tmp'
05:57:54.100 DEBUG: GET 200 http://10.221.4.33:9000/api/plugins/download?plugin=vbnet&acceptCompressions=pack200 | time=5ms
05:57:54.170 DEBUG: Download plugin 'xml' to '/root/.sonar/_tmp/fileCache226747213883935028.tmp'
05:57:54.177 DEBUG: GET 200 http://10.221.4.33:9000/api/plugins/download?plugin=xml&acceptCompressions=pack200 | time=6ms
05:57:54.198 DEBUG: Download plugin 'scmsvn' to '/root/.sonar/_tmp/fileCache1337467676129254645.tmp'
05:57:54.203 DEBUG: GET 200 http://10.221.4.33:9000/api/plugins/download?plugin=scmsvn&acceptCompressions=pack200 | time=5ms
05:57:54.257 INFO: Load/download plugins (done) | time=1286ms
05:57:54.464 DEBUG: Plugins:
05:57:54.464 DEBUG: * SonarPython 1.13.0.2922 (python)
05:57:54.464 DEBUG: * SonarCSS 1.0.3.724 (cssfamily)
05:57:54.464 DEBUG: * SonarClojure 1.8.1 (clojure)
05:57:54.464 DEBUG: * JaCoCo 1.0.1.143 (jacoco)
05:57:54.464 DEBUG: * SonarGo 1.1.0.1612 (go)
05:57:54.464 DEBUG: * SonarKotlin 1.5.0.315 (kotlin)
05:57:54.464 DEBUG: * Svn 1.9.0.1295 (scmsvn)
05:57:54.464 DEBUG: * SonarJS 5.1.1.7506 (javascript)
05:57:54.464 DEBUG: * SonarRuby 1.5.0.315 (ruby)
05:57:54.465 DEBUG: * SonarScala 1.5.0.315 (sonarscala)
05:57:54.465 DEBUG: * SonarC# 7.14.0.8411 (csharp)
05:57:54.465 DEBUG: * SonarJava 5.12.1.17771 (java)
05:57:54.465 DEBUG: * LDAP 2.2.0.608 (ldap)
05:57:54.465 DEBUG: * SonarHTML 3.1.0.1615 (web)
05:57:54.465 DEBUG: * Git 1.8.0.1574 (scmgit)
05:57:54.465 DEBUG: * SonarFlex 2.4.0.1222 (flex)
05:57:54.465 DEBUG: * SonarXML 2.0.1.2020 (xml)
05:57:54.465 DEBUG: * SonarPHP 3.0.0.4537 (php)
05:57:54.465 DEBUG: * SonarTS 1.9.0.3766 (typescript)
05:57:54.465 DEBUG: * SonarVB 7.14.0.8411 (vbnet)
05:57:54.493 INFO: ------------------------------------------------------------------------
05:57:54.493 INFO: EXECUTION FAILURE
05:57:54.493 INFO: ------------------------------------------------------------------------
05:57:54.493 INFO: Total time: 3.042s
05:57:54.591 INFO: Final Memory: 9M/597M
05:57:54.591 INFO: ------------------------------------------------------------------------
05:57:54.591 ERROR: Error during SonarQube Scanner execution
05:57:54.591 ERROR: Tasks support was removed in SonarQube 7.6.
I have tried searching for the error (Tasks support was removed in Sonarqube 7.6) which really havent helped me at all so far. I've tried seperate ways of constructing the Jenkinsfile but seems to be no luck at all.
This is my jenkinsfile:
pipeline {
agent any
stages {
stage('List folder') {
steps {
sh 'ls'
}
}
stage('Make folder for docker') {
steps {
sh 'docker run -v $(pwd):/root/src newtmitch/sonar-scanner sonar-scanner -X \
-Dsonar.host.url=http://XXXX:9000 \
-Dsonar.jdbc.url=jdbc:h2:tcp://sonarqube/sonar \
-Dsonar.projectKey=MyProjectKey \
-Dsonar.projectName="My Project Name" \
-Dsonar.projectVersion=1 \
-Dsonar.projectBaseDir=/root/src \
-Dsonar.sources=/root/src'
}
}
}
}
It seems to be able to get the right docker image from sonar scanner, but why is it failing afterwards?
The steps should be somewhat simple:
1. Get image.
2. Build Gradle project
3. Scan project code
4. Profit.
In case anyone runs into this, i solved it by removing "sonar-scanner -X" from the docker run command.
unsure why it changed anything but now it can analyze the project code correctly.
thanks
I have configured ZAP 2.7.0 plugin with Jenkins latest version. After configuring the ZAP in Jenkins, when I try to do a spider scan, it's showing the scan status as 0%.
I don't know how to solve this issue.
This is my config:
Workspace /var/lib/jenkins/workspace/ZAP
Override Host localhost
Override Port 8090
JDK : inherit from job
System Installed ZAP installation directory
Command line arguments: -installdir value: /opt/zaproxy
ZAP home directory: /opt/zaproxy
Load session: /var/lib/jenkins/WS/ZAP/reports.session
ContextName: VolunarabityTest${BUILD_ID}
Include contest: http://myip:8080/ps
Attack mode: starting point: http://myip:8080/ps
And this is the output:
7083 [ZAP-SpiderInitThread-0] INFO org.zaproxy.zap.extension.spider.SpiderThread - Starting spidering scan on Context: VolunarabityTest39 at Thu Dec 21 23:22:59 IST 2017
7089 [ZAP-SpiderInitThread-0] INFO org.zaproxy.zap.spider.Spider - Spider initializing...
[ZAP Jenkins Plugin] SPIDER SCAN STATUS [ 0% ]
[ZAP Jenkins Plugin] ALERTS COUNT [ 0 ]
7142 [ZAP-SpiderInitThread-0] INFO org.zaproxy.zap.spider.Spider - Starting spider...
7220 [ZAP-SpiderThreadPool-0-thread-1] INFO org.zaproxy.zap.spider.Spider - Spidering process is complete. Shutting down...
7222 [ZAP-SpiderShutdownThread-0] INFO org.zaproxy.zap.extension.spider.SpiderThread - Spider scanning complete:
I'm trying to run automated tests of a web app on iOS using Appium (via SauceLabs) and am getting a problem with a relatively simple test case detailed below.
I get the following error in the Appium Log:
info: [INSTSERVER] Got result from instruments: {"status":17,"value":"start point is not within the bounds of the screen"}
2014-05-29T17:21:01.282Z - info: Responding to client with error: {"status":17,"value":{"message":"An error occurred while executing user supplied JavaScript.","origValue":"start point is not within the bounds of the screen"},"sessionId":"47322525-37e0-4f4b-a236-224906d0135c"}
Looking at the screenshots, the element in question does appear to be on the screen.
I've tried scrolling to the element before attempting to click it using:
((IJavaScriptExecutor)driver).ExecuteScript("arguments[0].scrollIntoView();", driver.FindElement(By.Id(elementId)));
and scrolling to it via javascript doesn't appear to make any difference. It seems to be that some set of coordinates is getting messed up, but I don't know enough about how Appium works to figure it out.
The test
I have created a jsFiddle HERE (view-only here) which the tests point at.
It has a set of fields laid out down the page.
I'm setting up the web driver with capabilities like this:
DesiredCapabilities caps = DesiredCapabilities.IPad();
caps.SetCapability(CapabilityType.Platform, "OS X 10.9");
caps.SetCapability(CapabilityType.Version, "7");
caps.SetCapability("device-orientation", "portrait");
caps.SetCapability("nonSyntheticWebClick", "false");
The WebDriver test itself (written in C#) looks like:
[Test]
public void TestSequence()
{
string sequence = "button4,button3,button2";
var fieldIds = sequence.Split(',');
foreach (var fieldId in fieldIds)
{
Console.Write("{0},", fieldId);
if (fieldId[0] == 't')
{
driver.FindElement(By.Id(fieldId)).SendKeys("1");
}
else
{
driver.FindElement(By.Id(fieldId)).Click();
}
}
}
You can see that it takes a 'sequence' of fields to be clicked. Just a way of trying out different combinations.
To illustrate the issue, the following combinations fail:
text1,button1,text4,button3
text4,button3
button4,text3,button2
button4,button3,button2
whereas these are fine:
button1,button4,button1,button4,button1
button1,button2,button3,button4
Any help gratefully appreciated.
(The log)
The (hopefully) relevant part of the Appium Log is here:
2014-05-29T17:48:32.074Z - debug: Appium request initiated at /wd/hub/session/fc441e9f-8ade-4799-8f87-1653a50a5a49/element
2014-05-29T17:48:32.074Z - debug: Request received with params: {"using":"id","value":"button4"}
2014-05-29T17:48:32.075Z - info: [REMOTE] Executing 'find_element' atom in default context
2014-05-29T17:48:32.076Z - info: [REMOTE] Sending javascript command
2014-05-29T17:48:32.076Z - debug: [REMOTE] Sending _rpc_forwardSocketData: message to remote debugger
2014-05-29T17:48:32.084Z - debug: [REMOTE] Receiving data from remote debugger
2014-05-29T17:48:32.084Z - debug: [REMOTE] got applicationSentData response
2014-05-29T17:48:32.085Z - info: Responding to client with success: {"status":0,"value":{"ELEMENT":"5000"},"sessionId":"fc441e9f-8ade-4799-8f87-1653a50a5a49"}
POST /wd/hub/session/fc441e9f-8ade-4799-8f87-1653a50a5a49/element 200 11ms - 112b
2014-05-29T17:48:32.687Z - debug: Appium request initiated at /wd/hub/session/fc441e9f-8ade-4799-8f87-1653a50a5a49/element/5000/click
2014-05-29T17:48:32.687Z - debug: Request received with params: {}
2014-05-29T17:48:32.688Z - info: [REMOTE] Executing 'get_top_left_coordinates' atom in default context
2014-05-29T17:48:32.688Z - info: [REMOTE] Sending javascript command
2014-05-29T17:48:32.689Z - debug: [REMOTE] Sending _rpc_forwardSocketData: message to remote debugger
2014-05-29T17:48:32.712Z - debug: [REMOTE] Receiving data from remote debugger
2014-05-29T17:48:32.712Z - debug: [REMOTE] got applicationSentData response
2014-05-29T17:48:32.712Z - info: [REMOTE] Executing 'get_size' atom in default context
2014-05-29T17:48:32.713Z - info: [REMOTE] Sending javascript command
2014-05-29T17:48:32.713Z - debug: [REMOTE] Sending _rpc_forwardSocketData: message to remote debugger
2014-05-29T17:48:32.731Z - debug: [REMOTE] Receiving data from remote debugger
2014-05-29T17:48:32.731Z - debug: [REMOTE] got applicationSentData response
2014-05-29T17:48:32.732Z - info: Pushing command to appium work queue: "au.getElementsByType('webview')"
2014-05-29T17:48:32.732Z - debug: Sending command to instruments: au.getElementsByType('webview')
info: [INSTSERVER] Sending command to instruments: au.getElementsByType('webview')
info: [INSTSERVER] Socket data received (63 bytes)
info: [INSTSERVER] Socket data being routed for 'cmd' event
info: [INSTSERVER] Got result from instruments: {"status":0,"value":[{"ELEMENT":"1"}]}
2014-05-29T17:48:32.879Z - info: Pushing command to appium work queue: "au.getElement('1').rect()"
2014-05-29T17:48:32.879Z - info: [REMOTE] Sending javascript command
2014-05-29T17:48:32.879Z - debug: [REMOTE] Sending _rpc_forwardSocketData: message to remote debugger
2014-05-29T17:48:32.879Z - debug: Sending command to instruments: au.getElement('1').rect()
info: [INSTSERVER] Sending command to instruments: au.getElement('1').rect()
2014-05-29T17:48:32.880Z - debug: [REMOTE] Receiving data from remote debugger
2014-05-29T17:48:32.880Z - debug: [REMOTE] Receiving data from remote debugger
2014-05-29T17:48:32.881Z - debug: [REMOTE] got applicationSentData response
info: [INSTSERVER] Socket data received (108 bytes)
info: [INSTSERVER] Socket data being routed for 'cmd' event
info: [INSTSERVER] Got result from instruments: {"status":0,"value":{"origin":{"x":0,"y":-423},"size":{"width":768,"height":1467}}}
2014-05-29T17:48:32.987Z - info: Converted web coords {"x":351,"y":734}into real coords {"x":275.069387755102,"y":132.2019230769231}
2014-05-29T17:48:32.987Z - info: Pushing command to appium work queue: "au.complexTap({\"x\":275.069387755102,\"y\":132.2019230769231,\"tapCount\":1,\"duration\":0.3,\"touchCount\":1})"
2014-05-29T17:48:32.987Z - debug: Sending command to instruments: au.complexTap({"x":275.069387755102,"y":132.2019230769231,"tapCount":1,"duration":0.3,"touchCount":1})
info: [INSTSERVER] Sending command to instruments: au.complexTap({"x":275.069387755102,"y":132.2019230769231,"tapCount":1,"duration":0.3,"touchCount":1})
info: [INSTSERVER] Socket data received (48 bytes)
info: [INSTSERVER] Socket data being routed for 'cmd' event
info: [INSTSERVER] Got result from instruments: {"status":0,"value":""}
2014-05-29T17:48:34.002Z - info: Responding to client with success: {"status":0,"value":"","sessionId":"fc441e9f-8ade-4799-8f87-1653a50a5a49"}
POST /wd/hub/session/fc441e9f-8ade-4799-8f87-1653a50a5a49/element/5000/click 200 1317ms - 87b
2014-05-29T17:48:34.737Z - debug: Appium request initiated at /wd/hub/session/fc441e9f-8ade-4799-8f87-1653a50a5a49/element
2014-05-29T17:48:34.737Z - debug: Request received with params: {"using":"id","value":"button3"}
2014-05-29T17:48:34.738Z - info: [REMOTE] Executing 'find_element' atom in default context
2014-05-29T17:48:34.738Z - info: [REMOTE] Sending javascript command
2014-05-29T17:48:34.738Z - debug: [REMOTE] Sending _rpc_forwardSocketData: message to remote debugger
2014-05-29T17:48:34.748Z - debug: [REMOTE] Receiving data from remote debugger
2014-05-29T17:48:34.749Z - debug: [REMOTE] got applicationSentData response
2014-05-29T17:48:34.749Z - info: Responding to client with success: {"status":0,"value":{"ELEMENT":"5001"},"sessionId":"fc441e9f-8ade-4799-8f87-1653a50a5a49"}
POST /wd/hub/session/fc441e9f-8ade-4799-8f87-1653a50a5a49/element 200 14ms - 112b
2014-05-29T17:48:35.352Z - debug: Appium request initiated at /wd/hub/session/fc441e9f-8ade-4799-8f87-1653a50a5a49/element/5001/click
2014-05-29T17:48:35.352Z - debug: Request received with params: {}
2014-05-29T17:48:35.352Z - info: [REMOTE] Executing 'get_top_left_coordinates' atom in default context
2014-05-29T17:48:35.353Z - info: [REMOTE] Sending javascript command
2014-05-29T17:48:35.353Z - debug: [REMOTE] Sending _rpc_forwardSocketData: message to remote debugger
2014-05-29T17:48:35.364Z - debug: [REMOTE] Receiving data from remote debugger
2014-05-29T17:48:35.364Z - debug: [REMOTE] got applicationSentData response
2014-05-29T17:48:35.365Z - info: [REMOTE] Executing 'get_size' atom in default context
2014-05-29T17:48:35.365Z - info: [REMOTE] Sending javascript command
2014-05-29T17:48:35.365Z - debug: [REMOTE] Sending _rpc_forwardSocketData: message to remote debugger
2014-05-29T17:48:35.377Z - debug: [REMOTE] Receiving data from remote debugger
2014-05-29T17:48:35.378Z - debug: [REMOTE] got applicationSentData response
2014-05-29T17:48:35.378Z - info: Pushing command to appium work queue: "au.getElementsByType('webview')"
2014-05-29T17:48:35.378Z - debug: Sending command to instruments: au.getElementsByType('webview')
info: [INSTSERVER] Sending command to instruments: au.getElementsByType('webview')
info: [INSTSERVER] Socket data received (63 bytes)
info: [INSTSERVER] Socket data being routed for 'cmd' event
info: [INSTSERVER] Got result from instruments: {"status":0,"value":[{"ELEMENT":"2"}]}
2014-05-29T17:48:35.544Z - info: Pushing command to appium work queue: "au.getElement('2').rect()"
2014-05-29T17:48:35.544Z - info: [REMOTE] Sending javascript command
2014-05-29T17:48:35.545Z - debug: [REMOTE] Sending _rpc_forwardSocketData: message to remote debugger
2014-05-29T17:48:35.545Z - debug: Sending command to instruments: au.getElement('2').rect()
info: [INSTSERVER] Sending command to instruments: au.getElement('2').rect()
2014-05-29T17:48:35.547Z - debug: [REMOTE] Receiving data from remote debugger
2014-05-29T17:48:35.547Z - debug: [REMOTE] got applicationSentData response
info: [INSTSERVER] Socket data received (110 bytes)
info: [INSTSERVER] Socket data being routed for 'cmd' event
info: [INSTSERVER] Got result from instruments: {"status":0,"value":{"origin":{"x":0,"y":-137.5},"size":{"width":768,"height":1467}}}
2014-05-29T17:48:35.651Z - info: Converted web coords {"x":351,"y":629}into real coords {"x":275.069387755102,"y":335.4182692307692}
2014-05-29T17:48:35.651Z - info: Pushing command to appium work queue: "au.complexTap({\"x\":275.069387755102,\"y\":335.4182692307692,\"tapCount\":1,\"duration\":0.3,\"touchCount\":1})"
2014-05-29T17:48:35.651Z - debug: Sending command to instruments: au.complexTap({"x":275.069387755102,"y":335.4182692307692,"tapCount":1,"duration":0.3,"touchCount":1})
info: [INSTSERVER] Sending command to instruments: au.complexTap({"x":275.069387755102,"y":335.4182692307692,"tapCount":1,"duration":0.3,"touchCount":1})
info: [INSTSERVER] Socket data received (48 bytes)
info: [INSTSERVER] Socket data being routed for 'cmd' event
info: [INSTSERVER] Got result from instruments: {"status":0,"value":""}
2014-05-29T17:48:36.634Z - info: Responding to client with success: {"status":0,"value":"","sessionId":"fc441e9f-8ade-4799-8f87-1653a50a5a49"}
POST /wd/hub/session/fc441e9f-8ade-4799-8f87-1653a50a5a49/element/5001/click 200 1282ms - 87b
2014-05-29T17:48:37.337Z - debug: Appium request initiated at /wd/hub/session/fc441e9f-8ade-4799-8f87-1653a50a5a49/element
2014-05-29T17:48:37.337Z - debug: Request received with params: {"using":"id","value":"button2"}
2014-05-29T17:48:37.337Z - info: [REMOTE] Executing 'find_element' atom in default context
2014-05-29T17:48:37.337Z - info: [REMOTE] Sending javascript command
2014-05-29T17:48:37.337Z - debug: [REMOTE] Sending _rpc_forwardSocketData: message to remote debugger
2014-05-29T17:48:37.355Z - debug: [REMOTE] Receiving data from remote debugger
2014-05-29T17:48:37.355Z - debug: [REMOTE] Receiving data from remote debugger
2014-05-29T17:48:37.355Z - debug: [REMOTE] got applicationSentData response
2014-05-29T17:48:37.356Z - info: Responding to client with success: {"status":0,"value":{"ELEMENT":"5002"},"sessionId":"fc441e9f-8ade-4799-8f87-1653a50a5a49"}
POST /wd/hub/session/fc441e9f-8ade-4799-8f87-1653a50a5a49/element 200 20ms - 112b
2014-05-29T17:48:37.952Z - debug: Appium request initiated at /wd/hub/session/fc441e9f-8ade-4799-8f87-1653a50a5a49/element/5002/click
2014-05-29T17:48:37.952Z - debug: Request received with params: {}
2014-05-29T17:48:37.952Z - info: [REMOTE] Executing 'get_top_left_coordinates' atom in default context
2014-05-29T17:48:37.952Z - info: [REMOTE] Sending javascript command
2014-05-29T17:48:37.953Z - debug: [REMOTE] Sending _rpc_forwardSocketData: message to remote debugger
2014-05-29T17:48:37.965Z - debug: [REMOTE] Receiving data from remote debugger
2014-05-29T17:48:37.965Z - debug: [REMOTE] got applicationSentData response
2014-05-29T17:48:37.966Z - info: [REMOTE] Executing 'get_size' atom in default context
2014-05-29T17:48:37.966Z - info: [REMOTE] Sending javascript command
2014-05-29T17:48:37.967Z - debug: [REMOTE] Sending _rpc_forwardSocketData: message to remote debugger
2014-05-29T17:48:37.977Z - debug: [REMOTE] Receiving data from remote debugger
2014-05-29T17:48:37.977Z - debug: [REMOTE] got applicationSentData response
2014-05-29T17:48:37.977Z - info: Pushing command to appium work queue: "au.getElementsByType('webview')"
2014-05-29T17:48:37.977Z - debug: Sending command to instruments: au.getElementsByType('webview')
info: [INSTSERVER] Sending command to instruments: au.getElementsByType('webview')
info: [INSTSERVER] Socket data received (63 bytes)
info: [INSTSERVER] Socket data being routed for 'cmd' event
info: [INSTSERVER] Got result from instruments: {"status":0,"value":[{"ELEMENT":"3"}]}
2014-05-29T17:48:38.132Z - info: Pushing command to appium work queue: "au.getElement('3').rect()"
2014-05-29T17:48:38.132Z - info: [REMOTE] Sending javascript command
2014-05-29T17:48:38.132Z - debug: [REMOTE] Sending _rpc_forwardSocketData: message to remote debugger
2014-05-29T17:48:38.133Z - debug: Sending command to instruments: au.getElement('3').rect()
info: [INSTSERVER] Sending command to instruments: au.getElement('3').rect()
2014-05-29T17:48:38.133Z - debug: [REMOTE] Receiving data from remote debugger
2014-05-29T17:48:38.134Z - debug: [REMOTE] Receiving data from remote debugger
2014-05-29T17:48:38.134Z - debug: [REMOTE] got applicationSentData response
info: [INSTSERVER] Socket data received (110 bytes)
info: [INSTSERVER] Socket data being routed for 'cmd' event
info: [INSTSERVER] Got result from instruments: {"status":0,"value":{"origin":{"x":0,"y":-137.5},"size":{"width":768,"height":1467}}}
2014-05-29T17:48:38.243Z - info: Converted web coords {"x":351,"y":161}into real coords {"x":275.069387755102,"y":-31.331730769230774}
2014-05-29T17:48:38.243Z - info: Pushing command to appium work queue: "au.complexTap({\"x\":275.069387755102,\"y\":-31.331730769230774,\"tapCount\":1,\"duration\":0.3,\"touchCount\":1})"
2014-05-29T17:48:38.243Z - debug: Sending command to instruments: au.complexTap({"x":275.069387755102,"y":-31.331730769230774,"tapCount":1,"duration":0.3,"touchCount":1})
info: [INSTSERVER] Sending command to instruments: au.complexTap({"x":275.069387755102,"y":-31.331730769230774,"tapCount":1,"duration":0.3,"touchCount":1})
info: [INSTSERVER] Socket data received (99 bytes)
info: [INSTSERVER] Socket data being routed for 'cmd' event
info: [INSTSERVER] Got result from instruments: {"status":17,"value":"start point is not within the bounds of the screen"}
2014-05-29T17:48:38.902Z - info: Responding to client with error: {"status":17,"value":{"message":"An error occurred while executing user supplied JavaScript.","origValue":"start point is not within the bounds of the screen"},"sessionId":"fc441e9f-8ade-4799-8f87-1653a50a5a49"}
I can't recreate your error, try updating to Appium v1.1 or 1.2. Sauce Labs defaults to v0.18 right now.
You can change the appium version on Sauce Labs by adding the following capability:
appium-version: '1.1'
Also, I used value instead of keys to type into the input field. Not sure what that translates to in C#
I used javascript, but here's a working gist
I tried to run test cases in hybrid app.
I can switch to WebView with using driver.context("WEBVIEW").
But after I switch to webview, driver.findElement() method to do not perform under webview, and it returns the error in the Appium server as below. Could you help me how to solve this?
Below are my test scripts:
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability(CapabilityType.BROWSER_NAME, "");
capabilities.setCapability("deviceName","066e28s70b115a3b");
capabilities.setCapability("platformVersion", "4.4.2");
capabilities.setCapability("platformName","Android");
capabilities.setCapability("app", "/Users/lin/codes/tester.apk");
capabilities.setCapability("app-package", "com.test.tester");
capabilities.setCapability("app-activity", "com.test.tester.myActivity");
AppiumDriver driver = new AppiumDriver(new URL("http://my.local.address:4723/wd/hub"), capabilities);
Set<String> contextNames = driver.getContextHandles();
System.out.println(contextNames.size());
for (String contextName : contextNames) {
System.out.println(contextName);
if (contextName.contains("WEBVIEW")){
driver.context(contextName);
}
}
Thread.sleep(5000);
driver.findElement(By.xpath("//div[#class='item item-entrance']/h2[#class='grey-title mb20']")).click();
The following code doesn't not work:
driver.findElement(By.xpath("//div[#class='item item-entrance']/h2[#class='grey-title mb20']")).click();
And here is the error message from Appium server log:
info: Available contexts: NATIVE_APP,WEBVIEW_1
info: Responding to client with success: {"status":0,"value":["NATIVE_APP","WEBVIEW_1"],"sessionId":"7dd9ea41-f47c-4466-a108-21ce90284ad1"}
GET /wd/hub/session/7dd9ea41-f47c-4466-a108-21ce90284ad1/contexts 200 50ms - 124b
debug: Appium request initiated at /wd/hub/session/7dd9ea41-f47c-4466-a108-21ce90284ad1/context
debug: Request received with params: {"name":"WEBVIEW_1"}
info: Getting a list of available webviews
debug: executing: "/Users/lin/tools/android-sdk-macosx/platform-tools/adb" -s 066e28s70b115a3b shell "cat /proc/net/unix"
info: ["webview_devtools_remote_20051"]
info: Available contexts: NATIVE_APP,WEBVIEW_1
info: Connecting to chrome-backed webview
info: Creating Chrome session
info: Ensuring Chromedriver exists
info: Killing any old chromedrivers, running: ps -e | grep /Users/lin/codes/appiumGit/appium/build/chromedriver/mac/chromedriver | grep -v grep |grep -e '--port=9515$' | awk '{ print $1 }' | xargs kill -15
info: Successfully cleaned up old chromedrivers
info: Spawning chromedriver with: /Users/lin/codes/appiumGit/appium/build/chromedriver/mac/chromedriver
info: [CHROMEDRIVER] Starting ChromeDriver (v2.10.267517) on port 9515
Only local connections are allowed.
info: Making http request with opts: {"url":"http://my.local.address:9515/wd/hub/session","method":"POST","json":{"sessionId":null,"desiredCapabilities":{"chromeOptions":{"androidPackage":"com.test.tester","androidUseRunningApp":true,"androidDeviceSerial":"066e28s70b115a3b"}}}}
info: Could not connect yet; retrying
info: Making http request with opts: {"url":"http://my.local.address:9515/wd/hub/session","method":"POST","json":{"sessionId":null,"desiredCapabilities":{"chromeOptions":{"androidPackage": "com.test.tester","androidUseRunningApp":true,"androidDeviceSerial":"066e28s70b115a3b"}}}}
info: Didn't get a new command in 60 secs, shutting down...
info: Shutting down appium session...
info: [ADB] Pressing the HOME button
debug: executing: "/Users/lingzhixiang/tools/android-sdk-macosx/platform-tools/adb" -s 066e28s70b115a3b shell "input keyevent 3"
info: Stopping logcat capture
debug: Logcat terminated with code null, signal SIGTERM
info: Cleaning up Chromedriver
info: Killing chromedriver
info: Responding to client with error: {"status":13,"value":{"message":"An unknown server-side error occurred while processing the command. (Original error: socket hang up)","code":"ECONNRESET","origValue":"socket hang up"},"sessionId":"7dd9ea41-f47c-4466-a108-21ce90284ad1"}
POST /wd/hub/session/7dd9ea41-f47c-4466-a108-21ce90284ad1/context 500 60649ms - 270b
info: Chromedriver exited with code null
info: (killed by signal SIGTERM)
info: [BOOTSTRAP] [info] Got data from client: {"cmd":"shutdown"}
info: [BOOTSTRAP] [info] Got command of type SHUTDOWN
info: [BOOTSTRAP] [info] Returning result: {"value":"OK, shutting down","status":0}
info: [BOOTSTRAP] [info] Closed client connection
BTW, I started the Appium 1.0.0 server from source (>node appium.js --no-reset).
# xlzdew Please change driver.context("WEBVIEW") to driver.context("WEBVIEW_1")
Your log said it couldn't start chrome driver on your device. So pls check the chromedriver in
/Users/lin/codes/appiumGit/appium/build/chromedriver/mac/chromedriver
is working or not, or it requires execution permission. You can test it by using some chrome driver commands.
I believe that when you're in a WebView, finding elements by xpath does not work. The only method of finding an element that I have had success with is By.CSS_SELECTOR and the elements class (.menu-item).
http://appium.io/slate/en/v1.2.0/?java#automating-hybrid-android-apps