Skip to content

Commit d3e5285

Browse files
authored
Merge pull request #13 from qa-dev/locator-as-string
element types as strings instead of ids
2 parents e8e2588 + 216eee7 commit d3e5285

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

WebDriverAgentLib/Categories/XCUIElement+AVFind.m

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
#import "XCUIElement+AVFind.h"
1212

1313
#import "XCUIElement+FBWebDriverAttributes.h"
14+
#import "FBElementTypeTransformer.h"
1415

1516
@implementation XCUIElement (FBFind)
1617

@@ -23,7 +24,7 @@ @implementation XCUIElement (FBFind)
2324
NSArray *tokens = [self av_parseLocator:locator];
2425
NSError *error = nil;
2526
// Создаем регулярку для парсинга одной части локатора.
26-
NSRegularExpression *regex = [NSRegularExpression regularExpressionWithPattern:@"^(\\.{0,1})([0-9\\*]*)(\\(.+\\))*(\\[[0-9a-z]+\\]){0,1}$" options:NSRegularExpressionCaseInsensitive error:&error];
27+
NSRegularExpression *regex = [NSRegularExpression regularExpressionWithPattern:@"^(\\.{0,1})([A-Za-z\\*]*)(\\(.+\\))*(\\[[0-9a-z]+\\]){0,1}$" options:NSRegularExpressionCaseInsensitive error:&error];
2728

2829
__block XCUIElement *currentElement = self;
2930
__block NSArray<XCUIElement *> *currentElements;
@@ -72,7 +73,9 @@ -(XCUIElementQuery *)av_getQueryByType:(NSTextCheckingResult *)regRes locator: (
7273
if ([type isEqualToString:@"*"]) {
7374
elementType = XCUIElementTypeAny;
7475
} else {
75-
elementType = [type intValue];
76+
NSString *typeName = [@"XCUIElementType" stringByAppendingString:type];
77+
elementType = [FBElementTypeTransformer elementTypeWithTypeName:typeName];
78+
// elementType = [type intValue];
7679
}
7780

7881
// Если в начале стоит точка, то мы берем ребенка, если нет, то потомка.

0 commit comments

Comments
 (0)