0

I am trying to access the People also ask panel content on the Google search results page for a given search and to extract the question and answer text of the presented questions. However, when I try to access the compound class, with browser.find_elements_by_class_name("_Tgc _s8w _y9e")I get an error and I've tried to fix it by using browser.find_elements_by_class_name("._Tgc._s8w._y9e") but then I get no results? I can't find out how else to access the HTML text, any help is much appreciated! Thank you!

zipzip12
  • 41
  • 1
  • 6

1 Answers1

0

Figured it out, for anyone else who comes across this question: browser.find_elements_by_xpath("//*[@class='_Tgc _s8w _y9e']")

by using xpath you can reference compound classes

zipzip12
  • 41
  • 1
  • 6
  • This is not a safe solution. The DOM class attribute is a space-separated **list** of class names, and the order is not guaranteed. – SiKing Jan 10 '18 at 00:10