大家好,請問我該怎么做?當我運行非無頭模式時,瀏覽器是英文的,一切正常,但是當我運行無頭模式時,語言會更改為我的母語。
我將其用于無頭模式。
Configuration.headless = true;
uj5u.com熱心網友回復:
Selenide配置類包含
public static MutableCapabilities browserCapabilities如果提供,則在驅動程式啟動中使用。
對于鉻:
ChromeOptions options = new ChromeOptions()
.setHeadless(true)
.addArguments("--lang=en_US");
Configuration.browserCapabilities = options;
--lang但是在 Linux 上可能會忽略note引數。
對于火狐:
FirefoxProfile profile = new FirefoxProfile();
profile.setPreference("intl.accept_languages", "en-US");
FirefoxOptions options = new FirefoxOptions()
.setHeadless(true);
.setProfile(profile);
Configuration.browserCapabilities = options;
轉載請註明出處,本文鏈接:https://www.uj5u.com/gongcheng/429867.html
