This is a migrated thread and some comments may be shown as answers.

Find Expression, Multiple Classes Under Variable Name Div

1 Answer 71 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Dan
Top achievements
Rank 1
Dan asked on 27 Sep 2012, 09:32 PM
Hi,

I have a hash that I need to extract from the following piece of HTML code:
<div id="ui-drawn-box-33" class="ui-drawn-box-default-color ui-drawn-box ui-drawn-box-ad-space-5047ab4103840b1cc060fc76 ui-draggable ui-drawn-box-selected" style="position: absolute; z-index: 1001; left: 130.238px; top: 2111.51px; width: 43.3705px; height: 43.4372px;" adspaceid="5047ab4103840b1cc060fc76" boxindex="33" isexisting="true" boxdata="{"adId":81994562,"adSpaceId":"5047ab4103840b1cc060fc76","calculatedImageHash":"EJxY0NP*+RAbpU*lP3xgVoQb4pw=","isStatusDeleted":false,"isStatusUnidentifiable":false,"isAd":false,"isExisting":false,"isMoved":false,"isHouse":false,"isMarkedHouseViaExistingHash":false,"isSponsored":false,"isManuallyAdded":false,"isAnimated":false,"isExpanding":false,"isTaskbar":false,"isPopover":false,"isAutoCropped":true,"isDeleted":false,"isAutoTagged":false,"isFlash":false,"isNewFlag":false,"isFlagRemoved":false,"hasExistingFlag":false,"typeOfAd":"Image","adNotes":"","flagDate":null,"flagType":0,"flagName":null,"flagComments":null,"brands":[],"redirectUrls":null,"resolvedAdFlags":null,"id":33,"x1":0.2051,"y1":0.5493,"x2":0.2734,"y2":0.5606,"percentOfPage":0,"originalZIndex":967,"clientSideId":33}">
<img src="http://some url...adImageHash=EJxY0NP*+RAbpU*lP3xgVoQb4pw=" style="width: 43px; height: 43px; z-index: 967;">


I am having a difficult time extracting the "adImageHash" from the class "ui-drawn-box-selected," I cannot simply find by the div name because it is variable, can you guys please point me in the right direction?

1 Answer, 1 is accepted

Sort by
0
Byron
Telerik team
answered on 02 Oct 2012, 11:15 PM
Hello Dan,

I recommend using find logic that combines a filter for an id that contains rather than equals the static portion of the ID with a filter that matches the appropriate class. Once you identify the proper element, you can extract the correct property.

Regards,
Byron
the Telerik team
Are you enjoying Test Studio? We’d appreciate your vote in the ATI automation awards.
Vote now
Tags
General Discussions
Asked by
Dan
Top achievements
Rank 1
Answers by
Byron
Telerik team
Share this question
or