Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

How do I extract multiple div class from google search?

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’

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

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,

>Solution :

Try:

Nationality = [ x.text for x in driver.find_elements(By.XPATH,'//*[@class="bVj5Zb FozYP"]')]
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading