【发布时间】:2025-12-18 19:55:01
【问题描述】:
This image has the highlighted html content and red circle is the portion that needs to be scraped 电话号码在画布标签中。我尝试抓取标签,但它返回“您的浏览器不支持 HTML5 画布标签。”
https://www.mudah.my/malaysia/cars-for-sale/audi?o=1
这是一个链接,其中包含必须抓取联系人的汽车列表 任何关于如何解决此问题的建议表示赞赏。
for link in car_links:
print('link: ', link)
driver.get(link)
try:
dealer_name = driver.find_element_by_xpath('/html/body/div[1]/div[6]/div/div[2]/div[1]/div[4]/div/div[1]/div[2]/div[1]/a').text
print(dealer_name)
try:
driver.execute_script("arguments[0].scrollIntoView(true);",WebDriverWait(driver, 20).until(EC.presence_of_element_located((By.XPATH, '/html/body/div[1]/div[6]/div/div[2]/div[1]/div[5]/button[2]'))))
button1 = WebDriverWait(driver, 20).until(EC.element_to_be_clickable(
(By.XPATH, '/html/body/div[1]/div[6]/div/div[2]/div[1]/div[5]/button[2]')))
button1.click()
phone = driver.find_element_by_id('phone-image').text
print(phone)
except:
print('No name')
print('No phone no')
except:
pass
【问题讨论】:
标签: python html selenium web-scraping