I am getting an webDriver exception while get windowHandle.
org.openqa.selenium.WebDriverException: Unknown sessionId: 364337eb-405e-49fa-aa75-d048f10cb52c
Command duration or timeout: 548 milliseconds
Build info: version: '3.0.1', revision: '1969d75', time: '2016-10-18 09:49:13 -0700'
System info: host: 'II5MACMINI-04.local', ip: '169.254.122.119', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.12.3', java.version: '1.8.0_111'
Driver info: org.openqa.selenium.remote.RemoteWebDriver
Capabilities [{applicationCacheEnabled=false, rotatable=false, mobileEmulationEnabled=false, networkConnectionEnabled=false, chrome={chromedriverVersion=2.29.461591 (62ebf098771772160f391d75e589dc567915b233), userDataDir=C:\Users\you\AppData\Local\Temp\scoped_dir612_6018}, takesHeapSnapshot=true, pageLoadStrategy=normal, databaseEnabled=false, handlesAlerts=true, hasTouchScreen=false, version=58.0.3029.81, platform=XP, browserConnectionEnabled=false, nativeEvents=true, acceptSslCerts=true, webdriver.remote.sessionid=364337eb-405e-49fa-aa75-d048f10cb52c, locationContextEnabled=true, webStorageEnabled=true, browserName=chrome, takesScreenshot=true, javascriptEnabled=true, cssSelectorsEnabled=true, unexpectedAlertBehaviour=}]
Session ID: 364337eb-405e-49fa-aa75-d048f10cb52c
I am executing my test case on crossbrowsertesting.com
Here is line of code where I am getting an error.
String parentHandle = driver.getWindowHandle();
CBT disconnects your session after a certain amount of time has elapsed (somewhere around 5 mins) Try to make your tests shorter.
Related
I am facing the problem while executing the code to maximize the window.
Below is the error message:
unknown error: cannot get automation extension
from unknown error: page could not be found: chrome-extension://aapnijgdinlhnhlmodcfapnahmbfebeb/_generated_background_page.html
(Session info: chrome=58.0.3029.110)
(Driver info: chromedriver=2.25.426923 (0390b88869384d6eb0d5d09729679f934aab9eed),platform=Windows NT 6.3.9600 x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 10.03 seconds
Build info: version: '2.53.0', revision: '35ae25b', time: '2016-03-15 16:57:40'
System info: host: 'SDN-117', ip: '172.10.189.52', os.name: 'Windows 8.1', os.arch: 'amd64', os.version: '6.3', java.version: '1.8.0_73'
Driver info: org.openqa.selenium.chrome.ChromeDriver
Capabilities [{applicationCacheEnabled=false, rotatable=false, mobileEmulationEnabled=false, networkConnectionEnabled=false, chrome={chromedriverVersion=2.25.426923 (0390b88869384d6eb0d5d09729679f934aab9eed), userDataDir=C:\Users\TANUJA~1\AppData\Local\Temp\scoped_dir9140_12941}, takesHeapSnapshot=true, pageLoadStrategy=normal, databaseEnabled=false, handlesAlerts=true, hasTouchScreen=false, version=58.0.3029.110, platform=WIN8_1, browserConnectionEnabled=false, nativeEvents=true, acceptSslCerts=true, locationContextEnabled=true, webStorageEnabled=true, browserName=chrome, takesScreenshot=true, javascriptEnabled=true, cssSelectorsEnabled=true}]
Session ID: 12757c3f618b72bfaffb8713a175d458
Kindly help me to sort out the problem.
Here is the Answer to your Question:
To maximize Google Chrome browser window it is recommended to use ChromeOptions class instead of driver.manage().window().maximize();. Here is the sample code for your reference:
System.setProperty("webdriver.chrome.driver", "C:\\Utility\\BrowserDrivers\\chromedriver.exe");
ChromeOptions options = new ChromeOptions();
options.addArguments("test-type");
options.addArguments("start-maximized");
options.addArguments("disable-infobars");
WebDriver driver = new ChromeDriver(options);
Let me know if this Answers your Question.
My test case is to click on any link of a webpage. I am getting all the links and operation is performed successfully, but when i try to click on some of them then it gives following Exception
Exception in thread "main" org.openqa.selenium.ElementNotVisibleException: element not visible
(Session info: chrome=56.0.2924.87)
(Driver info: chromedriver=2.28.455520 (cc17746adff54984afff480136733114c6b3704b),platform=Windows NT 6.3.9600 x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 31 milliseconds
Build info: version: 'unknown', revision: '5234b32', time: '2017-03-10 09:00:17 -0800'
System info: host: 'ADMINPC', ip: '192.168.1.79', os.name: 'Windows 8.1', os.arch: 'amd64', os.version: '6.3', java.version: '1.8.0_121'
Driver info: org.openqa.selenium.chrome.ChromeDriver
Capabilities [{applicationCacheEnabled=false, rotatable=false, mobileEmulationEnabled=false, networkConnectionEnabled=false, chrome={chromedriverVersion=2.28.455520 (cc17746adff54984afff480136733114c6b3704b), userDataDir=C:\Users\admin\AppData\Local\Temp\scoped_dir1932_20343}, takesHeapSnapshot=true, pageLoadStrategy=normal, databaseEnabled=false, handlesAlerts=true, hasTouchScreen=false, version=56.0.2924.87, platform=WIN8_1, browserConnectionEnabled=false, nativeEvents=true, acceptSslCerts=true, locationContextEnabled=true, webStorageEnabled=true, browserName=chrome, takesScreenshot=true, javascriptEnabled=true, cssSelectorsEnabled=true, unexpectedAlertBehaviour=}]
Session ID: f622cb046f2dcc4e7ddd5621497cb602
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.RemoteWebElement.execute(RemoteWebElement.java:274)
at org.openqa.selenium.remote.RemoteWebElement.click(RemoteWebElement.java:84)
at newpackage.AllLinks.main(AllLinks.java:32)
This error means the link you are trying to click is not visible. Try to wait for the links to be displayed before clicking them.
while compiling cfg file we getting this error.
Failures:
1) Protractor Demo App should have a title
Message:
Failed: element not visible
(Session info: chrome=55.0.2883.87)
(Driver info: chromedriver=2.26.436362 (5476ec6bf7ccbada1734a0cdec7d570bb0
42aa30),platform=Windows NT 6.3.9600 x86_64) (WARNING: The server did not provid
e any stacktrace information)
Command duration or timeout: 120 milliseconds
Build info: version: '2.53.1', revision: 'a36b8b1', time: '2016-06-30 17:37:
03'
System info: host: 'Guest684', ip: '172.17.13.252', os.name: 'Windows 8.1',
os.arch: 'amd64', os.version: '6.3', java.version: '1.8.0_92'
Driver info: org.openqa.selenium.chrome.ChromeDriver
Capabilities [{applicationCacheEnabled=false, rotatable=false, mobileEmulati
onEnabled=false, networkConnectionEnabled=false, chrome={chromedriverVersion=2.2
6.436362 (5476ec6bf7ccbada1734a0cdec7d570bb042aa30), userDataDir=C:\Users\miracl
e\AppData\Local\Temp\scoped_dir9992_4680}, takesHeapSnapshot=true, pageLoadStrat
egy=normal, databaseEnabled=false, handlesAlerts=true, hasTouchScreen=false, ver
sion=55.0.2883.87, platform=WIN8_1, browserConnectionEnabled=false, nativeEvents
=true, acceptSslCerts=true, locationContextEnabled=true, webStorageEnabled=true,
browserName=chrome, takesScreenshot=true, javascriptEnabled=true, cssS`enter code here`electorsE
nabled=true, unexpectedAlertBehaviour=}]
Session ID: 9601e64df3743dbf5dc215bd39d4f528
Stack:
ElementNotVisibleError: element not visible
Please use protractor Configuration and Specification file for your protractor test.
Configuration file should have - Selenium Port address, Browser info and Specification file name
Specification file should have - Test Steps and Verification Part.
Dears stackoverflowers.
I have stuck with Selenium tests run locally.
ChromeDriver v2.7.236900 (32)
Chrome version Version 55.0.2883.87 m (64-bit)
Operation system is Windows 10 (64)
I just run this code:
open("http://anypage.com");
and get an error:
Using CustomChromeDriverProvider
Starting ChromeDriver (v2.7.236900) on port 3431
java.lang.IllegalArgumentException: org.openqa.selenium.remote.UnreachableBrowserException: Error communicating with the remote browser. It may have died.
Build info: version: '2.53.0', revision: '35ae25b1534ae328c771e0856c93e187490ca824', time: '2016-03-15 10:43:46'
System info: host: 'aliakseiPC', ip: '10.6.170.169', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_111'
Driver info: driver.version: RemoteWebDriver
Capabilities [{applicationCacheEnabled=false, rotatable=false, chrome={userDataDir=C:\Users\ALIAKS~1\AppData\Local\Temp\scoped_dir10772_6183}, takesHeapSnapshot=true, databaseEnabled=false, handlesAlerts=true, version=55.0.2883.87, platform=XP, browserConnectionEnabled=false, nativeEvents=true, acceptSslCerts=true, locationContextEnabled=true, webStorageEnabled=true, browserName=chrome, takesScreenshot=true, javascriptEnabled=true, cssSelectorsEnabled=true}]
Session ID: 4a396df3b78d4da050e77cc00f493f3a
I am using protractor to test angular 1.3.13 and ui-grid 3.0. All cells in grid are editable. In my tests I can get cell using following method:
dataCell: function( gridId, fetchRow, fetchCol ) {
var row = this.getGrid( gridId ).element(by.css('.ui-grid-render-container-body')).element( by.repeater('(rowRenderIndex, row) in rowContainer.renderedRows track by $index').row( fetchRow ) );
return row.element( by.repeater('(colRenderIndex, col) in colContainer.renderedColumns track by col.colDef.name').row( fetchCol ));
}
from https://github.com/angular-ui/ng-grid/blob/master/test/e2e/gridTestUtils.spec.js.
After I get first cell from first row, when I try to send value to cell
cell.click();
cell.sendKeys("newCellValue");
test breaks. I get following error message:
- Failed: unknown error: cannot focus element
(Session info: chrome=40.0.2214.115)
(Driver info: chromedriver=2.14.313457
(3d645c400edf2e2c500566c9aa096063e707c9cf),platform=Linux 3.13.0-49-generic x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 35 milliseconds
Build info: version: '2.45.0', revision: '5017cb8', time: '2015-02-26 23:59:50'
System info: host: 'xxxxxxxxx', ip: '127.0.1.1', os.name: 'Linux', os.arch: 'amd64', os.version: '3.13.0-49-generic', java.version: '1.8.0_40'
Driver info: org.openqa.selenium.chrome.ChromeDriver
Capabilities [{applicationCacheEnabled=false, rotatable=false, mobileEmulationEnabled=false, chrome={userDataDir=/tmp/.com.google.Chrome.LHfq2F}, takesHeapSnapshot=true, databaseEnabled=false, handlesAlerts=true, version=40.0.2214.115, platform=LINUX, browserConnectionEnabled=false, nativeEvents=true, acceptSslCerts=true, locationContextEnabled=true, webStorageEnabled=true, browserName=chrome, takesScreenshot=true, javascriptEnabled=true, cssSelectorsEnabled=true}]
Session ID: 50857fdfa10a4bc75444d21f2d04359e
(Session info: chrome=40.0.2214.115)
(Driver info: chromedriver=2.14.313457 (3d645c400edf2e2c500566c9aa096063e707c9cf),platform=Linux 3.13.0-49-generic x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 35 milliseconds
Build info: version: '2.45.0', revision: '5017cb8', time: '2015-02-26 23:59:50'
System info: host: 'xxxxxxxxx', ip: '127.0.1.1', os.name: 'Linux', os.arch: 'amd64', os.version: '3.13.0-49-generic', java.version: '1.8.0_40'
Driver info: org.openqa.selenium.chrome.ChromeDriver
Capabilities [{applicationCacheEnabled=false, rotatable=false, mobileEmulationEnabled=false, chrome={userDataDir=/tmp/.com.google.Chrome.LHfq2F}, takesHeapSnapshot=true, databaseEnabled=false, handlesAlerts=true, version=40.0.2214.115, platform=LINUX, browserConnectionEnabled=false, nativeEvents=true, acceptSslCerts=true, locationContextEnabled=true, webStorageEnabled=true, browserName=chrome, takesScreenshot=true, javascriptEnabled=true, cssSelectorsEnabled=true}]
Session ID: 50857fdfa10a4bc75444d21f2d04359e
at /usr/lib/node_modules/protractor/node_modules/jasminewd2/index.js:102:16
at [object Object].promise.ControlFlow.runInFrame_ (/usr/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/promise.js:1877:20)
at [object Object].promise.Callback_.goog.defineClass.notify (/usr/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/promise.js:2464:25)
at [object Object].promise.Promise.notify_ (/usr/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/promise.js:563:12)
The problem occurs when sendKeys method is called. Does anyone know the correct way to change cell value using protractor?
Solved it. You need to focus cell and access input element:
cell.click();
cell.element(by.css(".ui-grid-cell-focus input")).sendKeys("newCellValue");
EDIT:
Has some issues on older browser versions, better to use:
cell.click();
cell.element(by.css("input")).sendKeys("newCellValue");
EDIT:
Another issue is with Firefox where cell.click() is not working properly.
Workaround/hack: https://stackoverflow.com/a/23370177