appium / appium-for-mac

[deprecated] Application for automating a mac app with JSON wire protocol
Apache License 2.0
193 stars 70 forks source link

AppiumForMac doesn’t provide driver logs. #90

Closed safo-bora closed 3 years ago

safo-bora commented 4 years ago

AppiumForMac doesn’t provide driver logs, 'global_diagnostics_directory' folder is also not created.

Environment:

Code:

from appium import webdriver

defaultCookies = [
    {'name': 'loop_delay', 'value': 1.00},
    {'name': 'command_delay', 'value': 0.100},
    {'name': 'implicit_timeout', 'value': 3.000},
    {'name': 'mouse_speed', 'value': 50},
    {'name': 'screen_shot_on_error', 'value': False},
    {'name': 'global_diagnostics_directory',
    'value': '~/Desktop/'}
]
desiredCapabilities = {"implicitly_wait": 30,
                        "platform": "Mac",
                        "platformName": "Mac",
                        "deviceName": "Mac",
                        "app": "Stickies"}

driver = webdriver.Remote(command_executor='http://127.0.0.1:4622/wd/hub',
                          desired_capabilities=desiredCapabilities)

print(dir(driver))
logs = driver.get_log('driver')

Expected: See logs about the AppiumForMac session.

Result:

Traceback (most recent call last):
  File "/Users/katya/Desktop/appium_simulator.py", line 23, in <module>
    logs = driver.get_log('driver')
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/selenium/webdriver/remote/webdriver.py", line 1262, in get_log
    return self.execute(Command.GET_LOG, {'type': log_type})['value']
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/selenium/webdriver/remote/webdriver.py", line 321, in execute
    self.error_handler.check_response(response)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/appium/webdriver/errorhandler.py", line 29, in check_response
    raise wde
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/appium/webdriver/errorhandler.py", line 24, in check_response
    super(MobileErrorHandler, self).check_response(response)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/selenium/webdriver/remote/errorhandler.py", line 243, in check_response
    raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message: Could not find selector (post_log:data:) for path '/session/wQngMD1T/log'.
KazuCocoa commented 4 years ago

Did you provide defaultCookies as cookies to the capability? https://github.com/appium/appium-for-mac/blob/2356957dc73b6275262c918ca8f4184ef4a25af0/examples/dock_demo.py#L26

Btw, get_log error is expected since this driver haven't provided the command for now.

safo-bora commented 4 years ago

oh sorry, yes I have added cookies, but see the same error _selenium.common.exceptions.WebDriverException: Message: Could not find selector (postlog:data:) for path '/session/cCNRBVvQ/log'.

from appium import webdriver

defaultCookies = [
    {'name': 'loop_delay', 'value': 1.00},
    {'name': 'command_delay', 'value': 0.100},
    {'name': 'implicit_timeout', 'value': 3.000},
    {'name': 'mouse_speed', 'value': 50},
    {'name': 'screen_shot_on_error', 'value': False},
    {'name': 'global_diagnostics_directory',
    'value': '~/Desktop/'}
]
desiredCapabilities = {"implicitly_wait": 30,
                        "platform": "Mac",
                        "platformName": "Mac",
                        "deviceName": "Mac",
                        "app": "Stickies",
                       'cookies': defaultCookies}

driver = webdriver.Remote(command_executor='http://127.0.0.1:4622/wd/hub',
                          desired_capabilities=desiredCapabilities)

logs = driver.get_log('driver')
KazuCocoa commented 4 years ago

Since this module does not support the command. We can add 'server' https://github.com/appium/appium-mac-driver/pull/49 log to return Appium server log, but other logs we should add.

KazuCocoa commented 3 years ago

I've added #49 Please create a new issue for a new request