Chrome not rendering fonts when opened in terminal or run by webriver

非 Y 不嫁゛ 提交于 2019-12-11 02:35:11

问题


Google Chrome does not render fonts when run with selenium and chromedriver. Code see below.

The same issue occurs when opening chrome from the terminal with /Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome

It looks like this: Screenshot of chrome not showing fonts with google start page opened.

Setup:

  • Google Chrome Version 67.0.3396.99
  • macOS sierra, Version 10.12.6
  • "chromedriver": "^2.40.0" (package.json)
  • "selenium-webdriver": "^4.0.0-alpha.1"
  • node.js v9.11.1

This is my code for running chrome with wedriver:

    const {Builder} = require('selenium-webdriver');
    require('chromedriver');
    async function run(){
        let driver = await new Builder().forBrowser('chrome').build();
        await driver.get('http://www.google.com/');
        await driver.executeAsyncScript(function() {
            let callback = arguments[arguments.length - 1];
            let fiveSeconds  = 5000
            window.setTimeout(callback, fiveSeconds);
        });
    }
    run();

It is the same issue as described here: Google Chrome shows no text/fonts when opened with selenium

Changing system language to english seems to be a workaround, but that's not an option for me.

This error occured for the first about a month ago.

When querying text elements with selenium, they are recognized and marked as visible.

Is this a chrome bug or am I doing something wrong?

Thanks for help.

来源:https://stackoverflow.com/questions/51193152/chrome-not-rendering-fonts-when-opened-in-terminal-or-run-by-webriver

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!