test is failing selenium.common.exceptions.WebDriverException: Message: Failed to locate opened application window with appId:
See original GitHub issueHi all, I started having this problem when the driver fails to interact with the app actually its an RDP i am trying to automate the RDP file is opening successfully but not able to click or interact with the RDP like clicking on connect button doesnt work
below is the code
`import unittest from time import sleep
from appium import webdriver from appium.webdriver.extensions import session
class SimpleCalculatorTests(unittest.TestCase):
@classmethod
def setUpClass(self):
# set up appium
desired_caps = {}
desired_caps["app"] = r"C:\jtracker\jailtracker.rdp"
self.driver = webdriver.Remote(
command_executor='http://127.0.0.1:4723',
desired_capabilities=desired_caps)
@classmethod
def tearDownClass(self):
self.driver.quit()
def test_addition(self):
self.driver.find_element_by_xpath("/Button[@ClassName=\"Button\"][@Name=\"Connect\"]").click()
sleep(5)
if name == ‘main’: suite = unittest.TestLoader().loadTestsFromTestCase(SimpleCalculatorTests) unittest.TextTestRunner(verbosity=2).run(suite)
`
below is the error i m getting i console
Failure Traceback (most recent call last): File “C:\Program Files\Python374\lib\unittest\suite.py”, line 163, in _handleClassSetUp setUpClass() File “C:\Users\VellaSR\PycharmProjects\JTracker\launchJtracker.py”, line 17, in setUpClass desired_capabilities=desired_caps) File “C:\Users\VellaSR\PycharmProjects\JTracker\venv\lib\site-packages\appium\webdriver\webdriver.py”, line 156, in init AppiumConnection(command_executor, keep_alive=keep_alive), desired_capabilities, browser_profile, proxy File “C:\Users\VellaSR\PycharmProjects\JTracker\venv\lib\site-packages\selenium\webdriver\remote\webdriver.py”, line 157, in init self.start_session(capabilities, browser_profile) File “C:\Users\VellaSR\PycharmProjects\JTracker\venv\lib\site-packages\appium\webdriver\webdriver.py”, line 225, in start_session response = self.execute(RemoteCommand.NEW_SESSION, parameters) File “C:\Users\VellaSR\PycharmProjects\JTracker\venv\lib\site-packages\selenium\webdriver\remote\webdriver.py”, line 321, in execute self.error_handler.check_response(response) File “C:\Users\VellaSR\PycharmProjects\JTracker\venv\lib\site-packages\selenium\webdriver\remote\errorhandler.py”, line 242, in check_response raise exception_class(message, screen, stacktrace) selenium.common.exceptions.WebDriverException: Message: Failed to locate opened application window with appId: C:\jtracker\jailtracker.rdp, and processId: 3488
C:\Program Files\Python374\lib\unittest\suite.py:170: ResourceWarning: unclosed <socket.socket fd=580, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=0, laddr=(‘127.0.0.1’, 59865), raddr=(‘127.0.0.1’, 4723)> self._addClassOrModuleLevelException(result, e, errorName) ResourceWarning: Enable tracemalloc to get the object allocation traceback
Ran 0 tests in 3.503s
FAILED (errors=1)
Process finished with exit code 1
Issue Analytics
- State:
- Created 2 years ago
- Comments:9
Top GitHub Comments
Hi @nabilalakhani It looks, you are using desktop session directly to control the application. yes, it is slow with xpath or other types of identifiers as well.
I would suggest using desktop session for taking access to the application only, not to control the application. Use this feature to control already opened application through the desktop session. It will not be slow with xpath or any other element identifier.
Try to use this code to get access to the application
There is a known issue with slowness with xpath, better use some other method to locate elements.