I created some VueJS test and run with Cypress.
Everything is OK until I run it on Jenkins (with a GitHub hook trigger for GITScm polling)
Only cypress run --browser chrome and cypress run --browser electron work.
With Edge and Firefox, it returned this kind of error
Still waiting to connect to Edge, retrying in 1 second (attempt 62/62)
Cypress failed to make a connection to the Chrome DevTools Protocol after retrying for 50 seconds.
This usually indicates there was a problem opening the Edge browser.
The CDP port requested was 63444.
Error: connect ECONNREFUSED 127.0.0.1:63444
at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1157:16)
Error: Command failed with exit code 1: npm run cypress:run
at makeError (C:\ProgramData\Jenkins\.jenkins\workspace\Homepage\node_modules\start-server-and-test\node_modules\execa\lib\error.js:60:11)
at handlePromise (C:\ProgramData\Jenkins\.jenkins\workspace\Homepage\node_modules\start-server-and-test\node_modules\execa\index.js:118:26)
at processTicksAndRejections (node:internal/process/task_queues:96:5) {
shortMessage: 'Command failed with exit code 1: npm run cypress:run',
command: 'npm run cypress:run',
escapedCommand: '"npm run cypress:run"',
exitCode: 1,
signal: undefined,
signalDescription: undefined,
stdout: undefined,
stderr: undefined,
failed: true,
timedOut: false,
isCanceled: false,
killed: false
}
How can I run it normally in Jenkins? Thanks in advance.
I'm trying to run the Appium server through below code and getting the below error.
AppiumDriverLocalService service = AppiumDriverLocalService.buildService(new AppiumServiceBuilder()
.usingDriverExecutable(new File("C:/Program Files/nodejs/node.exe"))
.withAppiumJS(new File("Path of main.js"))
.withIPAddress("0.0.0.0").usingPort(4723));
service.start();
Logs:
[RemoteTestNG] detected TestNG version 6.14.2
[35m[Appium][39m Welcome to Appium v1.9.1
[35m[Appium][39m Appium REST http interface listener started on 0.0.0.0:4723
[35m[HTTP][39m [37m-->[39m [37mGET[39m [37m/wd/hub/status[39m
[35m[HTTP][39m [90m{}[39m
[debug] [35m[GENERIC][39m Calling AppiumDriver.getStatus() with args: []
[debug] [35m[GENERIC][39m Responding to client with driver.getStatus() result: {"build":{"version":"1.9.1"}}
[35m[HTTP][39m [37m<-- GET /wd/hub/status [39m[32m200[39m [90m10 ms - 67[39m
[35m[HTTP][39m [90m[39m
[35m[Appium][39m **Cannot retrieve git revision for Appium version 1.9.1 from GitHub. Original error: Error: read ECONNRESET**
I'm trying to run an iOS app with appium i've searched several examples on internet and this is with what i've come out :
public class NotAScenario {
IOSDriver driver;
#BeforeTest
public void start() throws InterruptedException, MalformedURLException {
DesiredCapabilities caps = new DesiredCapabilities();
caps.setCapability("platformName", "iOS");
caps.setCapability("platformVersion", "9.3");
caps.setCapability("deviceName", "mydevicename");
caps.setCapability("app", "myipafile.ipa");
driver = new IOSDriver(new URL("http://127.0.0.0:4723/wd/hub"), caps);
sleep(5000);
}
#AfterTest
public void end() throws InterruptedException {
sleep(5000);
driver.quit();
}
#Test
public void test() throws InterruptedException {
System.out.println("test");
sleep(5000);
}
}
I tried with an real device iphone 5S, I tried with a simulator same result the app just open/close in 0.5 sec in a loop then it crashes and I get this error
[MJSONWP] Calling AppiumDriver.getStatus() with args: []
[debug] [Instruments] Attempting to launch instruments, this is try #1
[Instruments] Launching instruments
[debug] [Instruments] Attempting to run app on real device with UDID 'myudid'
[debug] [Instruments] Found Insruments-Without-Delay: /Applications/Appium.app/Contents/Resources/node_modules/appium/node_modules/appium-ios-driver/node_modules/appium-instruments/thirdparty/iwd7
[debug] [Instruments] Spawning instruments with command: '/Applications/Xcode.app/Contents/Developer/usr/bin/instruments -t /Applications/Xcode.app/Contents/Applications/Instruments.app/Contents/PlugIns/AutomationInstrument.xrplugin/Contents/Resources/Automation.tracetemplate -D /var/folders/sw/w9bk_9_96s1bwz15mzxk3qpd7lj5f9/T/appium-instruments/instrumentscli0.trace -w myudid my.app.package -e UIASCRIPT "/Users/mobileautomation/Library/Application Support/appium/bootstrap/bootstrap-bbff984e2d53a4ae.js" -e UIARESULTSPATH /var/folders/sw/w9bk_9_96s1bwz15mzxk3qpd7lj5f9/T/appium-instruments'
[debug] [Instruments] And extra without-delay env: {}
[debug] [Instruments] And launch timeouts (in ms): {"global":90000}
[HTTP] --> GET /wd/hub/status {}
[MJSONWP] Calling AppiumDriver.getStatus() with args: []
[HTTP] <-- GET /wd/hub/status - - ms - -
[HTTP] <-- GET /wd/hub/status - - ms - -
[HTTP] --> GET /wd/hub/status {}
[MJSONWP] Calling AppiumDriver.getStatus() with args: []
[debug] [Instruments] [INST STDERR] Instruments Trace Error : Target failed to run: Permission to debug my.app.package was denied. The app must be signed with a development identity (e.g. iOS Developer).
[debug] [Instruments] Instruments exited with code 253
[Instruments] Error launching instruments: Instruments crashed on startup
I've tried to run it from my code, I tried to run it directly from appium and I even tried to run it from Instruments/Automation but I keep on having the same result the :
[INST STDERR] Instruments Trace Error : Target failed to run: Permission to debug my.app.package was denied. The app must be signed with a development identity (e.g. iOS Developer).
I've seen in here that it can be related to the fact that the build is in "Release" and not in "Debug" so I asked the dev team to give me a debug build but I still have the same result.
Could it be that they didn't build it the right way ?
Am I missing something ? Do they need the device name / udid in an allowed file or something ?
EDIT :
I did receive a new build of the dev it was indeed an issue with the provisionning profile that was not in dev & the build settings not in debug
Please use debug build of the app , this problem is due to not using debug build ,you need debug build on iOS in order to automate and make sure ui automation is enabled in developer options
Go to below folder
"/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform"
I found a folder named (11.2) & My real device version was (11.2.5)
Just Renamed the folder with version name (11.2) -> (11.2.5).
Started working again from me.
I am working on iPhone automation using selenium webdriver, appium & ios webkit debug proxy.
Configurations:
OS X Version 10.11.2
Appium 1.3.5
Xcode: 7.2
Device: iPhone 6[9.2]
I have installed safariLauncher app in iPhone using Xcode.
Steps:
I launched appium through terminal.
Cmd: Appium &
Then launched ios-webkit-debug-proxy.
Cmd: ./bin/ios-webkit-debug-proxy-launcher.js -c [device udid]:27753 -d
I launch appium & webkit server every time before starting any test case execution.
Only the first test case works fine and 2nd test case onward run into below error in appium log:
code error: Failed to start an Appium session, err was: Error: Instruments crashed on startup
info: [debug] Error: Instruments crashed on startup
at Instruments.onInstrumentsExit (/usr/local/lib/node_modules/appium/node_modules/appium-instruments/lib/instruments.js:389:31)
at null.<anonymous> (/usr/local/lib/node_modules/appium/node_modules/appium-instruments/lib/instruments.js:308:12)
at emitTwo (events.js:87:13)
at ChildProcess.emit (events.js:172:7)
at Process.ChildProcess._handle.onexit (internal/child_process.js:200:12)
info: [debug] Responding to client with error: {"status":33,"value":{"message":"A new session could not be created. (Original error: Instruments crashed on startup)","origValue":"Instruments crashed on startup"},"sessionId":null}
info: <-- POST /wd/hub/session 500 153251.340 ms - 182
Please suggest any solution.
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