Chrome opens for a second and the crashes - c#

I'm using Appium and C# in order to run tests on my Galaxy S5.
Everyhting worked perfectly , but last night we have updated the ChromeDriver to 2.25 and suddenly the chrome in my mobile just open the chrome, shows "data:" in the URL and crashes. on the other hand, the chrome in on Windows OS(selenium) works well.
[SetUp]
public void Setup()
{
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.SetCapability("device", "Android");
capabilities.SetCapability("deviceName", "Galaxy S5");
capabilities.SetCapability("newCommandTimeout", "300");
capabilities.SetCapability("platformName", "Android");
capabilities.SetCapability("platformVersion", "6.0.1");
capabilities.SetCapability("appPackage", "com.android.chrome");
capabilities.SetCapability("appActivity", "org.chromium.chrome.browser.ChromeTabbedActivity");
_driver = new AndroidDriver<AppiumWebElement>(new Uri("http://127.0.0.1:4723/wd/hub"), capabilities, TimeSpan.FromSeconds(180));
}
Appium's ERROR:
info: [debug] Responding to client with error: {"status":33,"value":{"message":"A new session could not be created. (Original error: A new session could not be created. (Original error: session not created exception\nfrom unknown error: Runtime.executionContextCreated has invalid 'context': {\"auxData\":{\"frameId\":\"31754.1\",\"isDefault\":true},\"id\":1,\"name\":\"\",\"origin\":\"://\"}\n (Session info: chrome=54.0.2840.85)\n (Driver info: chromedriver=2.18.343845 (73dd713ba7fbfb73cbb514e62641d8c96a94682a),platform=Windows NT 6.1 SP1 x86_64)))","status":33,"value":

updating the Appium's chromedriver manually to the latest one fixed the problem for me.
just downlaod the latest chromedriver vsersion and put it in the following path:
C:\Program Files (x86)\Appium\node_modules\appium\node_modules\appium-chromedriver\chromedriver\win

Related

C# Selenium Chromedriver only shows 'data'

I created a very simple C# project to test Selenium and Chrome Driver, but when I run it, it gets stuck at the very first line, ie. creating ChromeDriver object.
I have set up as following:
.NET Core 3.1 console app (also tried .NET 4.7)
Installed Selenium.WebDriver 3.141.0 and Selenium.WebDriver.ChromeDriver 87.0.4280.8800.
My Chrome version is "Version 87.0.4280.88 (Official Build) (64-bit)". I have double-checked compatibility with Chrome and ChromeDriver.
Code:
using OpenQA.Selenium.Chrome;
namespace MyFirstSelenium
{
class Program
{
static void Main(string[] args)
{
ChromeDriver chrome = new ChromeDriver();
chrome.Navigate().GoToUrl("https://www.google.co.jp/");
}
}
}
visual studio screen
chromedriver.exe is copied to the debug folder as expected, so I assume the problem is neither compatibility nor path.
chromedriver
When I run the code, the result is an empty window with 'data' in the address bar. No error is thrown. I have searched for several hours and found some articles, but most of them are old and none of these answers led to success.
Any help is appreciated. Thank you.
Added chromedriver.exe verbose console output.
#Piotr M.
chromedriver console
logfile
https://drive.google.com/file/d/1ECOS8E55aaTFV63e8P-7n6uRVcf49PRN/view?usp=sharing
New code
Works when I first execute "chromedriver.exe --verbose --log-path=chromedriver.log", but without it, it throws WebDriverException.
OpenQA.Selenium.WebDriverException: 'A exception with a null response was thrown sending an HTTP request to the remote WebDriver server for URL localhost:9515/session. The status of the exception was UnknownError, and the message was: No connection could be made because the target machine actively refused it. No connection could be made because the target machine actively refused it.'
var chromeOptions = new ChromeOptions();
chromeOptions.BrowserVersion = "87";
IWebDriver driver = new RemoteWebDriver(new Uri("http://localhost:9515"), chromeOptions);
Possibly a classic case of cyclic redundancy.
chrome is a reserved word, you may have to change the variable name to something else e.g. chromex. So your effective line of code will be:
ChromeDriver chromex = new ChromeDriver();
Additional Consideration
Consider the following aspects aswell:
Instead of using the ChromeDriver class use the IWebDriver interface.
IWebDriver driver = new ChromeDriver();
Instead of the partial url google.co.jp/ you need to pass the complete url through GoToUrl() as follows:
driver.Navigate().GoToUrl(#"https://www.google.co.jp/");

Appium launching on real device but chrome hangs

I'm running Appium 1.6.1 on Windows 10, and I'm trying to automate Chrome on a real device (in this instance a Samsung Galaxy S7 running Android 7.0). I'm using C# and visual studio. My code looks like the below:
using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using OpenQA.Selenium.Appium;
using OpenQA.Selenium;
using OpenQA.Selenium.Remote;
using OpenQA.Selenium.Appium.Android;
namespace MobileBrowserTesting{
[TestClass]
public class UnitTest1{
AppiumDriver<IWebElement> Driver;
[TestMethod]
public void TestMethod1(){
DesiredCapabilities caps = new DesiredCapabilities();
caps.SetCapability("deviceName", "hero2lteskt");
caps.SetCapability("udid", "ce11160b3889d43005"); //Give Device ID of your mobile phone
caps.SetCapability("browserName", "Chrome");
//Launch the Android driver
Driver = new AndroidDriver<IWebElement>(new Uri("http://127.0.0.3:4723/wd/hub"), caps);
Driver.Navigate().GoToUrl("http://www.google.com");
string url = Driver.Url;
bool viewable = Driver.FindElement(By.Id("q")).Displayed;
}
}
}
Chrome launches, however it simply sits at "data;" with a blank screen and doesn't progress to the website. The last step in the Appium view is:
[JSONWP Proxy] Proxying [POST /session] to [POST
http://127.0.0.1:8001/wd/hub/session] with body: {"desiredCapabilities":
{"chromeOptions":
{"androidPackage": "com.android.chrome","androidDeviceSerial":"ce11160b3889d43005"}}}
[HTTP] <-- POST /wd/hub/session - - ms - -
And visual studio times out with the error message:
Message: Test method MobileBrowserTesting.UnitTest1.TestMethod1 threw
exception:
OpenQA.Selenium.WebDriverException: The HTTP request to the remote WebDriver server for URL http://127.0.0.3:4723/wd/hub/session timed out after 60 seconds. ---> System.Net.WebException: The operation has timed out
After a while Appium times out with:
[W3C] Encountered internal error running command: Error: Failed to start
Chromedriver session: An unknown server-side error occurred while processing
the command. (Original error: unknown error: Device ce11160b3889d43005 is
already in use
Appium is launched in admin mode, with "Allow session override" ticked under Advanced.
The chromedriver being used is the latest one (2.39) and the version of chrome on the device is 66.0.3359.158 so it should be compatible.
Any ideas why it seems to hang/not interact with Chrome?
Cheers in advance

Chrome Driver Error message [duplicate]

Sendkeys not working. Please help me to resolve this..
WebElement username = driver.findElement(By.xpath("//*[#id='username']"));
username.sendKeys("123456");
Console:
Exception in thread "main" org.openqa.selenium.WebDriverException: unknown error: call function result missing 'value'
(Session info: chrome=65.0.3325.31)
(Driver info: chromedriver=2.33.506120 (e3e53437346286c0bc2d2dc9aa4915ba81d9023f),platform=Windows NT 6.1.7601 SP1 x86)
(WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 0 milliseconds
Build info: version: '3.8.1', revision: '6e95a6684b', time: '2017-12-01T19:05:32.194Z'
System info: host: 'NEW-PC', ip: '192.168.0.103', os.name: 'Windows 7', os.arch: 'x86', os.version: '6.1', java.version: '1.8.0_161'
Driver info:
org.openqa.selenium.chrome.ChromeDriver
Capabilities {acceptSslCerts: true, applicationCacheEnabled: false, browserConnectionEnabled: false, browserName: chrome, chrome: {chromedriverVersion: 2.33.506120 (e3e53437346286..., userDataDir: C:\Users\NEW\AppData\Local\...}, cssSelectorsEnabled: true, databaseEnabled: false, handlesAlerts: true, hasTouchScreen: false, javascriptEnabled: true, locationContextEnabled: true, mobileEmulationEnabled: false, nativeEvents: true, networkConnectionEnabled: false, pageLoadStrategy: normal, platform: XP, platformName: XP, rotatable: false, setWindowRect: true, takesHeapSnapshot: true, takesScreenshot: true, unexpectedAlertBehaviour: , unhandledPromptBehavior: , version: 65.0.3325.31, webStorageEnabled: true}
I was seeing the same issue. The problem only appears when using Chrome 65 (currently: dev channel). With Chrome 64 (both stable channel and beta channel) everything worked fine.
It turns out I had an old chromedriver installed. Specifically, I was using chrome=65.0.3325.51 with chromedriver=2.29.461585. Running npm install -g chromedriver bumped chromedriver to 2.35.528157 and now the problem is solved.
TL;DR: run npm install -g chromedriver
The error says it all :
Exception in thread "main" org.openqa.selenium.WebDriverException: unknown error: call function result missing 'value'
(Session info: chrome=65.0.3325.31)
(Driver info: chromedriver=2.33.506120 (e3e53437346286c0bc2d2dc9aa4915ba81d9023f),platform=Windows NT 6.1.7601 SP1 x86)
(WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 0 milliseconds
Build info: version: '3.8.1', revision: '6e95a6684b', time: '2017-12-01T19:05:32.194Z'
Your main issue is the version compatibility between the binaries you are using as follows :
You are using chromedriver=2.33
Release Notes of chromedriver=2.33 clearly mentions the following :
Supports Chrome v60-62
You are using chrome=65.0
Release Notes of ChromeDriver v2.37 clearly mentions the following :
Supports Chrome v64-66
So there is a clear mismatch between the ChromeDriver version (v2.33) and the Chrome Browser version (v65.0)
Solution
Upgrade ChromeDriver to current ChromeDriver v2.37 level.
Keep Chrome version at Chrome v65.x levels. (as per ChromeDriver v2.37 release notes)
Clean your Project Workspace through your IDE and Rebuild your project with required dependencies only.
Use CCleaner tool to wipe off all the OS chores before and after the execution of your test Suite.
If your base Web Client version is too old, then uninstall it through Revo Uninstaller and install a recent GA and released version of Web Client.
Execute your #Test.
The latest chrome browser requires corresponding latest chromedriver executable for the tests to run.
I have encountered the same issue and installed the chrome drive. Issue got resolved.
npm install chromedriver --chromedriver_version=LATEST
Changing latest version of ChromDriver worked for me.
You may need to update you driver the link for all the chromedriver updates are http://chromedriver.storage.googleapis.com/index.html
make sure you chromedriver corresponds to your version of chrome
I simply installed a new version of Katalon Studio and it has worked fine.
This issue happens when chrome and chromedriver are not in sync. Either update both to the latest version or make sure they can work together. After running the following commands it worked for me
npm install -g chromedriver --chromedriver-force-download
webdriver-manager update

Chromedriver - unknown error: version info not a dictionary when runnings test via teamcity

I am getting the following error when running my tests via teamcity. I am trying to fire up chrome and run tests on a build agent which is a windows server 2008 machine. When the tests are run, multiple instances of chromedriver are fired up (i can see them in task manager) which eventually maxes out CPU/Memory. The browser is not started at all. I then get tests failing with the below error:
System.InvalidOperationException: unknown error: version info not a dictionary
(Driver info: chromedriver=2.7.236900,platform=Windows NT 6.1 SP1 x86_64)
at OpenQA.Selenium.Remote.RemoteWebDriver.UnpackAndThrowOnError(Response errorResponse) in c:\Projects\WebDriver\trunk\dotnet\src\WebDriver\Remote\RemoteWebDriver.cs:line 1012
at OpenQA.Selenium.Remote.RemoteWebDriver.Execute(String driverCommandToExecute, Dictionary`2 parameters) in c:\Projects\WebDriver\trunk\dotnet\src\WebDriver\Remote\RemoteWebDriver.cs:line 846
at OpenQA.Selenium.Remote.RemoteWebDriver.StartSession(ICapabilities desiredCapabilities) in c:\Projects\WebDriver\trunk\dotnet\src\WebDriver\Remote\RemoteWebDriver.cs:line 814
My setup looks like this:
var options = new ChromeOptions();
options.AddArgument("--start-maximized");
_driver = new ChromeDriver(#"C:\chromedriver", options);
I have looked around for solutions and people have generally got it to work by updating Chrome and chrome driver. I updated my setup to be the below but i still get the same issue
I am using Chrome version 29
Chromedriver version 2.7 and have also tried 2.8
My .Net binding are version 2.3.3
Specflow version 1.91
Works absolutely fine on my local machine though.
Try stopping all the build agent services then start the build agent from the bat file in the teamcity buildagent folder. Then run the tests and see if that works. If it works I tell you how to set it up like my teamcity server (my chrome driver works).

Failed to start up socket within 45000

I'm using FF version 19
it was all working fine till yesterday and suddenly today morning i start getting this error and i have the same exact code that was running before, no change nothing
error message:
Test 'M:.TestCases.12' failed: Failed to start up socket within 45000
OpenQA.Selenium.WebDriverException: Failed to start up socket within 45000
at OpenQA.Selenium.Firefox.Internal.ExtensionConnection.ConnectToBrowser(Int64 timeToWaitInMilliSeconds)
at OpenQA.Selenium.Firefox.Internal.ExtensionConnection.Start()
at OpenQA.Selenium.Firefox.FirefoxDriver.StartClient()
at OpenQA.Selenium.Remote.RemoteWebDriver..ctor(ICommandExecutor commandExecutor, ICapabilities desiredCapabilities)
at OpenQA.Selenium.Firefox.FirefoxDriver..ctor(FirefoxBinary binary, FirefoxProfile profile, TimeSpan commandTimeout)
at OpenQA.Selenium.Firefox.FirefoxDriver..ctor(FirefoxBinary binary, FirefoxProfile profile)
at OpenQA.Selenium.Firefox.FirefoxDriver..ctor(FirefoxProfile profile)
0 passed, 1 failed, 0 skipped, took 145.80 seconds (Ad hoc).
here is my source code:
public static IWebDriver GetDriver()
{
switch (Common.BrowserSelected)
{
case "ff":
FirefoxProfile profile = new FirefoxProfile();
profile.SetPreference("network.http.phishy-userpass-length", 255);
profile.SetPreference("network.automatic-ntlm-auth.trusted-uris", url);
drv = new FirefoxDriver(profile);
break;
case "ie":
var options = new InternetExplorerOptions();
options.IntroduceInstabilityByIgnoringProtectedModeSettings = true;
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.SetCapability(CapabilityType.AcceptSslCertificates, true);
drv = new InternetExplorerDriver(options);
break;
case "chrome":
//_driver = new ChromeDriver();
break;
}
return drv;
}
Firefox 19 'support' was added in Selenium's latest versions. So since you are using .NET, the direct download for the latest at the time of this post is version 2.31.2:
selenium-release.storage.googleapis.com/index.html
I have this issue with Firefox 43 and Selenium 2.48.
It happens when your Selenium driver server is running in a 32 bit process and you start the 64 bit version of Firefox.
The cause is that the webdriver server tries to connect to port 7055 which should be opened by the webdriver that runs in the Firefox executable. But you can see in TcpView from www.sysinternals.com that Firefox does not open this port. So the driver waits until his timeout (45 seconds) elapses.
This happens even after turning off the Windows Firewall completely.
All posts that I found in internet do NOT help: Upgrade Selenium, downgrade Firefox, etc..
But after installing the 32 bit version of the same Firefox 43 it works. I see in TcpView how Firefox 32 bit opens the port correctly:
In my code I use
FirefoxProfile Prof = new FirefoxProfile();
FirefoxBinary Bin = new FirefoxBinary(sBrowserExe);
mDriver = new FirefoxDriver(Bin, Prof);
With sBrowserExe = "C:\Program Files\Mozilla Firefox 43\firefox.exe"
the 64 bit version of Firefox 43 is started and I get the timeout exception.
With sBrowserExe = "C:\Program Files (x86)\Mozilla Firefox 43\firefox.exe"
the 32 bit version of Firefox 43 is started and it works!
UPDATE: The developers from Firefox now broke Selenium support COMPLETELY. New Firefox versions from 48 upwards need a digital signature for all extensions to be installed.
https://wiki.mozilla.org/Addons/Extension_Signing
What I don't understand is why Selenium people cannot get a signature for the current Selenium driver??
Firefox version 47.0 has a bug that does not allow to use it with Selenium. This bug has been fixed in version 47.0.1.
Firefox versions from 48.0 and above do not install the old Selenium driver anymore. They must be automated with Marionette (= Gecko) driver.
The problem is that Marionette is still beta and has a lot of missing features so there is currently no solution to automate the new Firefox versions.
As you see here the new driver is full of bugs: https://developer.mozilla.org/en-US/docs/Mozilla/QA/Marionette/WebDriver/status
If Upgrading Webdriver doesn't help you can downgrade FireFox that will solve issue.
Which version of Selenium IDE you are using? Try downgrading the Firefox version. The release notes of selenium IDE is mentioned in below link.
https://code.google.com/p/selenium/wiki/SeIDEReleaseNotes
Hope this helps.
Install all the updates in your Nuget package manager. Restart IDE.
Downgrading firefox version is not recommended for testing. But last but one version downgrade sounds good.
This solution worked for me.

Categories

Resources