Coded UI Test Selenium Chrome Driver - google-chrome

Selenium chromedriver;
The open chrome driver window displays:
Starting ChromeDriver (v2.8.241075) on port 10820
[8804:7492:0110/155544:ERROR:chrome_views_delegate.cc(176)] NOT IMPLEMENTED
[8804:7492:0110/155544:ERROR:desktop_root_window_host_win.cc(746)] NOT IMPLEMENTED
[8804:7492:0110/155544:ERROR:desktop_root_window_host_win.cc(746)] NOT IMPLEMENTED
Windows 8
ChromeDriver 2.8
Selenium 2.39
Chrome version 32.0.1700.102 m
Coded UI Test;
BrowserWindow.CurrentBrowser = "chrome";
var browser = BrowserWindow.Launch(new Uri("http://www.google.com"));
...

To run a chrome driver refer below code.
You can download the driver from
http://chromedriver.storage.googleapis.com/index.html
Step 1 :
System.setProperty("webdriver.chrome.driver",driverPath+"\\chromedriver.exe");
Step 2
ChromeDriver driver = new ChromeDriver();
driver.get(YOUR_URL_HERE)

In C#, you have to write following code:
IWebDriver driver = new ChromeDriver("fullpath to chrome driver exe");
driver.Navigate().GoToUrl("http://www.google.com");
You can download the Chrome Driver from this URL:
https://sites.google.com/a/chromium.org/chromedriver/downloads

Change the url to https://www.google.com.
Right now you are using http://www.google.com

Related

Downgrade chromedriver version during runtime using webdrivermanager

Problem:
Facing an issue to downgrade chrome driver version during runtime.
Background:
Using chrome + Docan(needs chrome driver with v2.33) to do automation test of an application.
First, start chrome with driver version: 91.0.4472.124.
Then, switch to Docan which needs chrome driver with version 2.33.
Code:
WebDriverManager webDriverManager = null;
Initial:
webDriverManager = WebDriverManager.chromedriver();
Switch:
WebDriverManager.chromedriver().clearResolutionCache();
webDriverManager = WebDriverManager.chromedriver().driverVersion("2.33");
webdriver.avoidBrowserDetection();
Behavior:
After switch:
System.getProperty("webdriver.chrome.driver") --> return path for version 2.33
In log:
I could see chromedriver version is still 91
UI action:
Docan is not fully supported for actions like click.(It supports fine if driver is 2.33, tried with IE + Docan)
Is there any suggestion to make it work?

Chrome browser doesn't open in kiosk mode using Selenium WebDriver

I am using Selenium WebDriver with chrome browser and for whatever reason, it doesn't open in kiosk mode. This used to work, not sure why it stopped.
This is my code:
private IWebDriver GetChromeDriver(BrowserConfigurationOptions browserConfigOptions)
{
var options = new ChromeOptions();
options.AddArguments("disable-infobars");
options.AddUserProfilePreference("credentials_enable_service", false);
if (browserConfigOptions.KioskModeForChrome)
options.AddArgument("--kiosk"); //options.AddArgument("--enable-kiosk-mode");
LogChromeOptions(options);
return new ChromeDriver(options);
}
This is my environment:
Chrome 66
Selenium WebDriver v 3.11.2
Chromedriver version 2.38.0.1 from this Nuget package
I've tried passing in --kiosk and --enable-kiosk-mode with no success.
To initialize the Chrome Browser in Kiosk Mode you need to pass the following argument through an instance of ChromeOptions class:
ChromeOptions options = new ChromeOptions();
options.addArguments("--kiosk");
return new ChromeDriver(options);
Note A : As per Java Doc, it is arguments are passed as addArguments()
Note B : As per Peter Beverloo
--kiosk:
Enables kiosk mode. Please note this is not Chrome OS kiosk mode.
Sample Code(Java):
System.setProperty("webdriver.chrome.driver", "C:\\Utility\\BrowserDrivers\\chromedriver.exe");
ChromeOptions options = new ChromeOptions();
options.addArguments("--kiosk");
WebDriver driver = new ChromeDriver(options);
driver.get("https://www.google.com/");
Browser Snapshot:
After seeing that everyone had this working except me, I started digging further. After digging into the code I found
Driver.Manage().Window.Maximize();
being called after initialization of the driver. After removing this line of code, I was able to open Chrome in kiosk mode with the solution above.
Config issue as Chrome 66 is supported by Chromedriver 2.38 and you're using 2.18
Please update from below.
http://chromedriver.chromium.org/downloads

