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

AfM Unable to find elements, even with simple examples #101

Open
aofl-esd opened this issue Sep 19, 2020 · 2 comments
Open

AfM Unable to find elements, even with simple examples #101

aofl-esd opened this issue Sep 19, 2020 · 2 comments

Comments

@aofl-esd
Copy link

I've been unable to get appium for mac to find elements. I created a simplified version of the textedit example:

from selenium import webdriver
import time

caps = {
    'platformName': 'Mac',
    'deviceName': 'Mac',
    'app': 'TextEdit'
}
driver = webdriver.Remote('http://localhost:4622/wd/hub', desired_capabilities=caps)

driver.get('TextEdit')
time.sleep(5)

try:
    window = driver.find_element_by_xpath("/AXApplication[@AXTitle='TextEdit']/AXWindow[0]")
finally:
    driver.quit()

The resulting error is: selenium.common.exceptions.NoSuchElementException: Message: An element could not be located on the page using the given search parameters.

In xcode, this is the console result from appium for mac:

2020-09-18 18:16:39.248971-0700 AppiumForMac[87822:1290991] Metal API Validation Enabled
2020-09-18 18:16:39:341 AppiumForMac[87822:307] HTTPServer: Started HTTP server on port 4622
=================================================================
Main Thread Checker: UI API called on a background thread: -[NSApplication delegate]
PID: 87822, TID: 1291775, Thread name: (none), Queue name: HTTPConnection, QoS: 0
Backtrace:
4   AppiumForMac                        0x000000010005f461 -[AfMHTTPConnection httpResponseForMethod:URI:] + 289
5   AppiumForMac                        0x0000000100017525 -[HTTPConnection replyToHTTPRequest] + 997
6   AppiumForMac                        0x000000010001c87c -[HTTPConnection socket:didReadData:withTag:] + 4828
7   AppiumForMac                        0x000000010003eddd __37-[GCDAsyncSocket completeCurrentRead]_block_invoke + 77
8   libdispatch.dylib                   0x00000001004aa844 _dispatch_call_block_and_release + 12
9   libdispatch.dylib                   0x00000001004ab826 _dispatch_client_callout + 8
10  libdispatch.dylib                   0x00000001004b2dd7 _dispatch_lane_serial_drain + 777
11  libdispatch.dylib                   0x00000001004b3b90 _dispatch_lane_invoke + 438
12  libdispatch.dylib                   0x00000001004c0fe0 _dispatch_workloop_worker_thread + 691
13  libsystem_pthread.dylib             0x0000000100539361 _pthread_wqthread + 290
14  libsystem_pthread.dylib             0x000000010053849b start_wqthread + 15
2020-09-18 18:17:29.360729-0700 AppiumForMac[87822:1291775] [reports] Main Thread Checker: UI API called on a background thread: -[NSApplication delegate]
PID: 87822, TID: 1291775, Thread name: (none), Queue name: HTTPConnection, QoS: 0
Backtrace:
4   AppiumForMac                        0x000000010005f461 -[AfMHTTPConnection httpResponseForMethod:URI:] + 289
5   AppiumForMac                        0x0000000100017525 -[HTTPConnection replyToHTTPRequest] + 997
6   AppiumForMac                        0x000000010001c87c -[HTTPConnection socket:didReadData:withTag:] + 4828
7   AppiumForMac                        0x000000010003eddd __37-[GCDAsyncSocket completeCurrentRead]_block_invoke + 77
8   libdispatch.dylib                   0x00000001004aa844 _dispatch_call_block_and_release + 12
9   libdispatch.dylib                   0x00000001004ab826 _dispatch_client_callout + 8
10  libdispatch.dylib                   0x00000001004b2dd7 _dispatch_lane_serial_drain + 777
11  libdispatch.dylib                   0x00000001004b3b90 _dispatch_lane_invoke + 438
12  libdispatch.dylib                   0x00000001004c0fe0 _dispatch_workloop_worker_thread + 691
13  libsystem_pthread.dylib             0x0000000100539361 _pthread_wqthread + 290
14  libsystem_pthread.dylib             0x000000010053849b start_wqthread + 15
2020-09-18 18:17:35.599582-0700 AppiumForMac[87822:1291425] 


************* findAllUsingAbsoluteAXPath: /AXApplication[@AXTitle='TextEdit']/AXWindow[0]
2020-09-18 18:17:35.599739-0700 AppiumForMac[87822:1291425] axPathComponents:(
    "AXApplication[@AXTitle='TextEdit']",
    "AXWindow[0]"
)
2020-09-18 18:17:35.660471-0700 AppiumForMac[87822:1291425] 
************* findAllUsingAbsoluteAXPath matchedNodes:(
)
@murali238
Copy link

I too facing the same issue. Absolute AXPaths are not working anymore.

@Rup1
Copy link

Rup1 commented Nov 6, 2020

@aofl-esd That doesn't look like a full xpath, you need to use the full expath. hover over the element you're trying to access and click the fn button. This will copy the full xpath to the clipboard and you can then paste it in your code.

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