CodeceptJS Error after running first scenario (after each hook) - codeceptjs

I just started trying out codeceptjs to see if we can use it in our project. It looks extremely useful, however I keep running into one nasty error which I can not pinpoint :-(
Who knows what I have to do to get rid of the error below?
I run codeceptjs with the protractor helper, on my MBP.
The error:
"after each" hook: finalize codeceptjs for "test something | {"page":"Test pagina CARDS-CC"}":
no such alert
(Session info: chrome=67.0.3396.87)
(Driver info: chromedriver=2.40.565386 (45a059dc425e08165f9a10324bd1380cc13ca363),platform=Mac OS X 10.13.5 x86_64)

I'm new to CodeceptJS as well and found this same error. You can add a --verbose switch to your command to see the error stacktrace.
The problem may depend on your helper but in my case, it seems that Protractor automatically anticipates any alert popups for every test case executed and tries to close it automatically. If there are no alerts found, it just catches the exception thrown to it if the exception string contains no alert open. The problem lies with the checking of the error message. It appears to have been mismatched and therefore the exception was raised and has not been skipped.
My error message:
...
[1] Error | NoSuchAlertError: no such alert
(Session info: chrome=67.0.3396.87)
(Driver info: chromedriver=2.40.565498 (ea082db3280dd6843ebfb08a625e3eb905c4f5ab),platform=Windows NT 10.0.17134 x86_64)
Emitted | test.failed ([object Object])
× "after each" hook: finalize codeceptjs for "Sample test case 1" in 28ms
[1] Error | NoSuchAlertError: no such alert
(Session info: chrome=67.0.3396.87)
(Driver info: chromedriver=2.40.565498 (ea082db3280dd6843ebfb08a625e3eb905c4f5ab),platform=Windows NT 10.0.17134 x86_64)
NoSuchAlertError: no such alert
(Session info: chrome=67.0.3396.87)
(Driver info: chromedriver=2.40.565498 (ea082db3280dd6843ebfb08a625e3eb905c4f5ab),platform=Windows NT 10.0.17134 x86_64)
Emitted | suite.after ([object Object])
-- FAILURES:
1) SampleTest1
"after each" hook: finalize codeceptjs for "Sample test case 1":
no such alert
(Session info: chrome=67.0.3396.87)
(Driver info: chromedriver=2.40.565498 (ea082db3280dd6843ebfb08a625e3eb905c4f5ab),platform=Windows NT 10.0.17134 x86_64)
oSuchAlertError: no such alert
(Session info: chrome=67.0.3396.87)
(Driver info: chromedriver=2.40.565498 (ea082db3280dd6843ebfb08a625e3eb905c4f5ab),platform=Windows NT 10.0.17134 x86_64)
at Object.checkLegacyResponse (C:\Users\user\AppData\Roaming\npm\node_modules\codeceptjs-protractor\node_modules\selenium-webdriver\lib\error.js:546:15)
at parseHttpResponse (C:\Users\user\AppData\Roaming\npm\node_modules\codeceptjs-protractor\node_modules\selenium-webdriver\lib\http.js:509:13)
at doSend.then.response (C:\Users\user\AppData\Roaming\npm\node_modules\codeceptjs-protractor\node_modules\selenium-webdriver\lib\http.js:441:30)
at process._tickCallback (internal/process/next_tick.js:68:7)
From: Task: WebDriver.switchTo().alert()
at thenableWebDriverProxy.schedule (C:\Users\user\AppData\Roaming\npm\node_modules\codeceptjs-protractor\node_modules\selenium-webdriver\lib\webdriver.js:807:17)
at TargetLocator.alert (C:\Users\user\AppData\Roaming\npm\node_modules\codeceptjs-protractor\node_modules\selenium-webdriver\lib\webdriver.js:1862:29)
at Protractor.grabPopupText (C:\Users\user\AppData\Roaming\npm\node_modules\codeceptjs-protractor\node_modules\codeceptjs\lib\helper\Protractor.js:1066:52)
at Protractor._after (C:\Users\user\AppData\Roaming\npm\node_modules\codeceptjs-protractor\node_modules\codeceptjs\lib\helper\Protractor.js:247:31)
at recorder.add (C:\Users\user\AppData\Roaming\npm\node_modules\codeceptjs-protractor\node_modules\codeceptjs\lib\listener\helpers.js:21:69)
FAIL | 1 passed, 1 failed // 8s
Emitted | global.result ([object Object])
Emitted | global.after ([object Object])
I looked at the source codes where the error went off and saw that there is a mismatch between the anticipated error message and the actual error message.
Actual Exception:
NoSuchAlertError: no such alert
Anticipated Exception message:
'no alert open'
Got it from this line in the stack trace:
at Protractor.grabPopupText (C:\Users\user\AppData\Roaming\npm\node_modules\codeceptjs-protractor\node_modules\codeceptjs\lib\helper\Protractor.js:1066:52)`
Code:
async grabPopupText() {
try {
const dialog = await this.browser.switchTo().alert();
if (dialog) {
return dialog.getText();
}
} catch (e) {
if (e.message.indexOf('no alert open') > -1) {
// Don't throw an error
return null;
}
throw e;
}
}
Temporary workaround:
I just added no such alert in the error message checking part until they fix this bug.
if (e.message.indexOf('no alert open') > -1 || e.message.indexOf('no such alert') > -1) {
// Don't throw an error
return null;
}
Hope this quick workaround helps.

Related

UE4 19.2, Packaging Unknown Error for Windows

sorry for taking your time, I'm having trouble packaging my game for Windows with.
It didn't work with Visual Studio 2017 and neither with 2015.
Problematic part of my Output Log: (The bold lines are Errors, and the others are Messages)
UATHelper: Packaging (Windows (64-bit)): LINK : fatal error LNK1104: cannot open file 'X:\MyGame\Binaries\Win64\MyGame.exe'
UATHelper: Packaging (Windows (64-bit)): ERROR: UBT ERROR: Failed to produce item: X:\MyGame\Binaries\Win64\MyGame.pdb
PackagingResults: Error: UBT ERROR: Failed to produce item: X:\MyGame\Binaries\Win64\MyGame.pdb
UATHelper: Packaging (Windows (64-bit)): Total build time: 26.35 seconds (Local executor: 0.00 seconds)
UATHelper: Packaging (Windows (64-bit)): Took 26.7634315s to run UnrealBuildTool.exe, ExitCode=5
UATHelper: Packaging (Windows (64-bit)): ERROR: Command failed (Result:5): C:\Program Files\Epic Games\UE_4.19\Engine\Binaries\DotNET\UnrealBuildTool.exe MyGame Win64 Development -Project=X:\MyGame\MyGame.uproject X:\MyGame\MyGame.uproject -NoUBTMakefiles -remoteini="X:\MyGame" -skipdeploy -noxge -NoHotReload -ignorejunk. See
logfile for details: 'UnrealBuildTool-2018.11.28-15.33.44.txt'
UATHelper: Packaging (Windows (64-bit)): (see C:\Users\MyPC\AppData\Roaming\Unreal Engine\AutomationTool\Logs\C+Program+Files+Epic+Games+UE_4.19\UAT_Log.txt for full exception trace)
PackagingResults: Error: Command failed (Result:5): C:\Program Files\Epic Games\UE_4.19\Engine\Binaries\DotNET\UnrealBuildTool.exe MyGame Win64 Development -Project=X:\MyGame\MyGame.uproject X:\MyGame\MyGame.uproject -NoUBTMakefiles -remoteini="X:\MyGame" -skipdeploy -noxge -NoHotReload -ignorejunk. See logfile for details: 'U
nrealBuildTool-2018.11.28-15.33.44.txt'
UATHelper: Packaging (Windows (64-bit)): AutomationTool exiting with ExitCode=5 (5)
UATHelper: Packaging (Windows (64-bit)): BUILD FAILED
PackagingResults: Error: Unknown Error
LogSlate: Window 'Output Log' being destroyed
I would really appreciate your help.
Thank you very much.
Don't actually know anything about Unreal yet, but it looks like you have your Project Path defined twice behind the -project=<Project Path>.uproject option.

NullPointerException when using AndroidDriver and calling WebDriverWait

My code below tries to wait until our native app loads. But it receives NPE:
RemoteWebDriver driver =
new AndroidDriver<MobileElement>//this gets NPE below
//new RemoteWebDriver //this works!!
(new URL("http://127.0.0.1:4723/wd/hub"), capabilities);
new WebDriverWait(driver, 30).until(
ExpectedConditions.presenceOfElementLocated(
By.xpath("//*[contains(#text, 'Tan')]")));
When I replace AndroidDriver with RemoteDriver, everything works as expected! Our app launches and our test code waits until the app loads. The problem is, we cannot use mobile device specific API using RemoteDriver.
Appium GUI v1.4.16.1 (Ophiuchus). Please tell if any other version info is needed, as I'm not good at npm etc. But I downloaded all of the stuff last week.
Here is the stack trace:
java.lang.NullPointerException
at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:152)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:636)
at io.appium.java_client.DefaultGenericMobileDriver.execute(DefaultGenericMobileDriver.java:40)
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.findElement(RemoteWebDriver.java:369)
at io.appium.java_client.DefaultGenericMobileDriver.findElement(DefaultGenericMobileDriver.java:56)
at io.appium.java_client.AppiumDriver.findElement(AppiumDriver.java:1)
at io.appium.java_client.android.AndroidDriver.findElement(AndroidDriver.java:1)
at org.openqa.selenium.remote.RemoteWebDriver.findElementByXPath(RemoteWebDriver.java:474)
at io.appium.java_client.DefaultGenericMobileDriver.findElementByXPath(DefaultGenericMobileDriver.java:134)
at io.appium.java_client.AppiumDriver.findElementByXPath(AppiumDriver.java:1)
at io.appium.java_client.android.AndroidDriver.findElementByXPath(AndroidDriver.java:1)
at org.openqa.selenium.By$ByXPath.findElement(By.java:361)
at org.openqa.selenium.remote.RemoteWebDriver.findElement(RemoteWebDriver.java:361)
at io.appium.java_client.DefaultGenericMobileDriver.findElement(DefaultGenericMobileDriver.java:52)
at io.appium.java_client.AppiumDriver.findElement(AppiumDriver.java:1)
at io.appium.java_client.android.AndroidDriver.findElement(AndroidDriver.java:1)
at org.openqa.selenium.support.ui.ExpectedConditions.findElement(ExpectedConditions.java:895)
at org.openqa.selenium.support.ui.ExpectedConditions.access$000(ExpectedConditions.java:41)
at org.openqa.selenium.support.ui.ExpectedConditions$6.apply(ExpectedConditions.java:181)
at org.openqa.selenium.support.ui.ExpectedConditions$6.apply(ExpectedConditions.java:178)
at org.openqa.selenium.support.ui.FluentWait.until(FluentWait.java:238)
Here is what I see on Appium GUI:
> info: [debug] Appium session started with sessionId 4153c447-cfba-45db-a23a-1e603a3e0e7c
> info: <-- POST /wd/hub/session 303 17598.310 ms - 74
> info: --> GET /wd/hub/session/4153c447-cfba-45db-a23a-1e603a3e0e7c {}
> info: [debug] Responding to client with success: {"status":0,"value":{"platform":"LINUX","browserName":"Android","platformVersion":"4.4.2","webStorageEnabled":false,"takesScreenshot":true,"javascriptEnabled":true,"databaseEnabled":false,"networkConnectionEnabled":true,"locationContextEnabled":false,"warnings":{},"desired":{"app":"C:\\Temp\\appium\\akbank-release.apk","appActivity":"com.akbank.akbankdirekt.ui.prelogin.SplashActivity","platformName":"Android","deviceName":"OJOBUCIBGEKNTKYS"},"app":"C:\\Temp\\appium\\akbank-release.apk","appActivity":"com.akbank.akbankdirekt.ui.prelogin.SplashActivity","platformName":"Android","deviceName":"OJOBUCIBGEKNTKYS"},"sessionId":"4153c447-cfba-45db-a23a-1e603a3e0e7c"}
> info: <-- GET /wd/hub/session/4153c447-cfba-45db-a23a-1e603a3e0e7c 200 4.362 ms - 667 {"status":0,"value":{"platform":"LINUX","browserName":"Android","platformVersion":"4.4.2","webStorageEnabled":false,"takesScreenshot":true,"javascriptEnabled":true,"databaseEnabled":false,"networkConnectionEnabled":true,"locationContextEnabled":false,"warnings":{},"desired":{"app":"C:\\Temp\\appium\\akbank-release.apk","appActivity":"com.akbank.akbankdirekt.ui.prelogin.SplashActivity","platformName":"Android","deviceName":"OJOBUCIBGEKNTKYS"},"app":"C:\\Temp\\appium\\akbank-release.apk","appActivity":"com.akbank.akbankdirekt.ui.prelogin.SplashActivity","platformName":"Android","deviceName":"OJOBUCIBGEKNTKYS"},"sessionId":"4153c447-cfba-45db-a23a-1e603a3e0e7c"}
> info: --> POST /wd/hub/session/4153c447-cfba-45db-a23a-1e603a3e0e7c/element {"using":"xpath","value":"//*[contains(#text, 'Tan')]"}
> info: [debug] Waiting up to 0ms for condition
> info: [debug] Pushing command to appium work queue: ["find",{"strategy":"xpath","selector":"//*[contains(#text, 'Tan')]","context":"","multiple":false}]
> info: [debug] [BOOTSTRAP] [debug] Got data from client: {"cmd":"action","action":"find","params":{"strategy":"xpath","selector":"//*[contains(#text, 'Tan')]","context":"","multiple":false}}
> info: [debug] [BOOTSTRAP] [debug] Got command of type ACTION
> info: [debug] [BOOTSTRAP] [debug] Got command action: find
> info: [debug] [BOOTSTRAP] [debug] Finding //*[contains(#text, 'Tan')] using XPATH with the contextId: multiple: false
> info: [debug] [BOOTSTRAP] [debug] Returning result: {"value":"Could not find an element using supplied strategy. ","status":7}
> info: [debug] Condition unmet after 8397ms. Timing out.
> info: [debug] Responding to client with error: {"status":7,"value":{"message":"An element could not be located on the page using the given search parameters.","origValue":"Could not find an element using supplied strategy. "},"sessionId":"4153c447-cfba-45db-a23a-1e603a3e0e7c"}
> info: <-- POST /wd/hub/session/4153c447-cfba-45db-a23a-1e603a3e0e7c/element 500 8402.114 ms - 230
I've put a sleep before wait and now I don't get NPE:
RemoteWebDriver driver =
new AndroidDriver<MobileElement>//this gets NPE below
//new RemoteWebDriver //this works!!
(new URL("http://127.0.0.1:4723/wd/hub"), capabilities);
Thread.sleep(15000);
new WebDriverWait(driver, 30).until(
ExpectedConditions.presenceOfElementLocated(
By.xpath("//*[contains(#text, 'Tan')]")));
NPE was thrown as soon as the app was first loaded. I think this is an internal Appium problem.

Unable to removeapp by using appium - getting an exception

I've tried
driver.removeApp("com.my.app");
but getting an exception :
Exception in thread "main" org.openqa.selenium.WebDriverException: undefined status object (WARNING: The server did not provide any stacktrace information)
and the appium log :
info: --> POST /wd/hub/session/71a4c5ca-92b5-4e94-99f5-f8a795671d82/appium/device/remove_app {"bundleId":"com.my.app"}
info: [debug] Responding to client with error: {"status":1,"value":{"message":"undefined status object"},"sessionId":"71a4c5ca-92b5-4e94-99f5-f8a795671d82"}
info: <-- POST /wd/hub/session/71a4c5ca-92b5-4e94-99f5-f8a795671d82/appium/device/remove_app 500 1.802 ms - 109
any idea why it doesn't work ?
thanks

Getting errors in sendkeys command in appium (v.1.2.0) under selendroid mode (Real Device < 17 )

I just updated Appium 1.1.0 to 1.2.0, With previous version automation worked fine. But surprisingly when i update Appium i got below errors in sendkeys.
Appium Logs:
info: <-- POST /wd/hub/session/892ef5c3-267a-f50d-e28b-9b26a9ccd785/element 200 70.640 ms - 122
info: --> POST /wd/hub/session/892ef5c3-267a-f50d-e28b-9b26a9ccd785/element/d764396c-6598-5920-d8c1-85ee7c2f44e5/value {"id":"d764396c-6598-5920-d8c1-85ee7c2f44e5","value":["abc"]}
debug: Appium request initiated at /wd/hub/session/892ef5c3-267a-f50d-e28b-9b26a9ccd785/element/d764396c-6598-5920-d8c1-85ee7c2f44e5/value
debug: Request received with params: {"id":"d764396c-6598-5920-d8c1-85ee7c2f44e5","value":["abc"]}
debug: Setting text on element 'd764396c-6598-5920-d8c1-85ee7c2f44e5': 'abc'
debug: Making http request with opts: {"url":"http://localhost:8080/wd/hub/session/892ef5c3-267a-f50d-e28b-9b26a9ccd785/element/d764396c-6598-5920-d8c1-85ee7c2f44e5/value","method":"POST","json":{"value":["abc"]}}
**debug: Responding to client with error: {"status":13,"value":{"message":"An unknown server-side error occurred while processing the command. (Original error: connect ECONNREFUSED)","code":"ECONNREFUSED","errno":"ECONNREFUSED","syscall":"connect","origValue":"connect ECONNREFUSED"},"sessionId":"892ef5c3-267a-f50d-e28b-9b26a9ccd785"}**
info: <-- POST /wd/hub/session/892ef5c3-267a-f50d-e28b-9b26a9ccd785/element/d764396c-6598-5920-d8c1-85ee7c2f44e5/value 500 7.627 ms - 293
info: --> DELETE /wd/hub/session/892ef5c3-267a-f50d-e28b-9b26a9ccd785 {}
Driver info: test.utils.SwipeableWebDriver
Capabilities [{automationName=selendroid, platformVersion=16, platform=ANDROID, acceptSslCerts=true, javascriptEnabled=true, platformName=android, handlesAlerts=true, browserName=selendroid, networkConnectionEnabled=true, rotatable=true, takesScreenshot=true, version=0.10.0}]
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:204)
at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:156)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:599)
at io.appium.java_client.AppiumDriver.execute(AppiumDriver.java:84)
at org.openqa.selenium.remote.RemoteWebElement.execute(RemoteWebElement.java:268)
at org.openqa.selenium.remote.RemoteWebElement.sendKeys(RemoteWebElement.java:89)
at test.screens.SignUpPage.fillPassword(SignUpPage.java:37)
at test.utils.Functions.UserLogin(Functions.java:98)
at test.LaunchTest.testLogin(EnigmaLaunchTest.java:121)
Thanks,
Priyank Shah
I was having a similar error message and the problem was solved by changing the none default Selendroid port number to the default 8080. Try that and see what happens...

Appium scripts do not work after switch to WebView

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

Resources