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

Process is not getting terminating if driver.findElement not able to fine the element. #34

Open
gopi-chand opened this issue Jul 29, 2022 · 5 comments

Comments

@gopi-chand
Copy link

gopi-chand commented Jul 29, 2022

Have following setup :
[email protected]
Appium (v2.0.0-beta.40)
Appium-Python-Client 2.6.0

Have following code:
from appium import webdriver
from selenium.webdriver.common.by import By
import time

driver = webdriver.Remote(
command_executor='http://127.0.0.1:4723',
desired_capabilities={
'appPackage': 'appPackage',
'automationName': 'TizenTV',
"platformName": "TizenTV",
'deviceAddress': 'IP Address'
'deviceMac': 'Mac Address',
'chromedriverExecutable': 'Path to driver ',
'deviceName': 'device unique number ',
'udid': 'IP and Port',
'app': 'app location ',

})

print("The current app title:", driver.title)

print("Press DOWN", driver.press_keycode("DOWN"))
print("Check main app frame is enabled:",driver.find_element(By.ID, "appFrame4").is_enabled())

print("The current app title:", driver.title)
print("Press DOWN", driver.press_keycode("DOWN"))
print("Check main app frame is enabled:",driver.find_element(By.ID, "appFrame4").is_enabled())

Issue :

Program execution stuck at 'print("Check main app frame is enabled:",driver.find_element(By.ID, "appFrame4").is_enabled())' this step and it is going to freeze state forever.

Since appFrame4 element is not presented and appium server is not giving any error to tizenTV driver so program is going for freeze state.

