Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

appium1.6.3 driver.get_log('performance') throw "TypeError: Cannot read property 'getLogs' of undefined" #7986

Closed
Wenxixx opened this issue Mar 6, 2017 · 14 comments
Labels
Bug a problem that needs fixing iOS related to iOS native driver(s) XCUITest regarding xcuitest driver

Comments

@Wenxixx
Copy link

Wenxixx commented Mar 6, 2017

The problem

when I use appium --show-ios-log and client with self.driver.get_log('performance'),and saw the log [iOSLog] [IOS_SYSLOG_ROW] Mar 6 20:54:28 iStevendeMacBook-Pro FFProject[45460]: 拦截到请求 = https://xxxxx at appium server console,
but it's throw errors

Environment

  • Appium version (or git revision) that exhibits the issue: 1.6.3
  • Desktop OS/version used to run Appium: OSX 10.12.3
  • Node.js version (unless using Appium.app|exe):6.3.1
  • Mobile platform/version under test:10.2
  • Real device or emulator/simulator:simulator

Link to Appium logs

[debug] [MJSONWP] Calling AppiumDriver.getLog() with args: ["performance","e903af0e-d986-41a3-b501-4fbadf8ea818"] [debug] [XCUITest] Executing command 'getLog' [debug] [iOS] Retrieving 'performance' logs [MJSONWP] Encountered internal error running command: TypeError: Cannot read property 'getLogs' of undefined at XCUITestDriver.callee$0$0$ (../../../lib/commands/logging.js:34:38) at tryCatch (/Users/iSteven/.nvm/versions/node/v6.3.1/lib/node_modules/appium/node_modules/.5.8.24@babel-runtime/regenerator/runtime.js:67:40) at GeneratorFunctionPrototype.invoke [as _invoke] (/Users/iSteven/.nvm/versions/node/v6.3.1/lib/node_modules/appium/node_modules/.5.8.24@babel-runtime/regenerator/runtime.js:315:22) at GeneratorFunctionPrototype.prototype.(anonymous function) [as next] (/Users/iSteven/.nvm/versions/node/v6.3.1/lib/node_modules/appium/node_modules/.5.8.24@babel-runtime/regenerator/runtime.js:100:21) at invoke (/Users/iSteven/.nvm/versions/node/v6.3.1/lib/node_modules/appium/node_modules/.5.8.24@babel-runtime/regenerator/runtime.js:136:37) at enqueueResult (/Users/iSteven/.nvm/versions/node/v6.3.1/lib/node_modules/appium/node_modules/.5.8.24@babel-runtime/regenerator/runtime.js:185:17) at Promise.exports.(anonymous function).target.(anonymous function).function.target.(anonymous function).F (/Users/iSteven/.nvm/versions/node/v6.3.1/lib/node_modules/appium/node_modules/.1.2.7@core-js/library/modules/$.export.js:30:36) at AsyncIterator.enqueue (/Users/iSteven/.nvm/versions/node/v6.3.1/lib/node_modules/appium/node_modules/.5.8.24@babel-runtime/regenerator/runtime.js:184:12) at AsyncIterator.prototype.(anonymous function) [as next] (/Users/iSteven/.nvm/versions/node/v6.3.1/lib/node_modules/appium/node_modules/.5.8.24@babel-runtime/regenerator/runtime.js:100:21) at Object.runtime.async (/Users/iSteven/.nvm/versions/node/v6.3.1/lib/node_modules/appium/node_modules/.5.8.24@babel-runtime/regenerator/runtime.js:209:12) at XCUITestDriver.callee$0$0 [as getLog] (../../../lib/commands/logging.js:34:11) at ../../../lib/basedriver/driver.js:173:24 at tryCatcher (/Users/iSteven/.nvm/versions/node/v6.3.1/lib/node_modules/appium/node_modules/.2.11.0@bluebird/js/main/util.js:26:23) at Promise._settlePromiseFromHandler (/Users/iSteven/.nvm/versions/node/v6.3.1/lib/node_modules/appium/node_modules/.2.11.0@bluebird/js/main/promise.js:510:31) at Promise._settlePromiseAt (/Users/iSteven/.nvm/versions/node/v6.3.1/lib/node_modules/appium/node_modules/.2.11.0@bluebird/js/main/promise.js:584:18) at Promise._settlePromiseAtPostResolution (/Users/iSteven/.nvm/versions/node/v6.3.1/lib/node_modules/appium/node_modules/.2.11.0@bluebird/js/main/promise.js:248:10) at Async._drainQueue (/Users/iSteven/.nvm/versions/node/v6.3.1/lib/node_modules/appium/node_modules/.2.11.0@bluebird/js/main/async.js:128:12) at Async._drainQueues (/Users/iSteven/.nvm/versions/node/v6.3.1/lib/node_modules/appium/node_modules/.2.11.0@bluebird/js/main/async.js:133:10) at Immediate.Async.drainQueues (/Users/iSteven/.nvm/versions/node/v6.3.1/lib/node_modules/appium/node_modules/.2.11.0@bluebird/js/main/async.js:15:14) at runCallback (timers.js:570:20) at tryOnImmediate (timers.js:550:5) at processImmediate [as _immediateCallback] (timers.js:529:5) [HTTP] <-- POST /wd/hub/session/e903af0e-d986-41a3-b501-4fbadf8ea818/log 500 30 ms - 214 [HTTP] --> GET /wd/hub/session/e903af0e-d986-41a3-b501-4fbadf8ea818/screenshot {} [MJSONWP] Driver proxy active, passing request on via HTTP proxy [debug] [XCUITest] Executing command 'proxyReqRes' [debug] [JSONWP Proxy] Proxying [GET /wd/hub/session/e903af0e-d986-41a3-b501-4fbadf8ea818/screenshot] to [GET http://localhost:8100/session/B30B5327-0201-4311-BBF2-00C15EBE6446/screenshot] with body: {}

@triager triager added the Needs Triage bugs which are not yet confirmed label Mar 6, 2017
@mykola-mokhnach mykola-mokhnach added Bug a problem that needs fixing XCUITest regarding xcuitest driver and removed Needs Triage bugs which are not yet confirmed labels Mar 6, 2017
@mykola-mokhnach
Copy link
Collaborator

Can you try Appium 1.6.4-beta? This issue might be already fixed there.

@imurchie
Copy link
Contributor

imurchie commented Mar 6, 2017

It is not. This is a legitimate bug in appium-ios-driver.

@imurchie imurchie added the iOS related to iOS native driver(s) label Mar 6, 2017
@vjmaiky
Copy link

vjmaiky commented Mar 6, 2017

@imurchie since it is a bug..is there any workaround for it (or other way to do it)? i have lots of test blocked because of it...thanks

@imurchie
Copy link
Contributor

imurchie commented Mar 6, 2017

Not that I can see, no.

@Wenxixx Wenxixx changed the title appium1.63 driver.get_log('performance') throw "TypeError: Cannot read property 'getLogs' of undefined" appium1.6.3 driver.get_log('performance') throw "TypeError: Cannot read property 'getLogs' of undefined" Mar 7, 2017
@pavanbachu0604
Copy link

pavanbachu0604 commented Mar 8, 2017

Same issue is happening when I am using iOS 9.3.5 and Appium 1.5.3

Code to replicate

        try {
        	LogEntries logs;
//			LogEntries logs; = ((IOSDriver) getDriver()).manage().logs().get("performance");
        	logs=((IOSDriver)getDriver()).manage().logs().get("performance");
			int status = -1;
			logger.info("\nList of log entries:\n");
			for (Iterator<LogEntry> it = logs.iterator(); it.hasNext();)
			{
			    LogEntry entry = it.next();
			    try
			    {
			        org.json.JSONObject json = new org.json.JSONObject(entry.getMessage());
			        logger.info(json.toString());
			        org.json.JSONObject message = json.getJSONObject("message");
			        String method = message.getString("method");
			        if (method != null && "Network.responseReceived".equals(method)) {
			        	 org.json.JSONObject params = message.getJSONObject("params");
			        	 org.json.JSONObject response = params.getJSONObject("response");
			        	 String messageUrl = response.getString("url");
			        	 String currentURL = ((WebDriver) driver).getCurrentUrl();
			            if (currentURL.equals(messageUrl)){
			                status = response.getInt("status");
			                logger.info( "response for " + messageUrl + ": " + status);
			                logger.info("headers:" + response.get("headers"));
			            }
			        }
			    } catch (JSONException e){
			        e.printStackTrace();
			    }
			}
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}

Gist of logs https://gist.github.com/pavanbachu0604/2aaf9946f08cfcd8190ffb0a27be85b8

@imurchie
Copy link
Contributor

imurchie commented Mar 8, 2017

Yes. It has been broken for a long time.

@pavanbachu0604
Copy link

@imurchie Can we except a fix in appium 1.6.4 final version ?

@vikramvi
Copy link
Contributor

@imurchie https://appium.io/slate/en/master/?ruby#server-flags per this --show-ios-log, it is [DEPRECATED]. What should be correct way to use it ?

@mykola-mokhnach
Copy link
Collaborator

@vikramvi correct way is to use DesiredCapabilites. The name is showIOSLog

@pavanbachu0604
Copy link

What is the way to get the performance logs ?

@imurchie
Copy link
Contributor

imurchie commented May 1, 2017

The performance logs for iOS only exist for web (or webview) testing. The bug is that there is a weird capability to turn it on, that is not documented anywhere.

appium-boneyard/appium-ios-driver#233

@imurchie
Copy link
Contributor

imurchie commented May 1, 2017

#8354

@imurchie
Copy link
Contributor

This has been fixed. It can be turned on with enablePerformanceLogging capability. Closing.

@lock
Copy link

lock bot commented Apr 26, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked and limited conversation to collaborators Apr 26, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Bug a problem that needs fixing iOS related to iOS native driver(s) XCUITest regarding xcuitest driver
Projects
None yet
Development

No branches or pull requests

7 participants