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"]
}
Related
I am new to protractor ,as well as automation testing. I ran my conf.js file but the process terminate with below error related to chorme
error message
$$> protractor conf.js
[08:38:14] I/launcher - Running 1 instances of WebDriver
[08:38:14] I/direct - Using ChromeDriver directly...
**
[08:39:14] E/launcher - unknown error: Chrome failed to start: exited
abnormally (Driver info: chromedriver=2.37.544315
(730aa6a5fdba159ac9f4c1e8cbc59bf1b5ce12b7),platform=Linux
3.10.0-1062.1.1.el7.x86_64 x86_64) [08:39:14] E/launcher - WebDriverError: unknown error: Chrome failed to start: exited
abnormally (Driver info: chromedriver=2.37.544315
(730aa6a5fdba159ac9f4c1e8cbc59bf1b5ce12b7),platform=Linux
3.10.0-1062.1.1.el7.x86_64 x86_64)
**
at Object.checkLegacyResponse (/usr/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/error.js:546:15)
at parseHttpResponse (/usr/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/http.js:509:13)
at doSend.then.response (/usr/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/http.js:441:30)
at process._tickCallback (internal/process/next_tick.js:68:7)
From: Task: WebDriver.createSession()
at Function.createSession (/usr/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver.js:769:24)
at Function.createSession (/usr/lib/node_modules/protractor/node_modules/selenium-webdriver/chrome.js:761:15)
at Direct.getNewDriver (/usr/lib/node_modules/protractor/built/driverProviders/direct.js:77:33)
at Runner.createBrowser (/usr/lib/node_modules/protractor/built/runner.js:195:43)
at q.then.then (/usr/lib/node_modules/protractor/built/runner.js:339:29)
at _fulfilled (/usr/lib/node_modules/protractor/node_modules/q/q.js:834:54)
at /usr/lib/node_modules/protractor/node_modules/q/q.js:863:30
at Promise.promise.promiseDispatch (/usr/lib/node_modules/protractor/node_modules/q/q.js:796:13)
at /usr/lib/node_modules/protractor/node_modules/q/q.js:556:49
at runSingle (/usr/lib/node_modules/protractor/node_modules/q/q.js:137:13)
[08:39:14] E/launcher - Process exited with error code 199
I have tried all possible solutions ,
From upgrading chrome to 59x version to downgrading it to 2.37 version
adding extras like below to conf.js file
directConnect: true,
useAllAngular2AppRoots:true,
capabilities: {
browserName: 'chrome',
chromeOptions: {
'args':['--no-sandbox']
}
}
conf.js
exports.config = {
directConnect: true,
framework: 'jasmine',
// seleniumAddress: 'http://localhost:4444/wd/hub',
specs: ['spec.js'],
capabilities: {
browserName: 'chrome',
chromeOptions: {
'args': ['--no-sandbox']
}
},
useAllAngular2AppRoots: true
}
could someone please help me make this work.
Thank you
(new to post questions on stackoverflow as well :b)
The main error here is that your chrome is failing to start a session. This happens if the chrome version being downloaded is the latest beta version. This is a bug in the latest protractor package which is being looked into for the protractor 6 release with backwards compatibility with webdriver-manager. For this you will have to fix the version of the chromedriver.
How are you running your webdriver manager update? Do not use the globally installed protractor to run your tests, use the protractor from node modules. Do the same thing when using webdriver manager update. Use a fix version like ./node_modules/protractor/bin/webdriver-manager update --standalone --versions.standalone=3.8.0 --chrome --versions.chrome=78.0.3904.97
Add this to your scripts in package.json.
Add jasmine options in your configuration file:
jasmineNodeOpts: {
showColors: true,
defaultTimeoutInterval: 260000,
isVerbose: true,
includeStackTrace: true,
}
I don't think the latter would help but try updating the webdriver manager with the fix version and let me know how that goes.
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.
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?
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}
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.