Home > Mobile >  How do I extract multiple div class from google search?
How do I extract multiple div class from google search?

Time:05-09

I'd like to extract multiple nationalities to text on my python code using selenium.

for example, musician Zedd's case https://www.google.com/search?q=musician Zedd nationality

He is found to be 'German' and 'Russian'

How do I extract both texts?

(its' div class name is currently : "bVj5Zb FozYP")

Nationality = driver.find_element(by = By.XPATH, value = "/html/body//*[contains(concat(' ', @class, ' '), ' bVj5Zb FozYP ')]").text

Best,

CodePudding user response:

Try:

Nationality = [ x.text for x in driver.find_elements(By.XPATH,'//*[@]')]
  • Related