Quantcast
Channel: Active questions tagged selenium - Stack Overflow
Viewing all articles
Browse latest Browse all 98498

Selenium ChromeDriver "get" doesn't reliably load @import fonts

$
0
0

I have a few HTML pages like this:

<!DOCTYPE html><html><head><meta charset="utf-8"><style>@import url(https://fonts.googleapis.com/css?family=Droid+Serif:400,700,400italic); body { font-family: 'Droid Serif'; }</style></head>...

When loading the page with Selenium:

from selenium import webdriverchrome_options = webdriver.ChromeOptions()chrome_options.add_argument('--kiosk-printing')browser = webdriver.Chrome(r"chromedriver.exe", options=chrome_options)browser.get("http://www.example.com/")

then:

  • 50% of the time, the font doesn't get loaded (the page is displayed with default serif font (Times New Roman probably))
  • 50% of the time, the font is loaded

How to make font loading more reliable with Selenium?

Even re-loading the page a second time with time.sleep(2); browser.get(...) didn't help 100% of the time.


Viewing all articles
Browse latest Browse all 98498

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>