serhatbolsu / robotframework-appiumlibrary

AppiumLibrary is an appium testing library for RobotFramework
Apache License 2.0
396 stars 292 forks source link

Error: 'WebDriver' object has no attribute 'zoom' #258

Closed ghost closed 1 year ago

ghost commented 4 years ago

I got React Native app installed on Android emulator. Packages installed:

Appium-Python-Client         0.46
certifi                      2019.6.16
chardet                      3.0.4
decorator                    4.4.0
docutils                     0.15.1
idna                         2.8
kitchen                      1.2.6
pip                          18.1
requests                     2.22.0
robotframework               3.1.2
robotframework-appiumlibrary 1.5.0.4
robotframework-requests      0.5.0
selenium                     3.141.0
setuptools                   40.6.2
six                          1.12.0
urllib3                      1.25.3

Chrome webdriver version 76.0.3809.68.

My code:

*** Settings ***
Library           AppiumLibrary
Library          Collections
Variables    ../../config/config_variables.py  CONFIG  ../../.config/config.ini
Resource    ../../resources/keywords/general.resource
Resource    ../../resources/locators/containers.resource

Suite Setup    Setup
Suite Teardown    Teardown

*** Variables ***
${USER}    ${CONFIG.Environment.username}
${PASSWORD}    ${CONFIG.Environment.password}
${VIEW LOCATOR}    accessibility_id=My View

*** Test Cases ***
Open App And Login
    Open App And Login    ${USER}    ${PASSWORD}

Zoom In
    ${contexts}=    Get Contexts
    Length Should Be    ${contexts}    2
    Should Contain    ${contexts}    NATIVE_APP
    Switch To Context    NATIVE_APP
    ${ctx}=    Get Current Context
    Log    ${ctx}
    Wait Until Page Contains Element    ${VIEW LOCATOR}
    Zoom    ${VIEW LOCATOR}

Executing of Zoom throw this error: 'WebDriver' object has no attribute 'zoom'

Same with Pinch keyword. Error thrown no matter switching context to native or not. What am I doing wrong?

Appium server logs:

[HTTP] --> GET /wd/hub/session/bdd1ef58-5efd-4a6b-bcc9-234a80cfe714/contexts
[HTTP] {}
[W3C (bdd1ef58)] Calling AppiumDriver.getContexts() with args: ["bdd1ef58-5efd-4a6b-bcc9-234a80cfe714"]
[AndroidDriver] Getting a list of available webviews
[ADB] Running 'c:\Users\User\AppData\Local\Android\Sdk\platform-tools\adb.exe -P 5037 -s emulator-5554 shell cat /proc/net/unix'
[AndroidDriver] WEBVIEW_16364 mapped to pid 16364
[AndroidDriver] Getting process name for webview
[ADB] Running 'c:\Users\User\AppData\Local\Android\Sdk\platform-tools\adb.exe -P 5037 -s emulator-5554 shell ps'
[AndroidDriver] Parsed pid: '16364' pkg: 'com.myapp' from
[AndroidDriver]     USER           PID  PPID     VSZ    RSS WCHAN            ADDR S NAME
[AndroidDriver]     u0_a88       16364  1542 1641732 229756 futex_wait_queue_me 0 S com.myapp
[AndroidDriver] Returning process name: 'com.myapp'
[AndroidDriver] Found webviews: ["WEBVIEW_com.myapp"]
[AndroidDriver] Available contexts: ["NATIVE_APP","WEBVIEW_com.myapp"]
[W3C (bdd1ef58)] Responding to client with driver.getContexts() result: ["NATIVE_APP","WEBVIEW_com.myapp"]
[HTTP] <-- GET /wd/hub/session/bdd1ef58-5efd-4a6b-bcc9-234a80cfe714/contexts 200 440 ms - 54
[HTTP] 
[HTTP] --> POST /wd/hub/session/bdd1ef58-5efd-4a6b-bcc9-234a80cfe714/context
[HTTP] {"name":"NATIVE_APP"}
[W3C (bdd1ef58)] Calling AppiumDriver.setContext() with args: ["NATIVE_APP","bdd1ef58-5efd-4a6b-bcc9-234a80cfe714"]
[W3C (bdd1ef58)] Responding to client with driver.setContext() result: null
[HTTP] <-- POST /wd/hub/session/bdd1ef58-5efd-4a6b-bcc9-234a80cfe714/context 200 2 ms - 14
[HTTP] 
[HTTP] --> GET /wd/hub/session/bdd1ef58-5efd-4a6b-bcc9-234a80cfe714/context
[HTTP] {}
[W3C (bdd1ef58)] Calling AppiumDriver.getCurrentContext() with args: ["bdd1ef58-5efd-4a6b-bcc9-234a80cfe714"]
[W3C (bdd1ef58)] Responding to client with driver.getCurrentContext() result: "NATIVE_APP"
[HTTP] <-- GET /wd/hub/session/bdd1ef58-5efd-4a6b-bcc9-234a80cfe714/context 200 3 ms - 22
[HTTP] 
[HTTP] --> POST /wd/hub/session/bdd1ef58-5efd-4a6b-bcc9-234a80cfe714/elements
[HTTP] {"using":"accessibility id","value":"Map Container"}
[W3C (bdd1ef58)] Calling AppiumDriver.findElements() with args: ["accessibility id","Map Container","bdd1ef58-5efd-4a6b-bcc9-234a80cfe714"]
[BaseDriver] Valid locator strategies for this request: xpath, id, class name, accessibility id, -android uiautomator
[BaseDriver] Waiting up to 0 ms for condition
[WD Proxy] Matched '/elements' to command name 'findElements'
[WD Proxy] Proxying [POST /elements] to [POST http://localhost:8200/wd/hub/session/de8f4e88-baa6-4209-b0de-d9a0300f0065/elements] with body: {"strategy":"accessibility id","selector":"Map Container","context":"","multiple":true}
[WD Proxy] Got response with status 200: {"sessionId":"de8f4e88-baa6-4209-b0de-d9a0300f0065","status":0,"value":[{"ELEMENT":"2fae680e-3288-4629-86bb-634b73cf8e4d"}]}
[W3C (bdd1ef58)] Responding to client with driver.findElements() result: [{"element-6066-11e4-a52e-4f735466cecf":"2fae680e-3288-4629-86bb-634b73cf8e4d","ELEMENT":"2fae680e-3288-4629-86bb-634b73cf8e4d"}]
[HTTP] <-- POST /wd/hub/session/bdd1ef58-5efd-4a6b-bcc9-234a80cfe714/elements 200 1597 ms - 139
[HTTP] 
[HTTP] --> POST /wd/hub/session/bdd1ef58-5efd-4a6b-bcc9-234a80cfe714/elements
[HTTP] {"using":"accessibility id","value":"Map Container"}
[W3C (bdd1ef58)] Calling AppiumDriver.findElements() with args: ["accessibility id","Map Container","bdd1ef58-5efd-4a6b-bcc9-234a80cfe714"]
[BaseDriver] Valid locator strategies for this request: xpath, id, class name, accessibility id, -android uiautomator
[BaseDriver] Waiting up to 0 ms for condition
[WD Proxy] Matched '/elements' to command name 'findElements'
[WD Proxy] Proxying [POST /elements] to [POST http://localhost:8200/wd/hub/session/de8f4e88-baa6-4209-b0de-d9a0300f0065/elements] with body: {"strategy":"accessibility id","selector":"Map Container","context":"","multiple":true}
[WD Proxy] Got response with status 200: {"sessionId":"de8f4e88-baa6-4209-b0de-d9a0300f0065","status":0,"value":[{"ELEMENT":"3988e176-9405-4ad1-9dfc-fa4954d71e6c"}]}
[W3C (bdd1ef58)] Responding to client with driver.findElements() result: [{"element-6066-11e4-a52e-4f735466cecf":"3988e176-9405-4ad1-9dfc-fa4954d71e6c","ELEMENT":"3988e176-9405-4ad1-9dfc-fa4954d71e6c"}]
[HTTP] <-- POST /wd/hub/session/bdd1ef58-5efd-4a6b-bcc9-234a80cfe714/elements 200 118 ms - 139
[HTTP] 
[HTTP] --> GET /wd/hub/session/bdd1ef58-5efd-4a6b-bcc9-234a80cfe714/screenshot
[HTTP] {}
[W3C (bdd1ef58)] Calling AppiumDriver.getScreenshot() with args: ["bdd1ef58-5efd-4a6b-bcc9-234a80cfe714"]
[WD Proxy] Matched '/screenshot' to command name 'getScreenshot'
[WD Proxy] Proxying [GET /screenshot] to [GET http://localhost:8200/wd/hub/session/de8f4e88-baa6-4209-b0de-d9a0300f0065/screenshot] with no body
[WD Proxy] Got response with status 200: "{\"sessionId\":\"de8f4e88-baa6-4209-b0de-d9a0300f0065\",\"status\":0,\"value\":\"iVBORw0KGgoAAAANSUhEUgAABaAAAAoACAYAAABH9IXPAAAABHNCSVQICAgIfAhkiAAAIABJREFU\\neJzkfXmQXVdxd7\\/ZNKMZjTTaRotHO8Ky8Co5gCTjVQ5gbBMnODgEUxQGOyEkQLBDkoKwpFLgVAoX\\nRRInFW+VkGBT4A1TZUtstjG2NTIWseRFlmx5JM1oHWmkWTQzeu\\/7Q99933lnuvt09zn3zYivq1R6\\n795zuvuc08uv+725r3DrrbeWAAAKhQIAAJRKJfCpUChUXPffh0g7XjtPw59ap39dy7NUKo35X8tH\\nK2ei0UTVC6M89jLGZiYKcX6A6SpZR2gMF1+4uBRaRyhmWXlT\\/PKYL9FxvGyIs42QTtK9t\\/iUhTQx\\nOyZXpKTYvBzi514HqO56tbm\\/Wv6YQm5MPIzVOyVp80E1fLnadlNtqgb2znNOCt55npnG11LhfCmG\\nAoDgPri8QuMlOqdYozTOSe9J56ayEwvOGe\\/6wjJXErOtMTwv3atpB5hM18\\/yxCBcTTQRcpg176aI\\nKalzSmqfBdDZh0QXaX2bak2hek2an7Dx1r4CNj4kl5snuZ\\/a7qR6SHlVKxbE5pPs\\/9q1a9d+xR+A\\nveaE+HP8eRI+qUkqM6Wu3NzYPaAOMyRLeoYSfqFxeRJ2TjHrD43R7qGGMDBh4RG6ltc5SWSH5mv8\\nk2uKcfM016X3pcTZq3\\/+GluTjqVsIWQjKdbP7b3WTjQxT9I0jpVjJU0czlMPny91JnnkwbzzR7YW\\niZ1p1xy6l6ffaOfnsb\\/SfGvlLbmeJ75KSVbsmaesPHWQ8I\\/FOX7+jJVl0cfPvdZ8k0KXGNL6kcQP\\nOVwSEx8nkl8DTAx9JmIczLNeSkUpagYfu1er8YvVDtWQF7...
[W3C (bdd1ef58)] Responding to client with driver.getScreenshot() result: "iVBORw0KGgoAAAANSUhEUgAABaAAAAoACAYAAABH9IXPAAAABHNCSVQICAgIfAhkiAAAIABJREFU\neJzkfXmQXVdxd7/ZNKMZjTTaRotHO8Ky8Co5gCTjVQ5gbBMnODgEUxQGOyEkQLBDkoKwpFLgVAoX\nRRInFW+VkGBT4A1TZUtstjG2NTIWseRFlmx5JM1oHWmkWTQzeu/7Q99933lnuvt09zn3zYivq1R6\n795zuvuc08uv+725r3DrrbeWAAAKhQIAAJRKJfCpUChUXPffh0g7XjtPw59ap39dy7NUKo35X8tH\nK2ei0UTVC6M89jLGZiYKcX6A6SpZR2gMF1+4uBRaRyhmWXlT/PKYL9FxvGyIs42QTtK9t/iUhTQx\nOyZXpKTYvBzi514HqO56tbm/Wv6YQm5MPIzVOyVp80E1fLnadlNtqgb2znNOCt55npnG11LhfCmG\nAoDgPri8QuMlOqdYozTOSe9J56ayEwvOGe/6wjJXErOtMTwv3atpB5hM18/yxCBcTTQRcpg176aI\nKalzSmqfBdDZh0QXaX2bak2hek2an7Dx1r4CNj4kl5snuZ/a7qR6SHlVKxbE5pPs/9q1a9d+xR+A\nveaE+HP8eRI+qUkqM6Wu3NzYPaAOMyRLeoYSfqFxeRJ2TjHrD43R7qGGMDBh4RG6ltc5SWSH5mv8\nk2uKcfM016X3pcTZq3/+GluTjqVsIWQjKdbP7b3WTjQxT9I0jpVjJU0czlMPny91JnnkwbzzR7YW\niZ1p1xy6l6ffaOfnsb/SfGvlLbmeJ75KSVbsmaesPHWQ8I/FOX7+jJVl0cfPvdZ8k0KXGNL6kcQP\nOVwSEx8nkl8DTAx9JmIczLNeSkUpagYfu1er8YvVDtWQF7rGjeF4VMNGUtU2sfgum5/63LC9puwk\nZU7M8+w0OTYbI83FmD2k/qDBWndzPKl70uZzXnhIQiG+tWvXrv2KNPBSY/IOyCmKYWsQqRbAlybH\nvIpL97...
[HTTP] <-- GET /wd/hub/session/bdd1ef58-5efd-4a6b-bcc9-234a80cfe714/screenshot 200 1032 ms - 706156
[HTTP] 
[HTTP] --> DELETE /wd/hub/session/bdd1ef58-5efd-4a6b-bcc9-234a80cfe714
[HTTP] {}
[W3C (bdd1ef58)] Calling AppiumDriver.deleteSession() with args: ["bdd1ef58-5efd-4a6b-bcc9-234a80cfe714"]
[BaseDriver] Event 'quitSessionRequested' logged at 1565874979032 (16:16:19 GMT+0300 (Беларусь (зима)))
[Appium] Removing session bdd1ef58-5efd-4a6b-bcc9-234a80cfe714 from our master session list
[UiAutomator2] Deleting UiAutomator2 session
[UiAutomator2] Deleting UiAutomator2 server session
[WD Proxy] Matched '/' to command name 'deleteSession'
[WD Proxy] Proxying [DELETE /] to [DELETE http://localhost:8200/wd/hub/session/de8f4e88-baa6-4209-b0de-d9a0300f0065] with no body
[WD Proxy] Got response with status 200: "{\"sessionId\":\"de8f4e88-baa6-4209-b0de-d9a0300f0065\",\"status\":0,\"value\":\"Session deleted\"}"
[ADB] Running 'c:\Users\User\AppData\Local\Android\Sdk\platform-tools\adb.exe -P 5037 -s emulator-5554 shell am force-stop com.myapp'
[Instrumentation] .
[Logcat] Stopping logcat capture
serhatbolsu commented 4 years ago

@NeliHarbuzava thank you for report.

Zoom and pinch implementations are removed from python-client of Appium. These actions needs to be implemented using chaining the press's. However this needs to be implemented to robotframework-appiumlibrary. Feel free to open a PR if you have a solution

serhatbolsu commented 1 year ago

New ActionHelpers methods added in #363 , feel free to add others