You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Searches for an element that matches the input criteria and gets the element's value for a specified attribute.
544
+
545
+
546
+
```swift
547
+
funcGetAttributeOfElement(
548
+
elementRole: String="",
549
+
elementOverallDescription: String="",
550
+
attribute: String="",
551
+
threshold: Double=0.75,
552
+
root: UIElement?=nil,
553
+
spatialRelation: String="",
554
+
anchorRole: String="",
555
+
anchorOverallDescription: String="",
556
+
anchorElements: [UIElement] = [],
557
+
horizontalRank: Int?=nil,
558
+
verticalRank: Int?=nil
559
+
) ->String
560
+
```
561
+
562
+
## Parameters
563
+
564
+
### elementRole
565
+
Role of the target element. Required if elementOverallDescription is not given.
566
+
567
+
### elementOverallDescription
568
+
Description of the element. Required if elementRoles are not provided.
569
+
570
+
### attribute
571
+
Valid options are: "role", "description", "title", "value". For example, use "value" to get the value of text elements.
572
+
573
+
### threshold
574
+
If `elementOverallDescription` is given, then accept candidate elements whose normalized string similarity with `elementOverallDescription` is above this threshold value.
575
+
576
+
### root
577
+
If given, then the search is limited to elements contained within this root element.
578
+
579
+
### spatialRelation
580
+
A comma-separated String of spatial relationships between the target elements and the anchor.
581
+
582
+
### anchorRole
583
+
Role of element(s) used as anchor for spatial relation.
584
+
585
+
### anchorOverallDescription
586
+
Description of an object used as an anchor with spatialRelation.
587
+
588
+
### anchorElements
589
+
Elements to use as anchor for spatial relation constraints. If `anchorElements` is provided, then anchorRole and anchorOverallDescription are ignored.
590
+
591
+
### horizontalRank
592
+
If given, sorts the elements by x-coordinate of frame midpoint and returns the element with this rank. Left-most element has rank 1.
593
+
594
+
### verticalRank
595
+
If given, sorts the elements by y-coordinate of frame midpoint and returns the element with this rank. Top-most element has rank 1.
596
+
597
+
598
+
## Return Value
599
+
600
+
String value of an attribute of an element
601
+
602
+
## Discussion
603
+
604
+
Examples:
605
+
606
+
- Instruction: Get the value of the radioButton element with description "radioButton tab point & click"
607
+
```swift
608
+
var value =GetAttributeOfElement(elementRole: "radioButton", elementOverallDescription: "radioButton tab point & click", attribute: "value")
609
+
```
610
+
- Instruction: Get the value of the valueIndicator element closest to and on the right of "statictext text double-click speed"
611
+
```swift
612
+
var value =GetAttributeOfElement(elementRole: "valueIndicator", attribute: "value", spatialRelation: "closest,right", anchorOverallDescription: "statictext text double-click speed")
613
+
```
614
+
615
+
616
+
617
+
# Respond(_:requireConfirm)
541
618
542
619
543
620
Respond to the user with a message and optionally ask for user confirmation to proceed.
0 commit comments