Appium server logs :
Administrators-MacBook-Pro:1 username$ appium
WARN Appium Appium encountered 2 warnings while validating drivers found in manifest /Users/username/.appium/node_modules/.cache/appium/extensions.yaml
WARN Appium Driver "tizentv" has 1 potential problem:
WARN Appium - Driver "tizentv" (package appium-tizen-tv-driver) may be incompatible with the current version of Appium (v2.0.0-beta.40) due to an invalid or missing peer dependency on Appium. Please ask the developer of appium-tizen-tv-driver to add a peer dependency on ^[email protected].
[Appium] Welcome to Appium v2.0.0-beta.40
[Appium] Attempting to load driver tizentv...
[debug] [Appium] Requiring driver at /Users/username/.appium/node_modules/appium-tizen-tv-driver
[Appium] Attempting to load driver xcuitest...
[debug] [Appium] Requiring driver at /Users/username/.appium/node_modules/appium-xcuitest-driver
[Appium] Appium REST http interface listener started on 0.0.0.0:4723
[Appium] Available drivers:
[Appium] - [email protected] (automationName 'TizenTV')
[Appium] - [email protected] (automationName 'XCUITest')
[Appium] Available plugins:
[Appium] - [email protected]
[Appium] No plugins activated. Use the --use-plugins flag with names of plugins to activate
[HTTP] --> POST /session
[HTTP] {"capabilities":............
[debug] [AppiumDriver@029d] Calling AppiumDriver.createSession() with args: [.............
[debug] [AppiumDriver@029d] Event 'newSessionRequested' logged at 1659104549605 (19:52:29 GMT+0530 (India Standard Time))
[Appium] Attempting to find matching driver for automationName 'TizenTV' and platformName 'TizenTV'
[Appium] The 'tizentv' driver was installed and matched caps.
[Appium] Will require it at /Users/username/.appium/node_modules/appium-tizen-tv-driver
[debug] [Appium] Requiring driver at /Users/username/.appium/node_modules/appium-tizen-tv-driver
[AppiumDriver@029d] Appium v2.0.0-beta.40 creating new TizenTVDriver (v0.3.0) session
[AppiumDriver@029d] Checking BaseDriver versions for Appium and TizenTVDriver
[AppiumDriver@029d] Appium's BaseDriver version is 8.5.7
[AppiumDriver@029d] TizenTVDriver's BaseDriver version is 8.0.0-beta.6
[BaseDriver] Appium received (M)JSONWP desired capabilities in alongside the W3C capabilities; they will be ignored
[debug] [BaseDriver] Creating session with W3C capabilities: {
[debug] [BaseDriver] "alwaysMatch": {
[debug] [BaseDriver] "platformName": "TizenappPackageTV",
[debug] [BaseDriver] "appium:appPackage": "",
[debug] [BaseDriver] "appium:automationName": "TizenTV",
[debug] [BaseDriver] "appium:deviceAddress": "IP",
[debug] [BaseDriver] "appium:deviceMac": "MAC",
[debug] [BaseDriver] "appium:chromedriverExecutable": "/Users/username/Desktop/1/chromedriver",
[debug] [BaseDriver] "appium:deviceName": "DeviceName",
[debug] [BaseDriver] "appium:udid": "IP",
[debug] [BaseDriver] "appium:app": "/projects",
[debug] [BaseDriver] "appium:rcPairingMode": "true"
[debug] [BaseDriver] },
[debug] [BaseDriver] "firstMatch": [
[debug] [BaseDriver] {}
[debug] [BaseDriver] ]
[debug] [BaseDriver] }
[BaseDriver] Session created with session id: 4d8c4dba-072c-46bc-a517-94764e32c342
[TizenTVDriver] Uninstalling tizen app 'packageName' on device 'IP'
[TizenTVDriver] Attempting to verify location of the 'tizen' binary
[TizenTVDriver] Binary was found at /Users/username/tizen-studio/tools/ide/bin/tizen
[TizenTVDriver] Running command: /Users/username/tizen-studio/tools/ide/bin/tizen uninstall -p packageName -s IP
[TizenTVDriver] Installing tizen app '/projects/ path on device 'IP'
[TizenTVDriver] Running command: /Users/username/tizen-studio/tools/ide/bin/tizen install -n /projects/ -s IP
[TizenTVDriver] Starting packageName in debug mode on IP
[TizenTVDriver] Attempting to verify location of the 'sdb' binary
[TizenTVDriver] Binary was found at /Users/username/tizen-studio/tools/sdb
[TizenTVDriver] Running command: /Users/username/tizen-studio/tools/sdb -s IP shell 0 debug packageName
[TizenTVDriver] Debug port opened on 53224
[TizenTVDriver] Chose local port 8001 for remote debug communication
[TizenTVDriver] Forwarding local TCP port 8001 to port 53224 on device IP
[TizenTVDriver] Running command: /Users/username/tizen-studio/tools/sdb -s 1 IP forward tcp:8001 tcp:53224
[debug] [Chromedriver] Changed state to 'starting'
[Chromedriver] Set chromedriver binary as: /Users/username/Desktop/1/chromedriver
[debug] [Chromedriver] Killing any old chromedrivers, running: pkill -15 -f "/Users/username/Desktop//1/chromedriver.*--port=8002"
[Chromedriver] No old chromedrivers seem to exist
[Chromedriver] Spawning chromedriver with: /Users/username/Desktop//1/chromedriver --url-base=wd/hub --port=8002 --verbose
[debug] [Chromedriver] Chromedriver version: '2.36.540469'
[debug] [Chromedriver] Chromedriver v. 2.36.540469 does not fully support W3C protocol. Defaulting to MJSONWP
[debug] [WD Proxy] Matched '/status' to command name 'getStatus'
[debug] [WD Proxy] Proxying [GET /status] to [GET http://127.0.0.1:8002/wd/hub/status] with no body
[debug] [WD Proxy] Got response with status 200: {"sessionId":"","status":0,"value":{"build":{"version":"alpha"},"os":{"arch":"x86_64","name":"Mac OS X","version":"10.16.0"}}}
[Chromedriver] Starting MJSONWP Chromedriver session with capabilities: {
[Chromedriver] "desiredCapabilities": {
[Chromedriver] "goog:chromeOptions": {
[Chromedriver] "debuggerAddress": "127.0.0.1:8001"
[Chromedriver] },
[Chromedriver] "loggingPrefs": {
[Chromedriver] "browser": "ALL"
[Chromedriver] }
[Chromedriver] }
[Chromedriver] }
[debug] [WD Proxy] Matched '/session' to command name 'createSession'
[debug] [WD Proxy] Proxying [POST /session] to [POST http://127.0.0.1:8002/wd/hub/session] with body: {"desiredCapabilities":{"goog:chromeOptions":{"debuggerAddress":"127.0.0.1:8001"},"loggingPrefs":{"browser":"ALL"}}}
[debug] [Chromedriver] Webview version: 'Chrome/76.0.3809.146'
[debug] [WD Proxy] Got response with status 200: {"sessionId":"f95ceb63174ea90079e72eec3f4bd187","status":0,"value":{"acceptInsecureCerts":false,"acceptSslCerts":false,"applicationCacheEnabled":false,"browserConnectionEnabled":false,"browserName":"chrome","chrome":{"chromedriverVersion":"2.36.540469 (1881fd7f8641508feb5166b7cae561d87723cfa8)"},"cssSelectorsEnabled":true,"databaseEnabled":false,"handlesAlerts":true,"hasTouchScreen":false,"javascriptEnabled":true,"locationContextEnabled":true,"mobileEmulationEnabled":false,"nativeEvents":true,"pageLoadStrategy":"normal","platform":"","rotatable":false,"setWindowRect":false,"takesHeapSnapshot":true,"takesScreenshot":true,"unexpectedAlertBehaviour":"","version":"76.0.3809.146","webStorageEnabled":true}}
[WD Proxy] Determined the downstream protocol as 'MJSONWP'
[debug] [Chromedriver] Changed state to 'online'
[TizenTVDriver] Waiting for app launch to take effect
[TizenTVDriver] Clearing app local storage
[debug] [WD Proxy] Matched '/execute/sync' to command name 'execute'
[Protocol Converter] Rewrote the original URL '/execute/sync' to '/execute' for MJSONWP protocol
[debug] [WD Proxy] Proxying [POST /execute] to [POST http://127.0.0.1:8002/wd/hub/session/f95ceb63174ea90079e72eec3f4bd187/execute] with body: {"script":"window.localStorage.clear()","args":[]}
[debug] [WD Proxy] Got response with status 200: {"sessionId":"f95ceb63174ea90079e72eec3f4bd187","status":0,"value":null}
[TizenTVDriver] Reloading page
[debug] [WD Proxy] Matched '/execute/sync' to command name 'execute'
[Protocol Converter] Rewrote the original URL '/execute/sync' to '/execute' for MJSONWP protocol
[debug] [WD Proxy] Proxying [POST /execute] to [POST http://127.0.0.1:8002/wd/hub/session/f95ceb63174ea90079e72eec3f4bd187/execute] with body: {"script":"window.location.reload()","args":[]}
[debug] [WD Proxy] Got response with status 200: {"sessionId":"f95ceb63174ea90079e72eec3f4bd187","status":0,"value":null}
[AppiumDriver@029d] New TizenTVDriver session created successfully, session 4d8c4dba-072c-46bc-a517-94764e32c342 added to master session list
[debug] [AppiumDriver@029d] Event 'newSessionStarted' logged at 1659104573482 (19:52:53 GMT+0530 (India Standard Time))
[debug] [TizenTVDriver@4d7f219f (4d8c4dba)] Cached the protocol value 'W3C' for the new session 4d8c4dba-072c-46bc-a517-94764e32c342
[debug] [TizenTVDriver@4d7f219f (4d8c4dba)] Responding to client with driver.createSession() result: {"....."
[HTTP] <-- POST /session 200 23883 ms - 480
[HTTP]
[HTTP] --> GET /session/4d8c4dba-072c-46bc-a517-94764e32c342/title
[HTTP] {}
[TizenTVDriver@4d7f219f (4d8c4dba)] Driver proxy active, passing request on via HTTP proxy
[debug] [WD Proxy] Matched '/session/4d8c4dba-072c-46bc-a517-94764e32c342/title' to command name 'title'
[debug] [WD Proxy] Proxying [GET /session/4d8c4dba-072c-46bc-a517-94764e32c342/title] to [GET http://127.0.0.1:8002/wd/hub/session/f95ceb63174ea90079e72eec3f4bd187/title] with no body
[debug] [WD Proxy] Got response with status 200: {"sessionId":"f95ceb63174ea90079e72eec3f4bd187","status":0,"value":"project on Tizen"}
[WD Proxy] Replacing sessionId f95ceb63174ea90079e72eec3f4bd187 with 4d8c4dba-072c-46bc-a517-94764e32c34
[HTTP] <-- GET /session/4d8c4dba-072c-46bc-a517-94764e32c342/title 200 41 ms - 89
[HTTP]
[HTTP] --> POST /session/4d8c4dba-072c-46bc-a517-94764e32c342/element
[HTTP] {"using":"id","value":"appFrame4"}
[TizenTVDriver@4d7f219f (4d8c4dba)] Driver proxy active, passing request on via HTTP proxy
[debug] [WD Proxy] Matched '/session/4d8c4dba-072c-46bc-a517-94764e32c342/element' to command name 'findElement'
[debug] [WD Proxy] Proxying [POST /session/4d8c4dba-072c-46bc-a517-94764e32c342/element] to [POST http://127.0.0.1:8002/wd/hub/session/f95ceb63174ea90079e72eec3f4bd187/element] with body: {"using":"id","value":"appFrame4"}
[debug] [WD Proxy] Got response with status 200: {"sessionId":"f95ceb63174ea90079e72eec3f4bd187","status":7,"value":{"message":"no such element: Unable to locate element: {"method":"id","selector":"appFrame4"}\n (Session info: chrome=76.0.3809.146)\n (Driver info: chromedriver=2.36.540469 (1881fd7f8641508feb5166b7cae561d87723cfa8),platform=Mac OS X 10.16.0 x86_64)"}}

@jlipps
Copy link
Collaborator

jlipps commented Aug 2, 2022

Yeah, I've noticed that several chromedriver commands seem to freeze the app entirely, for example get screenshot. I am not sure what the underlying issue would be. does any newer version of chromedriver work?

@artrurkovalenkotivo
Copy link

We tried these versions:
chromedriver 2.38
chromedriver 2.43
chromedriver 2.44

newer versions dont work

Stacktrace:
UnknownError: An unknown server-side error occurred while processing the command. Original error: An unknown server-side error occurred while processing the command. Original error: unknown error: cannot connect to chrome at 127.0.0.1:8000
from session not created: This version of ChromeDriver only supports Chrome version 78

When the driver hangs we are seeing this log:

[TizenTVDriver@d1406055 (088cdd46)] Driver proxy active, passing request on via HTTP proxy
[debug] [WD Proxy] Matched '/session/088cdd46-f51d-40ca-8ad6-f6a584227c17/element' to command name 'findElement'
[debug] [WD Proxy] Proxying [POST /session/088cdd46-f51d-40ca-8ad6-f6a584227c17/element] to [POST http://127.0.0.1:8003/wd/hub/session/5b51e75b0949f7f05efe4e9f9e16bc00/element] with body: {"using":"id","value":"appFramde"}
[debug] [WD Proxy] Got response with status 200: {"sessionId":"5b51e75b0949f7f05efe4e9f9e16bc00","status":7,"value":{"message":"no such element: Unable to locate element: {\"method\":\"id\",\"selector\":\"appFramde\"}\n  (Session info: chrome=69.0.3497.128)\n  (Driver info: chromedriver=2.44.609551 (5d576e9a44fe4c5b6a07e568f1ebc753f1214634),platform=Linux 5.4.0-122-generic x86_64)"}}

this line throws error as "status":7
https://github.com/appium/appium/blob/master/packages/base-driver/lib/jsonwp-proxy/proxy.js#L252

@jlipps
Copy link
Collaborator

jlipps commented Aug 18, 2022

hmm, strange then that you don't see any error in the logs after that?

@artrurkovalenkotivo
Copy link

after that, I don't see any errors/logs - the session hangs out.

@jlipps
Copy link
Collaborator

jlipps commented Aug 22, 2022

ok. this may be a bug in our proxy implementation. the fact that no error is logged suggests that the proxy method may be called by a routine which is swallowing the error instead of allowing it to bubble up. i don't think the bug would be in the tizen driver repo, but it might be in the appium-chromedriver code or the jwproxy jcode. i'll keep this issue open so we can investigate.

cc @boneskull

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants