I am trying to get Fax number but they gave me nothing these is page link https://www.barreaunantes.fr/annuaire-des-avocats/stephanie-dreux/
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.wait import WebDriverWait
from selenium.webdriver.support.select import Select
PATH="C:\Program Files (x86)\chromedriver.exe"
url='https://www.barreaunantes.fr/annuaire-des-avocats/stephanie-dreux/'
driver =webdriver.Chrome(PATH)
wait = WebDriverWait(driver, 20)
driver.get(url)
Fax = driver.find_element(By.XPATH, "//p//strong[contains(text(),'Fax : ')]").text
print(Fax)
>Solution :
You’re trying to locate strong tag but you need a p tag:
Fax = driver.find_element(By.XPATH, "//p[strong[contains(text(),'Fax : ')]]").text
print(Fax.strip('Fax : '))