Chrome 59 and Basic Authentication with Selenium/Fluentlenium

后端 未结 4 1938
灰色年华
灰色年华 2020-12-01 19:02

Chrome 59 has removed support for https://user:password@example.com URLs.

I have a test which was using this feature which has now broken, so I\'m trying to replace

4条回答
  •  夕颜
    夕颜 (楼主)
    2020-12-01 19:55

    Florent B. found a solution with the help of a chrome extension, that is added on the fly in the selenium test. The extenion handles the basic auth credentials, if requiered:

    ChromeOptions options = new ChromeOptions();
    options.addExtensions(new File("C:/path_to/credentials_extension.zip"));
    driver = new RemoteWebDriver(new URL("http://127.0.0.1:9515"), options);
    

    Chrome extension code: https://gist.github.com/florentbr/25246cd9337cebc07e2bbb0b9bf0de46
    (just modify username and password in background.js and then zip the files background.js and manifest.json to credentials_extension.zip)

    Found here: Selenium - Basic Authentication via url

提交回复
热议问题