skip to Main Content

I’m able to run selenium on non GUI centos/linux machine in headless mode.

I have been trying to run it with cache enable by passing below chromeoptions arguments.

chromeOptions.addArguments("user-data-dir=~/.config/google-chrome");

It has started fine and identified elements till login page(which is first page) and couldn’t identify any locators after that.

Is it the right approach to run cache enabled selenium run?

2

Answers


  1. It’s not that super clear when you mention about executing your tests with cache enabled. However, adding the argument user-data-dir is the canonical way to use a specific Chrome Profile.

    You can find a couple of detailed discussions in:

    Login or Signup to reply.
  2. Adding those options helps me to prevent crashes and errors on a linux remote machine

    ChromeOptions options = new ChromeOptions();
            options.addArguments(
                    "--disable-gpu",
                    "--headless",
                    "--window-size=1920,1200",
                    "--ignore-certificate-errors",
                    "--disable-extensions",
                    "--no-sandbox",
                    "--disable-dev-shm-usage",
                    "--hide-scrollbars",
                    "--allow-running-insecure-content",
                    "--disable-infobars",
                    "--ignore-certificate-errors");
    Webdriver driver = new ChromeDriver(options);
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search