1

How can I select the div element "fc-event-time and then, relative to that, the "next" div element that is nested by the same amount?

So, based on the 1p - 2p text identified this area of HTML, I then want to get at the users names.

Given the following html:

<div class="fc-event-inner fc-event-skin">
  <div class="fc-event-head fc-event-skin">
    <div class="fc-event-time" style="background-color: rgb(120, 182, 229);">
      1p - 2p
    </div>
  </div>
  <div class="">
    <div class="fc-event-title">
      Juan A.*, Zach A.*
    </div>
  </div>
  <div class="fc-event-bg">
  </div>
</div>

I'm trying the following selector:

//div[@class='fc-event-time'][contains(text(),'1p - 2p')]../../div[2]/div

but it isn't working.

1 Answer 1

1

You are missing a forward slash:

//div[@class='fc-event-time'][contains(text(),'1p - 2p')]../../div[2]/div
# should be
//div[@class='fc-event-time'][contains(text(),'1p - 2p')]/../../div[2]/div
#                                                        ^ here

You may find the tool here (XPathBuilder) helpful: http://www.bubasoft.net/product/xpath-builder

Sign up to request clarification or add additional context in comments.

1 Comment

Seems like that link is now dead...

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.