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

how can I find the component after multi App is launch #285

Open
HaoWShi opened this issue Feb 29, 2024 · 3 comments
Open

how can I find the component after multi App is launch #285

HaoWShi opened this issue Feb 29, 2024 · 3 comments

Comments

@HaoWShi
Copy link

HaoWShi commented Feb 29, 2024

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

@KazuCocoa
Copy link
Member

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.

@HaoWShi
Copy link
Author

HaoWShi commented Mar 2, 2024

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
Copy link
Author

HaoWShi commented Mar 2, 2024

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?

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

No branches or pull requests

2 participants