I have updated version of chrome as well as WebDriver. Still getting the timeout exception. It was working properly previously but suddenly it started giving exception. It is not even reaching to test as well. If anyone has solution lease help.
Version 64.0.3282.140 (Official Build) (64-bit)
Webdriver: WebDriver.ChromeDriver.win32 2.35.0
var smth = m_driver.WaitUrl(new Regex(settings.GetSiteString("xyz") + "#/.*"));
for (int maxWait = 60000; maxWait > 0; maxWait--, System.Threading.Thread.Sleep(500))
if (m_driver.FindElement("//div[#ng-show='vm.loaded']").Displayed)
{
System.Threading.Thread.Sleep(500);
return;
}
throw new TimeoutException("Failed to wait for xyz page to load.");
Error message: The HTTP request to the remote WebDriver server for URL http://localhost:63425/session/cdc3e59/url timed out after 120 seconds.
It seems that adding the no-sandbox argument to your chrome driver options fixes the problem. I'm still trying to figure out why this fixes it.
Here is an example of how to instantiate a ChromeDriver so that it doesn't give you timeouts on pages that actually load properly.
var chromeOptions = new ChromeOptions();
chromeOptions.AddArgument("no-sandbox");
var webDriver = new ChromeDriver(Directory.GetCurrentDirectory(), chromeOptions);
I found this solution in this Github thread
Related
The error started to happen after updating google chrome to the latest version: 89.0.4389.82 (Official Build) (64-bit).
OS: Windows 10
Error:
PuppeteerSharp.ChromiumProcessException:
Failed to launch Chromium! [0309/160320.924:ERROR:os_crypt_win.cc(70)] Failed to encrypt: The system cannot find the file specified. (0x2)
Help, please!
I too got the same error while launching the chrome in the server using an application. I did upgrade google chrome manually and everything worked fine as normal.
after much faffing around trying to get this working in an asp.net app running in a production server environment (windows server 2019 in azure VM), i wanted to elaborate on vidya's answer "upgrade google chrome manually":
set the version number manually based on the latest version on this URL:
https://commondatastorage.googleapis.com/chromium-browser-snapshots/index.html?prefix=Win_x64/
in my case that version is 890410. set your code to use this version instead of DefaultChromiumRevision
const string ChromiumRevision = "890410";
var options = new BrowserFetcherOptions();
options.Path = HttpContext.Current.Server.MapPath("/App_Data");
var bf = new BrowserFetcher(options);
await bf.DownloadAsync(ChromiumRevision);
string exePath = bf.GetExecutablePath(ChromiumRevision);
var browser = await Puppeteer.LaunchAsync(new LaunchOptions
{
Headless = true,
ExecutablePath = exePath,
Args = new string[]{"--disable-gpu","--no-sandbox"}
});
I have a simple F# project which use Selenium and Chrome. I noticed that when Chrome is launched in headless mode the chrome object is not defined.
On the other side, if I run it "normally" the chrome object is correctly referenced.
Sample code:
let chromeOptions = new ChromeOptions(BinaryLocation = _chrome)
chromeOptions.AddArguments
(
"--headless",
"--disable-gpu"
)
let chrome = new ChromeDriver(chromeOptions, Url = "http://www.example.com")
try
Console.WriteLine(chrome.Capabilities.Platform)
Console.WriteLine(chrome.Capabilities.BrowserName)
Console.WriteLine(chrome.Capabilities.Version)
let res = chrome.ExecuteScript("return chrome;")
Console.WriteLine(res)
with e ->
Console.WriteLine(e.Message)
chrome.Quit()
If I run the code above I got the following output:
Starting ChromeDriver 2.31.488763 (092de99f48a300323ecf8c2a4e2e7cab51de5ba8) on port 61158
Only local connections are allowed.
Any
chrome
62.0.3188.0
unknown error: chrome is not defined
(Session info: headless chrome=62.0.3188.0)
(Driver info: chromedriver=2.31.488763 (092de99f48a300323ecf8c2a4e2e7cab51de5ba8),platform=Windows NT 10.0.15063 x86_64)
If I omit the headless option I got the following output:
Starting ChromeDriver 2.31.488763 (092de99f48a300323ecf8c2a4e2e7cab51de5ba8) on port 60248
Only local connections are allowed.
Any
chrome
62.0.3188.0
System.Collections.Generic.Dictionary`2[System.String,System.Object]
Is this a bug or I am missing something?
I have a problem with the Selenium web driver. What I'm trying to do is to start a "portable" chrome instead of my local installation, because it has different settings.
The problem is that the portable Chrome (from PortableApps) seems to only start when using GoogleChromePortable.exe. If I use the Chrome binary directly, it will start my local installation.
With Selenium it seems that no matter what Chrome path I pass to it (GoogleChromePortable.exe or binary path), it starts my local installation.
Here is my code:
String chromePath = "M:/my/path";
DesiredCapabilities capabilities = DesiredCapabilities.chrome();
ChromeOptions options = new ChromeOptions();
capabilities.setCapability("chrome.binary", chromePath);
capabilities.setCapability(ChromeOptions.CAPABILITY, options);
Any ideas how to be able to start my portable chrome?
Thanks
For anyone else stumbling upon this problem, here is how I managed to get the portable Chrome starting:
ChromeOptions chromeOptions = new ChromeOptions();
chromeOptions.setBinary(binaryPath);
driver = new ChromeDriver(chromeOptions);
I'm using Python 3.7 on Windows 10 and got Chrome Portable from PortableApps.com.
comments by #mario.schlipf and #SeJaPy were helpful, but I noticed that in the newer Webdriver releases, the setbinary method has been replaced by binary_location
This is how it actually worked for me:
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
chromedriverpath='M:/my/chromedriver.exe'
chromePath = 'M:/my/App/Chrome-bin/chrome.exe' # <== IMPORTANT! See note below.
chromeoptions = Options()
chromeoptions.add_argument('--incognito')
chromeoptions.binary_location = chromePath
browser = webdriver.Chrome(executable_path=chromedriverpath, options=chromeoptions)
NOTE:
The chromePath variable must point to the Chrome executable in the portabilized environment.
In packages obtained from PortableApps.com, you have two executables: a GoogleChromePortable.exe in the install (actually, unpack) directory and a chrome.exe in [installdirectory]/App/Chrome-bin, the first being "just" a launcher which provides the portabilized app with a consistent environment.
As I could observe, chromedriver needs to directly interact with the "real" Chrome executable, otherwise the script will launch the browser (via the launcher) but will eventually crash with error message:
unknown error: DevTools Active Port file doesn't exist
and no browser session will be returned as a result.
This may seem obvious to many people... but it was not to me, so I decided to put this note in order to make some clarity for the less clever guys (myself included) :).
String chromePath = "M:/my/googlechromeporatble.exe path";
String chromedriverpath="M:/my/chromedriver.exe path";
ChromeOptions options = new ChromeOptions();
options.setBinary(chromepath);
System.setProperty("webdriver.chrome.driver",chromedriverpath);
driver = new ChromeDriver(options);
This will invoke portable chrome rather than local installation.
First set google chrome portable path and then invoke chromeriver.exe
Depending on the settings you have in ChromePortable, maybe you could default ChromeDriver with Capabilities & ChromeOptions?
I'm thinking especially on custom profile. If you somehow could get that from your ChromePortable and load it with default ChromeDriver?
EDIT: Maybe this could help
I am trying to create some karma tests and some of the functions I'm testing are supposed to make Websocket connections.
When running the code normally outside of Karma (using Chrome or Firefox), I see that my console log messages show that ws.onopen() fires as expected.
Not so when running in Karma using PhantomJS or even Chrome. I'm running version 0.12 of Karma. Could this be related to how Karma uses socket.io, instead of the browser's Websocket?
I am not doing anything in regards to manually writing a handshake.
webSocketConnect = function() {
ws = new WebSocket("ws://192.168.103.83:9000", "ws-xyz");
ws.onopen = function(evt) {
console.log("Connection is opened...");
};
};
When webSocketConnect is invoked, i.e.:
webSocketConnect();
I get no error but I don't see "Connection is opened..." in the console log.
Thanks for any help.
Edit: I think that the code is not getting executed because XSS protections are coming into play. I took the code above and started playing around with it in jsfiddle and saw that when I ran it I would get: "
SecurityError: The operation is insecure." I think it's a shame that Karma is not reporting any error. In fact Karma is completely silent and I wasn't even noticing that none of the websocket code was being executed at all.
Since Firefox does not support the GWT DevMode any more, I want to switch to Chrome for developing selenium tests for my application.
However, it fails to load the GWT-dev-plugin extension. The test does not return from
driver = new ChromeDriver(capabilities);
Without configuring the extension, in works in the sense that a Chrome instance is at least started, however, without GWT plugin.
This is the way I configure the webDriver:
package the GWT plugin of your Chrome installation (described here http://www.mythoughts.co.in/2013/09/seleinum-webdriver-loading-chrome.html#.U0ZTFFfKGno)
use the path of the plugin .crx package as pluginPath in the following code
ChromeOptions options = new ChromeOptions();
options.addExtensions(new File(pluginPath));
DesiredCapabilities capabilities = DesiredCapabilities.chrome();
capabilities.setCapability(ChromeOptions.CAPABILITY, options);
File driverExecutable = new File("test-selenium/chromedriver.exe");
System.setProperty("webdriver.chrome.driver", driverExecutable.getAbsolutePath());
driver = new ChromeDriver(capabilities);
The only logging is a WARNING concerning the plugin key:
[14.899][WARNING]: Public key in crx header is different from key in manifest
key from header: ....
generated extension id from header key: godampgacipeiboepncogmjpfbgcpfba
generated extension id from manifest key: jpjpnpmbddbjkfaccnmhnkdgjideieim