title: Robot framework, Open Browser with command line flag to save browser log
body: <p>I'm trying to save browser (chrome) log messages (React logs, js errors etc.) into a file in a <em>robot framework</em> test run. Apparently this is more difficult than it should be, as I couldn't find convenient API in robot framework to achieve this.</p>
  
  <p>I figured out chrome could be started with <code>--enable-logging --v=1</code> flag to direct log messages into a file. But how could I pass this flag via <code>Open Browser</code> keyword in robot framework? To be more precise, I'm actually using <code>robotframework-maven-plugin</code> to run the tests with <em>headless</em> browser on the remote server.</p>
  
  <p>This is how test is currently started on the remote server from jenkins via execute remote shell task</p>
  
  <pre><code>rm -rf tests
  git clone git@*****/tests.git &amp;&amp; cd tests
  Xvfb :99 -ac -screen 0 1280x1024x24 &amp;
  export DISPLAY=:99
  mvn -DforceOpenJpaExecution=true -Dbrowser=chrome -Dserver=***** -DchromeDriverPath=/usr/local/bin/chromedriver clean verify
  </code></pre>
  
  <p>Here is the <code>pom.xml</code> of the test project</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;project xmlns="http://maven.apache.org/POM/4.0.0"
           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
           xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"&gt;
      &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
      &lt;groupId&gt;*****&lt;/groupId&gt;
      &lt;artifactId&gt;tests&lt;/artifactId&gt;
      &lt;packaging&gt;pom&lt;/packaging&gt;
      &lt;version&gt;1.0-SNAPSHOT&lt;/version&gt;
      &lt;name&gt;tests&lt;/name&gt;
  
      &lt;dependencies&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;com.github.markusbernhardt&lt;/groupId&gt;
              &lt;artifactId&gt;robotframework-selenium2library-java&lt;/artifactId&gt;
              &lt;version&gt;1.4.0.8&lt;/version&gt;
          &lt;/dependency&gt;
      &lt;/dependencies&gt;
  
      &lt;build&gt;
          &lt;defaultGoal&gt;verify&lt;/defaultGoal&gt;        
  
          &lt;plugins&gt;
            &lt;plugin&gt;
              &lt;groupId&gt;org.codehaus.mojo&lt;/groupId&gt;
              &lt;artifactId&gt;properties-maven-plugin&lt;/artifactId&gt;
              &lt;version&gt;1.0-alpha-2&lt;/version&gt;
              &lt;executions&gt;
                  &lt;execution&gt;
                      &lt;id&gt;setPropertyChromeDriver&lt;/id&gt;
                      &lt;phase&gt;integration-test&lt;/phase&gt;
                      &lt;goals&gt;
                          &lt;goal&gt;set-system-properties&lt;/goal&gt;
                      &lt;/goals&gt;
                      &lt;configuration&gt;
                          &lt;properties&gt;
                              &lt;property&gt;
                                &lt;name&gt;webdriver.chrome.driver&lt;/name&gt;
                                &lt;value&gt;${chromeDriverPath}&lt;/value&gt;
                              &lt;/property&gt;
                          &lt;/properties&gt;
                      &lt;/configuration&gt;
                  &lt;/execution&gt;
              &lt;/executions&gt;
            &lt;/plugin&gt;
            &lt;plugin&gt;
              &lt;groupId&gt;org.robotframework&lt;/groupId&gt;
              &lt;artifactId&gt;robotframework-maven-plugin&lt;/artifactId&gt;
              &lt;version&gt;${robotframework-maven-plugin.version}&lt;/version&gt;
              &lt;executions&gt;
                &lt;execution&gt;
                  &lt;id&gt;robotTest&lt;/id&gt;  
                  &lt;phase&gt;integration-test&lt;/phase&gt;
                  &lt;goals&gt;
                    &lt;goal&gt;run&lt;/goal&gt;
                  &lt;/goals&gt;
                &lt;/execution&gt;
              &lt;/executions&gt;
            &lt;/plugin&gt;
          &lt;/plugins&gt;
      &lt;/build&gt;
  
  &lt;/project&gt; 
  </code></pre>
  
  <p>And here is the excerpt from <code>resource.robot</code></p>
  
  <pre><code>    Open the web application
          Open Browser    %{server}/App    %{browser}
          Maximize Browser Window
          Wait Until Page Contains        Login
  </code></pre>
  
  <p>Now, how could I pass the <code>--enable-logging --v=1</code> to chrome driver, or is there more convenient way to dumb browser log to a file or test results?</p>
  
  <p>I found this piece of code to set the flags, but I have no idea how to apply it in keyword based resource in my case</p>
  
  <pre><code>from selenium import webdriver
  options = webdriver.ChromeOptions()
  # set some options
  # for example:
  # options.add_argument('--disable-logging')
  driver = webdriver.Remote(desired_capabilities=options.to_capabilities())
  </code></pre>