Reputation: 1
I'm using webdrivermanager with browserInDocker() for my test automation framework. So far it works great. But now I have trouble trying to use a chrome profile. Usually, when I use selenium webdriver, I simply can set a ChromeOption and it works.
How can I use it with browserInDocker()?
I tried the following code:
public void setupBrowserInDockerWithProfile() {
ChromeOptions options = new ChromeOptions();
options.addArguments("--user-data-dir=/home/seluser/.config/google-chrome/Default");
driver = WebDriverManager
.chromedriver()
.capabilities(options)
.browserInDocker()
.dockerVolumes("/var/lib/docker/volumes/chromeprofile/_data:/home/seluser/.config/google-chrome/Default")
.create();
driver.manage().window().maximize();
driver.get(APP_URL);
}
I tried it with and without a docker volume, but I'm not even sure if I use it right. I'm searching for days now, but could't find a solution yet.
Upvotes: 0
Views: 512
Reputation: 4858
The problem is the argument --user-data-dir=/home/seluser/.config/google-chrome/Default
. As explained in the doc, WebDriverManager uses the Aerokube's Docker images. That path is available in the docker-images, but not in Aerokube's. You can drop that argument or change it to the following:
options.addArguments("--user-data-dir=/home/selenium/.config/google-chrome/Default");
Upvotes: 1