18 January 2026:
Sahi Pro is an enterprise grade test automation platform which can automate web, mobile, API, windows and java based applications and SAP.
This forum is now archived and is in read-only mode. Please continue discussions on our improved new Sahi Pro Community forum.
Sahi Pro is an enterprise grade test automation platform which can automate web, mobile, API, windows and java based applications and SAP.
Sahi OS 5.0 and Chrome: --user-data-dir containing spaces not working
Hello,
I am wondering how I can start Chrome with a user data dir which contains spaces. The problem is that padding the path into quotes does not work:
Start FF on the cmd:
C:\Program Files (x86)\Mozilla Firefox>firefox.exe -profile "c:/foo bar/ff/"
Start Chrome on the cmd:
C:\Program Files (x86)\Google\Chrome\Application>chrome.exe --user-data-dir="C:/foo bar/chrome/"
Both URLs about:support and chrome/version proove that the profile path is set as desired. The same definition in browser_types.xml:
<browserType>
<name>firefox</name>
<displayName>Firefox</displayName>
<icon>firefox.png</icon>
<path>$ProgramFiles (x86)\Mozilla Firefox\firefox.exe</path>
<options>-profile "c:/foo bar/ff/" -no-remote</options>
<processName>firefox.exe</processName>
<capacity>5</capacity>
</browserType>
<browserType>
<name>chrome</name>
<displayName>Chrome</displayName>
<icon>chrome.png</icon>
<path>$ProgramFiles (x86)\Google\Chrome\Application\chrome.exe</path>
<options>--user-data-dir="C:/foo bar/chrome/" --no-default-browser-check --no-first-run --disable-infobars --proxy-server=localhost:9999 --disable-popup-blocking</options>
<processName>chrome.exe</processName>
<capacity>5</capacity>
</browserType>
The result is that Firefox starts as expected with "c:/foo bar/ff" as profile folder.
But Chrome open _TWO_ tabs, the second one showing Sahi start page, but the first tab opens "file:///C:/foo%20bar/chrome/".
For testing purppses, I wrote a small bat wrapper which takes all arguments (including the chrome.exe call), prints them into a file and calls afterwards the argument string (= chrome start). Instead of chrome.exe, I am calling the wrapper in browser_types.xml.
Result: The arguments written to file are not the same as logged by Sahi: after "C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" the first argument is "C:/foo bar/chrome/", which is interpreted by chrome as the first page to open. The parameter --user-data-dir is missing COMPLETELY.
Can someone confirm this behaviour please?
Thanks & regards,
Simon
Sahi OS 5.0
Windows 7 Pro
Java 1.8
Chrome 48
I am wondering how I can start Chrome with a user data dir which contains spaces. The problem is that padding the path into quotes does not work:
Start FF on the cmd:
C:\Program Files (x86)\Mozilla Firefox>firefox.exe -profile "c:/foo bar/ff/"
Start Chrome on the cmd:
C:\Program Files (x86)\Google\Chrome\Application>chrome.exe --user-data-dir="C:/foo bar/chrome/"
Both URLs about:support and chrome/version proove that the profile path is set as desired. The same definition in browser_types.xml:
<browserType>
<name>firefox</name>
<displayName>Firefox</displayName>
<icon>firefox.png</icon>
<path>$ProgramFiles (x86)\Mozilla Firefox\firefox.exe</path>
<options>-profile "c:/foo bar/ff/" -no-remote</options>
<processName>firefox.exe</processName>
<capacity>5</capacity>
</browserType>
<browserType>
<name>chrome</name>
<displayName>Chrome</displayName>
<icon>chrome.png</icon>
<path>$ProgramFiles (x86)\Google\Chrome\Application\chrome.exe</path>
<options>--user-data-dir="C:/foo bar/chrome/" --no-default-browser-check --no-first-run --disable-infobars --proxy-server=localhost:9999 --disable-popup-blocking</options>
<processName>chrome.exe</processName>
<capacity>5</capacity>
</browserType>
The result is that Firefox starts as expected with "c:/foo bar/ff" as profile folder.
But Chrome open _TWO_ tabs, the second one showing Sahi start page, but the first tab opens "file:///C:/foo%20bar/chrome/".
For testing purppses, I wrote a small bat wrapper which takes all arguments (including the chrome.exe call), prints them into a file and calls afterwards the argument string (= chrome start). Instead of chrome.exe, I am calling the wrapper in browser_types.xml.
Result: The arguments written to file are not the same as logged by Sahi: after "C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" the first argument is "C:/foo bar/chrome/", which is interpreted by chrome as the first page to open. The parameter --user-data-dir is missing COMPLETELY.
Can someone confirm this behaviour please?
Thanks & regards,
Simon
Sahi OS 5.0
Windows 7 Pro
Java 1.8
Chrome 48
Answers
In my opinion it would be better to use the Apache Library 'org.apache.commons.exec' with the class CommandLine#parse(String) to parse and execute native commands. Maybe this hint will help to fix the issue.