Chrome - org.openqa.selenium.WebDriverException: unknown error: cannot get automation extension at driver.manage().window().maximize();

I am stuck with a very unusual kind of error thrown by Chrome Browser
When I try to do maximize chrome with below line of code
driver.manage().window().maximize();
I am getting below error
org.openqa.selenium.WebDriverException: unknown error: cannot get automation extension
from unknown error: page could not be found: chrome-extension://aapnijgdinlhnhlmodcfapnahmbfebeb/_generated_background_page.html
(Session info: chrome=57.0.2987.110)
(Driver info: chromedriver=2.27.440174 (e97a722caafc2d3a8b807ee115bfb307f7d2cfd9),platform=Windows NT 6.3.9600 x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 10.05 seconds
By going through this example I did the below things
1. Updated Chrome driver to latest i.e 2.28 for my Chrome version
57.0.2987.110 (64-bit)
2. uninstalled and re-installed Chrome
3. did a project build up in Eclipse even created a new workspace
but nothing helped so I used
ChromeOptions options = new ChromeOptions();
options.addArguments("start-maximized");
driver = new ChromeDriver();
it worked and Chrome driver showed no error but whenever I execute some piece of code like filling a form or clicking some button after that it still throws the above error after some time.
In general the reason you see WebDriverException: unknown error: cannot get automation extension can be numerous. The two most common cases to see this exception is :
Mismatch between chromedriver binary and Chrome Browser binary versions. Solution : Follow the ChromeDriver Release Notes
Using driver.manage().window().maximize(); to maximize the Chrome Browser. Solution : Use ChromeOptions.addArguments("start-maximized"); to maximize the Chrome Browser.
As per your question the exception seems to be coming from one of the above cases.
Try out the following steps:
Kill all the chromedriver instances running in your windows Task Manager.
Use CCleaner tool to wipe out all the OS chores.
Clean all the projects in Eclipse.
Reboot your system once.
Provide the following options to start your Chrome browser:
ChromeOptions options = new ChromeOptions();
options.addArguments("test-type");
options.addArguments("start-maximized");
options.addArguments("disable-infobars");
options.addArguments("--disable-extensions");
driver = new ChromeDriver(options);
Your program should work with latest chrome driver 2.28 & Chrome Version 57.0.2987.110 (64-bit). Let me know if this helps you.
I had the same issue before, remember fixing it by adding this:
ChromeOptions chromeOptions = new ChromeOptions();
chromeOptions.addArguments("no-sandbox");
//Fix for cannot get automation extension
chromeOptions.addArguments("disable-extensions");
chromeOptions.addArguments("--start-maximized");

"cannot get automation extension" error with chrome 54.0.2840.71

protractor version : 1.5.0
chrome version : 54.0.2840.71 m (64-bit)
protractor failed to launch chrome with the following error:
Using ChromeDriver directly...
[launcher] Running 1 instances of WebDriver
[launcher] Error: UnknownError: unknown error: cannot get automation extension
Check your chromeDriver Version and confirm weather it is compatible with your chorme version.
And check this : https://sites.google.com/a/chromium.org/chromedriver/downloads
worked for me like a charm:
npm update protractor -g (globally update protractor)
webdriver-manager update
ChromeOptions options = new ChromeOptions();
options.addArguments("start-maximized"); System.setProperty("webdriver.chrome.driver","/Users/vedavyasa/bank_emulation/test/lib/chromedriver");
webDriver = new ChromeDriver(options);

System hangs while using chromedriver 2.20 for chrome browser automation

I am using chromedriver 2.20 for chrome browser automation. But system hangs when the execution starts. Tried with chromedriver 2.19 also.
Driver initialization:
System.setProperty("webdriver.chrome.driver", rootDir+ "/resources/drivers/chromedriver.exe");
driver = new ChromeDriver();
driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
driver.manage().deleteAllCookies();
System Config:
Intel core i7 processor, 64bit OS, RAM: 16GB
Please suggest any solution.
Not facing any issue with below sample code on Win 7, 64-bit. Please share chromedriver log
System.setProperty("webdriver.chrome.driver","/path/to/chromedriver.exe"));
WebDriver driver = new ChromeDriver();
driver.manage().timeouts().implicitlyWait(1, TimeUnit.MINUTES);
driver.manage().deleteAllCookies();
driver.get("http://www.google.com/");
System.out.println(driver.getTitle());