5

I've been searching for the past 30 minutes or so, but I can't seem to an answer to how to create an xpath selector that will match multiple classes.

After reading this: How can I match on an attribute that contains a certain string?

The closest solution I can find is:

//div[contains(@class,'atag') and contains(@class ,'btag')]

However, one of the comment suggests that it would also match:

<div class="Patagonia Halbtagsarbeit">

What XPath selector should I use to select a div with multiple classes?

Example:

<div class="fl badge bolded shadow">
Community
  • 1
  • 1
jaka
  • 155
  • 1
  • 2
  • 10

1 Answers1

0

I would suggest backing the xpath up to locate the div more specifically so that other divs with the same classes could not be selected instead. You can use FireBug's FirePath to get the absolute xpath.

Casey Murray
  • 1,582
  • 17
  • 21