grant_volker_2
13 years agoContributor
Possible to decouple the object search from CSS, HTML and property changes?
Hi,
I work in an Agile environment and the properties of some objects get changed during sprints, for example a link's tagName might
change from LI to A (and I think even formatting such as H1 or BOLD)!
I've also experienced circumstances where objects such as combo-boxes and text boxes have no label applied until the CSS styling
is implemented in a later sprint and a Name such as Textbox(0) or ObjectIdentifier of 0 aren't much help at all.
There's little if any communication from the developers about these changes, so I have applied an approach that can be fairly
easily adapted to search for various properties, but this is becoming manually intensive. (Please see the code below).
Is there a method that someone can suggest to decouple the object search from CSS, HTML and property changes please?
Thank you
Set objObjectToStartFrom = objPage
arrProperty(0) = "tagName"
arrProperty(1) = "contentText"
arrValue(1) = "Visit W3Schools.com!"
intDepthOfSearch = 12
clkStopTime = GetTickCount() + 30000
On Error Resume Next
Do While GetTickCount() < clkStopTime
arrValue(0) = "LI" 'try for this obect type
Set objLink = objObjectToStartFrom.NativeWebObject.Find(arrProperty(1), arrValue(1), arrValue(0))
If Err.Number <> 0 Then
Log.Warning Err.Description & " when attempting to set object " & arrValue(0), pmNormal
On Error Goto 0
Err.Clear
Exit Function
End If
If objLink.Exists Then
Log.Checkpoint "Object found: " & arrValue(0), "", pmNormal
Exit Do
Else
arrValue(0) = "A" 'if the TextNode was not found then try this object type
Set objLink = objObjectToStartFrom.NativeWebObject.Find(arrProperty(1), arrValue(1), arrValue(0))
If objLink.Exists Then
Log.Checkpoint "Object found: " & arrValue(0), "", pmNormal
Exit Do
End If
End If
aqUtils.Delay(100)
Loop
If Err.Number <> 0 Then
Log.Warning Err.Description, pmNormal
On Error Goto 0
Err.Clear
Exit Function
End If
On Error Goto 0
I work in an Agile environment and the properties of some objects get changed during sprints, for example a link's tagName might
change from LI to A (and I think even formatting such as H1 or BOLD)!
I've also experienced circumstances where objects such as combo-boxes and text boxes have no label applied until the CSS styling
is implemented in a later sprint and a Name such as Textbox(0) or ObjectIdentifier of 0 aren't much help at all.
There's little if any communication from the developers about these changes, so I have applied an approach that can be fairly
easily adapted to search for various properties, but this is becoming manually intensive. (Please see the code below).
Is there a method that someone can suggest to decouple the object search from CSS, HTML and property changes please?
Thank you
Set objObjectToStartFrom = objPage
arrProperty(0) = "tagName"
arrProperty(1) = "contentText"
arrValue(1) = "Visit W3Schools.com!"
intDepthOfSearch = 12
clkStopTime = GetTickCount() + 30000
On Error Resume Next
Do While GetTickCount() < clkStopTime
arrValue(0) = "LI" 'try for this obect type
Set objLink = objObjectToStartFrom.NativeWebObject.Find(arrProperty(1), arrValue(1), arrValue(0))
If Err.Number <> 0 Then
Log.Warning Err.Description & " when attempting to set object " & arrValue(0), pmNormal
On Error Goto 0
Err.Clear
Exit Function
End If
If objLink.Exists Then
Log.Checkpoint "Object found: " & arrValue(0), "", pmNormal
Exit Do
Else
arrValue(0) = "A" 'if the TextNode was not found then try this object type
Set objLink = objObjectToStartFrom.NativeWebObject.Find(arrProperty(1), arrValue(1), arrValue(0))
If objLink.Exists Then
Log.Checkpoint "Object found: " & arrValue(0), "", pmNormal
Exit Do
End If
End If
aqUtils.Delay(100)
Loop
If Err.Number <> 0 Then
Log.Warning Err.Description, pmNormal
On Error Goto 0
Err.Clear
Exit Function
End If
On Error Goto 0