Element by attribute or nth-of-type

Have two div with same class but different data-automation attribute values
Tried to use element and catch first and second nth-of-type

Is it also possible to catch gender info (it's either gender_M or gender_F)
from class: div class="profile_photo_wrapper profile_photo gender_M age_group_A style_circle" ....

<div class="card_row dna_shared_matches_row">
<div class="card_col">
<span class="shared_match_spacing"></span>
<div class="possible_relationships" data-automations="SharedMatchPossibleRelationships">Fetter to generasjoner forskjøvet – tremenning en generasjon forskjøvet</div>
</div>
<div class="card_col">
<div class="shared_match_profile">
<div class="shared_match_profile_content_wrapper">
<div class="shared_match_profile_inner">
<div class="dna_match_side"><span><b data-automations="SharedMatchPer">2,0</b>% (<span data-automations="SharedMatchTotal">144,0</span>‎ cM)</span></div>
<div class="profile_photo_wrapper profile_photo gender_M age_group_A style_circle" style="width: 75px; height: 75px;">
<div class="svg_silhouette svg_silhouette_M_A" style="width: 100%; height: 100%;"></div>
</div>
<div class="other_dna_match_side"><span><b data-automations="SharedMatchOtherPer">5,1</b>% (<span data-automations="SharedMatchOtherTotal">361,0</span>‎ cM)</span></div>
</div>
<a class="shared_profile_name" data-automations="SharedMatchProfileName">Harry Johansen</a>
</div>
</div>
</div>
<div class="card_col">
<span class="shared_match_spacing"></span>
<div class="possible_relationships" data-automations="SharedMatchOtherPossibleRelationships">Fetter en generasjon forskjøvet – tremenning</div>
</div>
<span class="tag_component tag_rounded size_medium go_to_chromosome_browser" data-automations="tag">
<div class="tooltip_wrapper" tabindex="0"><span data-automations="go_to_chromosome_browser_icon" class="go_to_chromosome_browser_icon"></span></div>
</span>
</div>

@rbh Hi, can you share your sitemap or the targeted website?

You can't access site it's a private users DNA match list - requires login and password.

{"_id":"mh_one-to-one_matches","startUrl":["https://www.myheritage.no/dna/match/D-EF001EEA-941B-4EF7-B5F6-E40C552AB4C9-D-D53F41D7-1356-4808-9ECB-34A741F19CCE/574705431?mode=shared"],"selectors":[{"id":"Treff-liste","parentSelectors":["_root"],"type":"SelectorElement","selector":"div.dna_shared_matches_row","multiple":true,"delay":0},{"id":"Navn","parentSelectors":["Treff-liste"],"type":"SelectorText","selector":"a","multiple":false,"delay":0,"regex":""},{"id":"cM1","parentSelectors":["Treff-liste"],"type":"SelectorText","selector":".dna_match_side span span","multiple":false,"delay":0,"regex":""},{"id":"estm1","parentSelectors":["Treff-liste"],"type":"SelectorText","selector":"div:nth-of-type(1).possible_relationships","multiple":false,"delay":0,"regex":""},{"id":"cM2","parentSelectors":["Treff-liste"],"type":"SelectorText","selector":".other_dna_match_side span span","multiple":false,"delay":0,"regex":""},{"id":"Estm2","parentSelectors":["Treff-liste"],"type":"SelectorText","selector":"div:nth-of-type(2).possible_relationships","multiple":false,"delay":0,"regex":""}]}

Used parent div. There are "3 columns" on card (div class="card_col"), first and third had data so I used

  • div:nth-of-type(1).card_col
  • div:nth-of-type(3).card_col

Strange that nth-of-type didn't work on div closer to text I needed to grab, but on parent

Try:

Type: HTML
Selector: div.shared_match_profile
Regex: gender_[A-Z]

1 Like

Worked almost like a charm replaced regex with positive lookbehind, since I only need character after underscore:
(?<=gender_)[A-Z]