Skip to content

Commit

Permalink
chore: Simplify the logic of alert element detection (#851)
Browse files Browse the repository at this point in the history
  • Loading branch information
mykola-mokhnach committed Feb 21, 2024
1 parent 77aeef7 commit 54f91f1
Showing 1 changed file with 1 addition and 10 deletions.
11 changes: 1 addition & 10 deletions WebDriverAgentLib/FBAlert.m
Original file line number Diff line number Diff line change
Expand Up @@ -261,16 +261,7 @@ - (BOOL)clickAlertButton:(NSString *)label error:(NSError **)error
- (XCUIElement *)alertElement
{
if (nil == self.element) {
self.element = self.application.fb_alertElement;
if (nil == self.element) {
XCUIApplication *systemApp = XCUIApplication.fb_systemApplication;
for (XCUIApplication *activeApp in XCUIApplication.fb_activeApplications) {
if (systemApp.processID == activeApp.processID) {
self.element = activeApp.fb_alertElement;
break;
}
}
}
self.element = XCUIApplication.fb_systemApplication.fb_alertElement ?: self.application.fb_alertElement;
}
return self.element;
}
Expand Down

0 comments on commit 54f91f1

Please sign in to comment.