I'm using Firefox and Geckodriver on Ubuntu 20.04 (both on WSL2 and on a separate VM with similar results)
sudo apt install firefox -y
wget https://github.com/mozilla/geckodriver/releases/download/v0.30.0/geckodriver-v0.30.0-linux64.tar.gz
tar -xvzf geckodriver*
chmod x geckodriver
sudo mv geckodriver /usr/local/bin/
# am using pipenv as a virtual env which brings in selenium
pipenv run python dm.py
Running a Python script to take a screenshot of a non EN character set gives me rectangles with (unicode addresses?)
from selenium import webdriver
import time
options = webdriver.FirefoxOptions()
options.headless = True
driver = webdriver.Firefox(options=options)
driver.set_window_size(1400, 2000)
driver.get("http://www.chinatoday.com.cn/")
time.sleep(1)
# fonts showing up as boxes with numbers
driver.save_screenshot("screenshot.png")
which saves as:
On regular firefox it uses the Microsoft YaHei fonts.
I've tried
sudo apt install ttf-mscorefonts-installer -y
# update cache
sudo fc-cache -fv
Have rebooted too which doesn't help.
CodePudding user response:
Found something on Reddit about this. The poster claimed they fixed the issue by installing Noto Fonts:
sudo apt-get update
sudo apt-get install fonts-noto