What is the default location of ChromeDriver binary and Chrome binary on windows 7 for triggering appium using java-client.jar? if i am using RemoteWebDriver and tries to initiate chrome browser, from where does the selenium initiates the chromedriver?
the code:
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability("userName", ReadProperties.Properties("MobileUsername"));
capabilities.setCapability("password", ReadProperties.Properties("MobilePassword"));
capabilities.setCapability("udid", ReadProperties.Properties("MobileUID"));
capabilities.setCapability("browserName", ReadProperties.Properties("MobileBrowser"));
capabilities.setCapability("platformName", ReadProperties.Properties("MobilePlatform"));
log.Info(capabilities.getVersion());
mobile_driver = new RemoteWebDriver(new URL(""+ReadProperties.Properties("MobileURL")+"/wd/hub"),capabilities);
chromedriver is not installed in your System by default. Users individually have to download chromedriver from ChromeDriver - WebDriver for Chrome page and you can place it anywhere within your system.
You must ensure that Chrome is installed at the optimum location as the server expects you to have Chrome installed in the default location for each system as per the snapshot below :
Note : For Linux systems, the ChromeDriver expects /usr/bin/google-chrome to be a symlink to the actual Chrome binary. You can also override the Chrome binary location following the documentation Using a Chrome executable in a non-standard location.
The location will depend on your default download folder e.g. when you download something from the internet and it goes into the downloads folder, then that is your default download folder.
So if you downloaded chromedriver.exe the same way, then it will also be in the downloads folder.
If you are using 3rd party service to run your tests you should not care about chromedriver.
But when you run tests locally you have to download it yourself: https://chromedriver.storage.googleapis.com/index.html
And then use capability to set absolute path to this file.
Make sure you use chromedriver version compatible with your browser version.
I know it's an old question but none of the answers above helped me. I found a different solution that worked for me and it might help someone else in the future.
I have tried the below solution with only Windows 10 / Server 2016.
Step 1: Get to the Google Chrome install directory by right clicking on the Chrome icon and click on Properties. You will see the installed directory listed under 'Target' and 'Start in' options. The directory path should end with .../Chrome/Application/. Copy the whole path.
Step 2: Open File Explorer and go to the above copied path. You should see chrome.exe file with other files and folders. Copy the whole Application/ folder including chrome.exe file with other files and folders.
Step 3: Go to the below file path and paste the above Application folder.
C:\Users<YOUR USER>\AppData\Local\Google\Chrome\
After pasting the Application folder, you should have the chrome.exe file with other files and folders in the following file path:
C:\Users<YOUR USER>\AppData\Local\Google\Chrome\Application\
Now the ChromeDriver should be able to locate the Chrome Binary.
Related
I am trying to launch karma from WSL using the Windows version of Google Chrome.
In the karma.conf.js I simply use the Chrome browser:
[...],
browsers: ['Chrome'],
[...]
And I export the CHROME_BIN environment variable like this:
export CHROME_BIN='/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe'
Karma successfully find Google Chrome, and a new tab is opened at the right URL when Karma is launched. However, I get this error:
Google chrome can't read and write to its data directory /tmp/karma-XXXX
I tried starting chrome as administrator and changing the cache folder to the root of my project but it doesn't work.
I assumed there was a issue with the format of the path that Karma give to Chrome (WSL path vs Windows path).
So I create a custom karma launcher specifying the chromeDataDir:
browsers: ['WindowsChrome'],
customLaunchers: {
WindowsChrome: {
base: 'Chrome',
chromeDataDir: 'D:\\'
}
}
By doing that a I don't have the previous error, a new instance of Chrome is launched but Chrome seems unable to resolve the URL, and karma timeout.
Moreover, a lot of Chrome folders are created inside my project.
Have someone already make karma work from WSL using Chrome or have any cue on what is going on ?
I found that if you create a C:\tmp\karma folder under Windows, this error goes away, and Chrome finds and uses this folder for temp files.
You can also change the temporary folder that Chrome uses for its data by setting the TEMP environment variable like so:
export TEMP='/path/to/your/folder'
The important thing is that C:\path\to\your\folder must exist under Windows.
Now in january 2022, on WSL2, tested on debian 11/WSL under windows 11, it's "easy" :
From windows command prompt :
SET CHROME_EXECUTABLE=C:\Program Files\Google\Chrome\Application\chrome.exe
Test :
echo %CHROME_EXECUTABLE%
C:\Program Files\Google\Chrome\Application\chrome.exe
Share this Windows env variable with WSL (doc. https://devblogs.microsoft.com/commandline/share-environment-vars-between-wsl-and-windows/) :
set WSLENV=CHROME_EXECUTABLE/p
From Windows command prompt, enter wsl, :
wsl
Verify the env variable is ok under wsl :
echo $CHROME_EXECUTABLE
/mnt/c/Program Files/Google/Chrome/Application/chrome.exe
Google repeatedly changed the path to the .exe of Chrome. Sometimes it's hidden in %APPDATA%, in Version 35/36 they changed the path back to program files. There are also differencies across the Windows versions.
Where is Google Chrome located in Windows 10?
Please see the screenshot which gives you the ability to seek for the current path of google chrome path or any other application
Task Manager - Windows 10
Windows 10:
%ProgramFiles%\Google\Chrome\Application\chrome.exe
%ProgramFiles(x86)%\Google\Chrome\Application\chrome.exe
%LocalAppData%\Google\Chrome\Application\chrome.exe
Windows 7:
C:\Program Files (x86)\Google\Application\chrome.exe
Vista:
C:\Users\UserName\AppDataLocal\Google\Chrome
XP:
C:\Documents and Settings\UserName\Local Settings\Application Data\Google\Chrome
There are also Registry Keys and environment variables to use. Check out this post for universal use for programming.
Chrome can be installed in various places on Windows, for a given user or "all users", in which case it's installed in Program Files.
To determine where it is programmatically:
Batch file:
set exe=
FOR /F "tokens=2* skip=2" %%a in ('reg query HKCR\ChromeHTML\shell\open\command /ve') do set exe=%%b
set exe=%exe:"=%
set exe=%exe:~0,-6%
PowerShell:
(gp Registry::HKCR\ChromeHTML\shell\open\command)."(Default)" -match '"(.*?)"' | Out-Null
$exe=$matches[1]
C#:
var exe = System.Text.RegularExpressions.Regex.Match((string)Microsoft.Win32.Registry.ClassesRoot.OpenSubKey(#"ChromeHTML\shell\open\command").GetValue(null),
#"""(.*?)""",
System.Text.RegularExpressions.RegexOptions.None)
.Groups[1].Value;
Python
import winreg
import re
command = winreg.QueryValueEx(winreg.OpenKey(winreg.HKEY_CLASSES_ROOT, "ChromeHTML\\shell\open\\command", 0, winreg.KEY_READ), "")[0]
exe=re.search("\"(.*?)\"", command).group(1)
VBA / VBScript
Set objShell = CreateObject("WScript.Shell")
cmd = objShell.RegRead("HKCR\ChromeHTML\shell\open\command\")
exe = Mid(cmd, 2, 999)
exe = Left(exe, InStr(exe, Chr(34)) - 1)
The answer I am writing is applicable for any software/application installed on windows.
Windows 10
Click on windows button and search for the application, in this case Chrome.
Right click on application name and click on "Open file location".
You will reach at location of the shortcut of that application. Again right click on the application shortcut and then click on "Open file location" and you will get the path from top url/path bar of explorer or you can click on properties to get the path as shown in image.
And you will get your path for desired application from tab shown in image.
PS: Doesn't works for apps installed from windows store.
Right click on the sub process to see the open file location :
Screenshot
To find the location of Google, type the following command...
chrome://version
And then look for Command Line on the left side of the screen.
I found something in the Registry when I installed Chrome Canary at the same time.
in a batch file, using chrome.exe it always opens Canary...
then I change from:
Equipo\HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\App Paths\chrome.exe
"C:\Users\heratess\AppData\Local\Google\Chrome SxS\Application\chrome.exe"
To:
Equipo\HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\App Paths\chrome.exe
C:\Program Files\Google\Chrome\Application\chrome.exe
and it worked for me.
maybe it could help you.
Hi i'm installing extensions by programmatically by a little c# program.
I just did see the software doesn't work on my friend.
i did see his chrome directory is not at %appdata% folder its at program files?
so how to find the real latest version of chrome directory for install plugins?
Google says
Windows:
chrome_root\Application\chrome_version\Extensions\
Example: c:\Users\Me\AppData\Local\Google\Chrome\Application\6.0.422.0\Extensions\
but how to find the chrome_root?
Visit chrome://version.
Look at Profile Path.
Extensions can be found in the Extensions subdirectory of the path you found at the previous step.
You can also load the extension using the --load-extension flag:
chrome.exe --load-extension=path/to/extension
The recommended mechanism for installing extensions programmatically is external extensions. It has the advantage of not depending on Chrome paths that might change, instead you can use a stable registry key or JSON file.
I just lost all my changes to my google chrome plugin. However, the plugin is still running within the browser.
Where does Google Chrome store its cached copy of unpacked extensions?
I was able to find luck in:
Non-windows 7:
C:\Documents and Settings\<username>\Local Settings\Application Data\Google\Chrome\User Data\<profile>\Extensions
-or-
Windows 7:
C:\Users\<username>\AppData\Local\Google\Chrome\User Data\<profile>\Extensions
EDIT: You can go to "chrome://version/" (like a url) and it shows your "Profile Path". There you can find an "Extensions" folder which is the one you're looking for.
Turns out that unpacked extensions are left in their original locations. Only packed extension get extracted to the places Alex.Piechowski mentioned.
On Linux (OpenSuse 12.3), I managed to find all my installed extensions here:
~/.config/google-chrome/Default/Extensions/
It's important to first take note of the extension ID in case u wish to just copy a particular extension. For this, open chrome://extensions/ in your browser, copy the id of the extension of interest, and find it's directory under the extensions directory given above.
Being able to locally save copies of extensions like this has helped me to continue using (and even modifying / hacking) on extension that were eventually removed from the Chrome Store by either their owners or Google.
So I was debugging an extension I am building on Mac OS X and couldn't find the SQLite database in any of the standard locations. It doesn't store the DB in the path where the extension files live.
Here's where I found my database when running an unpacked extension:
~/Library/Application Support/Google/Chrome/Default/databases/http_foobar.com_0/XX
-Eric
User profiles are stored in User Data Directory and it vary depending on the operating system.
The easiest way is to navigate to chrome://version and look for the Profile Path field.
Example (Windows):
[Profile Path] C:\Users\Alice\AppData\Local\Google\Chrome\User Data\Default
[User Data Dir] C:\Users\Alice\AppData\Local\Google\Chrome\User Data
Then Extensions are located under Extensions/ folder.
In windows:
Path: C:\Users\yourusername\AppData\Local\Google\Chrome\User Data\Profile 1\Extensions
(Here, you will not able to see extensions by name but it will be by extensions by Id. Extension Id you can get it from chrome→extension→Developer modes)
Or
Path: C:\Documents and Settings\yourusername\Local Settings\Application Data\Google\Chrome\User Data\Default\Extensions
Or
Download Extension Source Locator. Give your username. It will list out all the extension with path details.
I use Windows 7(64bit) and repeat steps in Google Document.
This is what I added in register.
In HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Google\Chrome\Extensions\nbfjanngloflombfddlmkgnambnfhgjc
path="C:\Extension.crx"
version="2.1"
But extension isn't install.
Before testing .crx file distribution,
I installed and uninstalled this extension with unpacked files many times by UI(chrome://extensions) for development and tested setting policy by using register. (But I removed all of them now.)
Does it cause any problem?
But when I tested same thing in another clean PC(Windows XP 32bit) nothing is changed, too.
I already checked some common mistakes in Google Document several times, but I can't find any mistakes.
- Not specifying the same id/version as the one listed in the .crx
- Key created in the wrong location in the registry
- Registry entry points to the wrong path to the .crx file (or path specified but no filename)
- Permissions problems on a network share
Are there other common mistakes I should check to install external extension?
According to this page - https://developer.chrome.com/extensions/external_extensions -
it is no longer possible to use the registry method to install locally-hosted .crx files.
in fact, the only allowed extension are those from Google's Extension gallery.
See a quote below from Google's policy page:
An extension that's installed automatically is known as an external extension. Google Chrome supports two ways of installing external extensions:
-Using a preferences JSON file (Mac OS X and Linux only)
-Using the Windows registry (Windows only)
Both ways support installing an extension hosted at an update_URL. In the Windows registry, the update_URL must point to the Chrome Web Store where the extension is hosted.
The extension-ID cannot be chosen at random.
I've installed your .crx file in Chromium 18 (Linux), and Chrome 18 (Windows 7 in VirtualBox), and the correct extension-ID is: lhmigopickaaleaaelbppeabnbdgcdhe
The version number has to match. In the manifest.json file, in the extension, I see "version": "1.0". So, the version entry in the registry has to be 1.0.
I was not able to install the extension via the registry using the steps from the Documentation. I've found two right ways to install the extension through the registry. Create a .reg file, and paste the text below to install the extension:
set_page_color_chrome-extension.reg (based on this file, md5: 10a1b95c249a2481bc88d3d1aead0e33).
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\Google\Chrome\Extensions\lhmigopickaaleaaelbppeabnbdgcdhe]
"version"="1.0"
"path"="C:\\set_page_color.crx"
Replace HKEY_LOCAL_MACHINE with HKEY_CURRENT_USER if you're running in permission trouble, or if you want to install the extension only for the current user.