Assuming that I understand you correctly:
- Find the
div
element with the desired class
.
- Ask for all of its siblings, get the first of them, then get the
text
of that one.
>>> HTML = '''\
... <div class="field">
... <div class="labelx"><a class="clickme" href="#h_group123" rel="#h_group123" title="Group">* Group</a></div>
... <div class="input">I-want-ya</div>
... </div>'''
>>> import bs4
>>> soup = bs4.BeautifulSoup(HTML, 'lxml')
>>> first_sib_div = soup.find('div', attrs={'class': 'labelx'})
>>> first_sib_div.fetchNextSiblings()[0].text
'I-want-ya'
Edit: This is what it should have been.
>>> HTML = '''\
... <div class="field">
... <div class="labelx"><a class="clickme" href="#h_group123" rel="#h_group123" title="Group">* Group</a></div>
... <div class="input">I-want-ya</div>
... </div>'''
>>> import bs4
>>> soup = bs4.BeautifulSoup(HTML, 'lxml')
>>> first_div_link = soup.select('div.labelx > a[title="Group"]')[0]
>>> first_div_link.findParent().fetchNextSiblings()[0].text
'I-want-ya'
Addendum: Added in response to question from rahlf23.
>>> s = '''\
... <div class="field">
... <div class="labelx"><a class="clickme" href="#h_group123" rel="#h_group123" title="Group">* Group</a></div>
... <div class="input">I-want-ya</div>
... <div class="labelx"><a class="clickme" href="#h_group123" rel="#h_group123" title="Group">* Group</a></div>
... <div class="input">I-want-ya-too</div>
... </div>'''
>>> soup = bs4.BeautifulSoup(s, 'lxml')
>>> for item in soup.select('div.labelx > a[title="Group"]'):
... item.findParent().fetchNextSiblings()[0].text
...
'I-want-ya'
'I-want-ya-too'