version info not a dictionary : chromeDriver : chrome 21 - google-chrome

I am trying to run a test using webdriver on chrome. I am getting this error message.
org.openqa.selenium.WebDriverException: unknown error: version info not a dictionary
(Driver info: chromedriver=2.9.248315,platform=Windows NT 6.1 SP1 x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 16.84 seconds
Build info: version: '2.31.0', revision: '1bd294d', time: '2013-02-27 20:53:56'
System info: os.name: 'Windows 7', os.arch: 'x86', os.version: '6.1', java.version: '1.6.0_23'
Driver info: org.openqa.selenium.chrome.ChromeDriver
The version details are :
Chrome 21.0.1180.60
selenium-server-standalone-2.33.0
ChromeDriver 22,29,0.8 (I've tried with all three versions and getting errors).
My code is as below:
public class Testing {
public static void main(String args[]) throws Exception {
try {
System.setProperty("webdriver.chrome.driver",
"E://eclipse_workspace//testSelPro//lib//chromedriver.exe");
ChromeDriverService service = new ChromeDriverService.Builder()
.usingDriverExecutable(
new File(
"E://eclipse_workspace//testSelPro//lib//chromedriver.exe"))
.usingAnyFreePort().build();
service.start();
DesiredCapabilities capability = DesiredCapabilities.chrome();
WebDriver driver = new ChromeDriver(service, capability);
driver.get("http://www.google.com");
driver.close();
} catch (Exception e) {
System.out.println(e);
}
}
I have a limitation of running the scripts on Chrome 21 only as application is required to be certified on the same version. Also, I do not have the liberty to move to older versions of selenium as other application(s) require latest webdriver version on the framework.

Related

Unable to Attach remote debugger to Chrome headless in Selenium WebDriver

I'm running my E2E test cases using Selenium WebDriver with Chrome headless. this configuration working fine and able run test case.
My code looks like this:
const options = {
desiredCapabilities: {
port: PORT,
browserName: 'chrome',
chromeOptions: {
args: ['disable-infobars'
,'headless',
'disable-gpu',
],
//binary: '/Applications/Google Chrome Dev.app/Contents/MacOS/Google Chrome'
binary: '/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome'
}
},
host: envConfig.seleniumUrl,
deprecationWarnings: false
};
this.browser = webdriverio
.remote(options)
.init()
.url(envConfig.appUrl)
.timeouts('script', 35000)
.timeouts('implicit', 35000);
Some of my test case failing so i am trying to attach chrome debugger using chrome launch option
--remote-debugging-port=9222
https://developers.google.com/web/updates/2017/04/headless-chrome
After adding remote debugging port flag My E2E failing and unable to start
const options = {
desiredCapabilities: {
port: PORT,
browserName: 'chrome',
chromeOptions: {
args: ['disable-infobars'
,'headless',
'disable-gpu',
'--remote-debugging-port=5552'
],
//binary: '/Applications/Google Chrome Dev.app/Contents/MacOS/Google Chrome'
binary: '/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome'
}
},
host: envConfig.seleniumUrl,
deprecationWarnings: false
};
Error is
chrome not reachable
(Driver info: chromedriver=2.36.540469 (1881fd7f8641508feb5166b7cae561d87723cfa8),platform=Mac OS X 10.12.6 x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 60.09 seconds
Build info: version: '3.8.1', revision: '6e95a6684b', time: '2017-12-01T19:05:32.194Z'
System info: host: 'xxxxxx', ip: 'xxxxxx', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.12.6', java.version: '1.8.0_161'
Driver info: driver.version: unknownError: An unknown server-side error occurred while processing the command.
at end() - hooks.js:47:25
how to fix this initialization issue and how to attach chrome dev tools with headless browser.

getting error when run the `protractor` using chrome

I ma trying to run the protractor using chrome but i am getting error as :
protractor config.js
[15:54:58] I/launcher - Running 1 instances of WebDriver
[15:54:59] I/local - Starting selenium standalone server...
[15:55:01] I/local - Selenium standalone server started at http://172.18.32.112:51073/wd/hub
[15:56:06] E/launcher - chrome not reachable
(Driver info: chromedriver=2.30.477700 (0057494ad8732195794a7b32078424f92a5fce41),platform=Windows NT 10.0.10240 x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 60.51 seconds
Build info: version: '3.4.0', revision: 'unknown', time: 'unknown'
System info: host: 'INCHCMLP01756', ip: '172.18.32.112', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_66'
Driver info: driver.version: ChromeDriver
how to fix this?
here is my config file :
exports.config = {
framework : "jasmine",
capabilities : {
browserName : "chrome"
},
specs : ["spec.js"]
}
Thanks in advance.
You can try this? It worked for me with chrome version 58.
exports.config = {
framework : "jasmine",
capabilities : {
browserName : "chrome",
},
directConnect: true,
chromeDriver: "C:/Path/to/chromedriver.exe",
specs : ["spec.js"]
}

Selenium chromedriver unknown error while running chrome 59 headless with browsermob proxy

I wrote a simple Selenium test (opening a page) of a secured site in a headless mode using Chrome 59 beta version.
I'm getting an the following exception while executing my code. The exception is thrown while initializing the driver
When I rerun my script after commenting the headless option (options.addArguments("headless")) it shows Chrome and running fine but my objective is to run it as headless. Could you please provide your thoughts on resolving my problem?
Exception:
Starting ChromeDriver 2.29.461585 (0be2cd95f834e9ee7c46bcc7cf405b483f5ae83b) on port 4971
Only local connections are allowed.
Exception in thread "main" org.openqa.selenium.WebDriverException: unknown error: Chrome failed to start: exited abnormally
(Driver info: chromedriver=2.29.461585 (0be2cd95f834e9ee7c46bcc7cf405b483f5ae83b),platform=Mac OS X 10.12.2 x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 60.14 seconds
Build info: version: '3.4.0', revision: 'unknown', time: 'unknown'
Here are the steps:
I'm using Scala with SBT on Mac.
Chrome 59 beta version
ChromeDrive 2.29 release version.
Added the following dependencies
"org.seleniumhq.selenium" % "selenium-chrome-driver" % "3.4.0"
"org.seleniumhq.selenium" % "selenium-support" % "3.4.0"
"net.lightbody.bmp" % "browsermob-core" % "2.1.4"
Scala Code:
val username = "username"
val password = "password"
val domainname = "yoursecuredomain.com"
val browserMobProxyServer = new BrowserMobProxyServer()
browserMobProxyServer.start(0)
browserMobProxyServer.autoAuthorization(domainname, username, password, AuthType.BASIC)
val seleniumProxy = ClientUtil.createSeleniumProxy(browserMobProxyServer)
val options = new ChromeOptions()
options.addArguments("headless")
options.addArguments("--disable-gpu")
options.setBinary("""/Applications/Google Chrome.app/Contents/MacOS/Google Chrome""")
val desiredCapabilities = new DesiredCapabilities()
desiredCapabilities.setCapability(ChromeOptions.CAPABILITY, options)
desiredCapabilities.setCapability(CapabilityType.PROXY, seleniumProxy)
val driver: WebDriver = new ChromeDriver(desiredCapabilities)
val baseUrlString = s"""https://$domainname"""
driver.navigate().to(baseUrlString)
Thread.sleep(3000)
println("title: " + driver.getTitle)
driver.quit()
browserMobProxyServer.abort()
According to the 2.29 webdriver notes page, It says that
----------ChromeDriver v2.29 (2017-04-04)----------
Supports Chrome v56-58
so u have to downgrade your chrome version to be compatible with the latest chrome webdriver.
source:
https://chromedriver.storage.googleapis.com/2.29/notes.txt

no such session exception while Loading Default/Custom Chrome Profile to run tests using Selenium WebDriver

I am loading custom profile of chrome by using following code:
ChromeDriverService chSvc = new ChromeDriverService.Builder().usingDriverExecutable(new File("C://Users//kanu//Downloads//Selenium//chromedriver_win32//chromedriver.exe")).usingAnyFreePort().build();
ChromeOptions chOption = new ChromeOptions();
/**
* "user-data-dir = profilepath" --to open profile
* "--start-maximized" for maximize the browser
*/
chOption.addArguments("user-data-dir = C:/Users/kanu/AppData/Local/Google/Chrome/New User");
chOption.addArguments("--start-maximized");
WebDriver driver = new ChromeDriver(chSvc, chOption);
driver.get("https://www.google.com");
it works and run the existing profile of chrome but is not opening the desired url and getting following exception :
Starting ChromeDriver 2.27.440174 (e97a722caafc2d3a8b807ee115bfb307f7d2cfd9) on port 43388
Only local connections are allowed.
Mar 15, 2017 10:55:27 AM org.openqa.selenium.remote.ProtocolHandshake createSession
INFO: Detected dialect: OSS
Exception in thread "main" org.openqa.selenium.NoSuchSessionException: no such session
(Driver info: chromedriver=2.27.440174 (e97a722caafc2d3a8b807ee115bfb307f7d2cfd9),platform=Windows NT 10.0.10586 x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 8 milliseconds
Build info: version: '3.3.1', revision: '5234b32', time: '2017-03-10 09:04:52 -0800'
System info: host: 'GUR-ACC093-W', ip: '100.102.83.217', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_102'
Driver info: org.openqa.selenium.chrome.ChromeDriver
Capabilities [{message=unknown error: Chrome failed to start: crashed
(Driver info: chromedriver=2.27.440174 (e97a722caafc2d3a8b807ee115bfb307f7d2cfd9),platform=Windows NT 10.0.10586 x86_64), platform=ANY}]
Session ID: ea04006993fa5bd7530cfe75cca7ae0d
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:216)
at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:168)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:638)
at org.openqa.selenium.remote.RemoteWebDriver.get(RemoteWebDriver.java:325)
at launch.LaunchChrome.main(LaunchChrome.java:50)
Can anyone please resolve this?

TestNG Execution stops executing, when exception occurs, for NoSuchElement Found

Running a TestNG testcase in Eclipse, and getting the values from Ui, using attribute("value").
BUt while execution, if the webelement is not present/Found on UI, I need to take the UIvalue = 00:00.
try {
UIValue = driver.findElement(By.id("ctl00_MainContent_AllowanceGridView_SRow"+cellRosterPerioddd+cellRosterPeriodmm+"_"+PayBucket)).getAttribute("value");
// UIValue = WebelementforUIvalue;
}
catch (NoSuchElementException e) {
UIValue ="00.00";
}
But, When webelement is not Found, the execution stops, I do not want the execution to be stoppedm for the exceptions ?
#Stijn
The execution runs, when the WebElements are found on UI, but it thorws 'No such Element' and stops execution, if the web element is not present on UI, in such cases, need to take the value as '00:00'
# niharika_neo, Here is the Stack Trace below
{code}
Excel PayBucket:JRM1
Excel PayBucket Value:03:40
UI PayBucket:[[ChromeDriver: chrome on XP (0a57a30b08559c4aa0fe4124c5950760)] -> id: ctl00_MainContent_AllowanceGridView_SRow2812_JRM1]
03:52
Failed
Excel PayBucket:VOTPY
Excel PayBucket Value:02:01
UI PayBucket:[[ChromeDriver: chrome on XP (0a57a30b08559c4aa0fe4124c5950760)] -> id: ctl00_MainContent_AllowanceGridView_SRow2102_VOTPY]
03:52
Failed
Excel PayBucket:VOTFA
Excel PayBucket Value:02:00
no such element
(Session info: chrome=39.0.2171.71)
(Driver info: chromedriver=2.10.267521,platform=Windows NT 6.1 SP1 x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 25 milliseconds
For documentation on this error, please visit: http://seleniumhq.org/exceptions/no_such_element.html
Build info: version: '2.42.2', revision: '6a6995d', time: '2014-06-03 17:42:03'
System info: host: 'rainmaker2011-5', ip: '192.168.8.70', os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.7.0'
Session ID: 0a57a30b08559c4aa0fe4124c5950760
Driver info: org.openqa.selenium.chrome.ChromeDriver
Capabilities [{platform=XP, acceptSslCerts=true, javascriptEnabled=true, browserName=chrome, chrome={userDataDir=C:\Users\LAKSHM~1.PAL\AppData\Local\Temp\scoped_dir14544_10752}, rotatable=false, locationContextEnabled=true, version=39.0.2171.71, takesHeapSnapshot=true, cssSelectorsEnabled=true, databaseEnabled=false, handlesAlerts=true, browserConnectionEnabled=false, nativeEvents=true, webStorageEnabled=true, applicationCacheEnabled=false, takesScreenshot=true}]
PASSED: IntegrationTests
{code}