1.通过部分链接文本定位

from selenium.webdriver.chrome.service import Service
from selenium import webdriver
from selenium.webdriver.common.by import By
import time

driver = webdriver.Chrome(service=Service('/usr/local/bin/chromedriver'))
driver.get('https://baidu.com')
#定位元素
el = driver.find_element(By.PARTIAL_LINK_TEXT,'hao')
print(el)
time.sleep(100)