appium-mac2-driver icon indicating copy to clipboard operation
appium-mac2-driver copied to clipboard

how can I find the component after multi App is launch

Open HaoWShi opened this issue 11 months ago • 3 comments

In my scenario, I need to open different apps, such as settings and notes, then I will find and click on the component in settings, and then go to notes to find and click on the component. I found some the question, When I launchApp settings firstly, and launchApp notes secondly, I can find component of notes, but can not find component of setting even if setting ui is visible on the screen

HaoWShi avatar Feb 29 '24 14:02 HaoWShi

Does the page source shows the most front app only? this driver depends on XCTest framework. I wonder if the XCTest framework can find elements/interact with elements that is on the top. Coordinate-based interaction would work for all cases, though.

KazuCocoa avatar Mar 01 '24 09:03 KazuCocoa

this is my test demo def test_startMultiApp(driver): time.sleep(2) driver.execute_script('macos: terminateApp', { 'bundleId': 'com.apple.systempreferences' }) time.sleep(2) driver.execute_script('macos: terminateApp', { 'bundleId': 'com.apple.iCal' }) time.sleep(2) driver.execute_script('macos: launchApp', { 'bundleId': 'com.apple.systempreferences' }) time.sleep(2) sourceSetting = driver.page_source file = open("launchSetting.txt", "w", encoding='utf-8') file.write(sourceSetting) file.close() # find notify notify = driver.find_element(by=AppiumBy.IOS_PREDICATE, value='value=="通知" and elementType==48') time.sleep(2) driver.execute_script('macos: launchApp', { 'bundleId': 'com.apple.iCal' }) time.sleep(2) sourceSetting2 = driver.page_source file2 = open("launchSettingAndiCal.txt", "w", encoding='utf-8') file2.write(sourceSetting2) file2.close() week = driver.find_element(by=AppiumBy.IOS_PREDICATE, value='label=="周" and elementType==10') time.sleep(2) notify = driver.find_element(by=AppiumBy.IOS_PREDICATE, value='value=="通知" and elementType==48') time.sleep(2)

I add source and appium log appiumLog.txt launchSetting.txt launchSettingAndiCal.txt

HaoWShi avatar Mar 02 '24 02:03 HaoWShi

I think I get some advice form this: https://discuss.appium.io/t/trying-to-work-with-2-drivers-at-a-time-for-macos-application/41797 But I have a question now, If I call launchAPP or activeApp repeatedly, what is the error code? Is this a recommended procedure?

HaoWShi avatar Mar 02 '24 03:03 HaoWShi