Skip to content

Commit e56a6a0

Browse files
Alvaro LasernaAlvaro Laserna
authored andcommitted
check appium is greater or equal than 2
1 parent 44d4d3c commit e56a6a0

1 file changed

Lines changed: 8 additions & 3 deletions

File tree

testui/support/appium_driver.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -580,9 +580,14 @@ def __local_run(url, desired_caps, use_port, udid, log_file):
580580
# Check Appium Version
581581
result = subprocess.run(["appium", "-v"], stdout=subprocess.PIPE).stdout
582582
url = f"http://localhost:{str(port)}/wd/hub"
583-
if result.decode('utf-8').startswith("2."):
584-
# for Appium version > 2.0.0
585-
url = f"http://localhost:{str(port)}"
583+
result_text = result.decode('utf-8').strip()
584+
try:
585+
major = int(result_text.split('.')[0])
586+
except (ValueError, IndexError):
587+
major = 0
588+
if major >= 2:
589+
# for Appium version >= 2.0.0
590+
url = f"http://localhost:{port}"
586591
return url, desired_caps, process, file_path
587592

588593
return url, desired_caps, None, None

0 commit comments

Comments
 (0)