I have been using selenium webdriver with protractor for more than a year now and recently after updating to the newest versions i got an error that i have never encountered before.
As stated in the title my error is
WebDriver Error Cannot use 'in' operator to search for 'String' in false
I am doing everything in the code as always, but even my old tests which were working correctly and were used everyday, don't work now. The tests starts and navigate to the page correctly(which is the first step in the test), but everything after that fails no matter if it is only clicking, or typing.
I tried searching everywhere, but did not find someone having the same problem as me. Please help.
Here is my code. The spec.ts file:
describe('102001 - External Payments - own portfolio; recurring - no end date', function () {
var LoginPage = require('./Page/Login_Page/Login_page.js');
var OverviewPage = require('./Page/Overview_Page/Overview_page.js');
var BeleggenPage = require('./Page/Beleggen_Page/Beleggen_Page.js');
var BepaalJeKennisprofielPage = require('./Page/BepaalJeKennisprofiel_Page/BepaalJeKennisprofiel_Page.js');
var AcepteerDeVoorwaardenPage = require('./Page/AcepteerDeVoorwaarden_Page/AcepteerDeVoorwaarden_Page.js');
var BepaalJeInlegPage = require('./Page/BepaalJeInleg_Page/BepaalJeInleg_Page.js');
var date = new Date().getTime() / 1000;
var uniqueIdentifier = date.toString();
.
afterEach(function () {
browser.driver.sleep(1000);
});
it('Should go to the login page', function () {
browser.ignoreSynchronization = true;
LoginPage.goToPage();
browser.ignoreSynchronization = false;
});
it('Should hide the cookie bar', function () {
LoginPage.hideCookieBar();
});
it('Should set username', function () {
LoginPage.setUsername('mseykov');
});
it('Should set password', function () {
LoginPage.setPassword('Welkom2015');
});
it('Should click login', function () {
LoginPage.clickLogin();
});
it('Should click OK on the pop up', function () {
LoginPage.closePopUp();
});
});
The associated page file:
var LoginPage = function () {
this.goToPage = function () {
browser.get('https://k2-vat.virtual-affairs.nl');
};
this.hideCookieBar = function () {
element(by.css('.cookies-bar-text>.btn-clean')).click();
};
this.setUsername = function (value) {
element(by.id('safeName')).sendKeys(value);
};
this.setPassword = function (value) {
element(by.id('Password')).sendKeys(value);
};
this.clickLogin = function () {
element(by.css('button[type="submit"]')).click();
};
this.closePopUp = function () {
element(by.css('.btn.btn-primary.btn-xs-block')).click();
};
};
module.exports = new LoginPage();
And the config file:
var HtmlScreenshotReporter = require('protractor-jasmine2-screenshot-reporter');
var reporter = new HtmlScreenshotReporter({
dest: 'target/screenshots_chrome',
filename: 'my-report.html'
});
exports.config = {
framework: 'jasmine2',
seleniumAddress: 'http://localhost:4444/wd/hub',
specs: ['spec.js'],
capabilities: {
browserName: 'chrome'
},
beforeLaunch: function () {
return new Promise(function (resolve) {
reporter.beforeLaunch(resolve);
});
},
//multiCapabilities: [{
// 'browserName': 'chrome'
//}, {
// 'browserName': 'firefox'
//}],
//capabilities: {
// browserName: 'phantomjs',
// 'phantomjs.binary.path': require('phantomjs').path
//},
onPrepare: function () {
jasmine.getEnv().addReporter(reporter);
browser.driver.manage().window().maximize();
//browser.manage().timeouts().pageLoadTimeout(10000);
//browser.manage().timeouts().implicitlyWait(10000);
//allScriptsTimeout: 10000;
//getPageTimeout: 10000;
},
afterLaunch: function (exitCode) {
return new Promise(function (resolve) {
reporter.afterLaunch(resolve.bind(this, exitCode));
});
}
};
Full error message for first step:
Failures:
1) 101001 - Internal payment - own portfolio; not recurring - today (current to current account) Should set username
Message:
Failed: unknown error: Cannot use 'in' operator to search for 'String' in false
(Session info: chrome=55.0.2883.87)
(Driver info: chromedriver=2.26.436362 (5476ec6bf7ccbada1734a0cdec7d570bb042aa30),platform=Windows NT 10.0.10240 x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 32 milliseconds
Build info: version: '2.53.1', revision: 'a36b8b1', time: '2016-06-30 17:37:03'
System info: host: 'mseykov', ip: '10.10.9.80', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_111'
Driver info: org.openqa.selenium.chrome.ChromeDriver
Capabilities [{applicationCacheEnabled=false, rotatable=false, mobileEmulationEnabled=false, networkConnectionEnabled=false, chrome={chromedriverVersion=2.26.436362 (5476ec6bf7ccbada1734a0cdec7d570bb042aa30), userDataDir=C:\Users\mseykov\AppData\Local\Temp\scoped_dir6988_30004}, takesHeapSnapshot=true, pageLoadStrategy=normal, databaseEnabled=false, handlesAlerts=true, hasTouchScreen=false, 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, unexpectedAlertBehaviour=}]
Session ID: 46d8538fb4a3edb4b58c8201bf8e4710
*** Element info: {Using=css selector, value=*[id="safeName"]}
Stack:
WebDriverError: unknown error: Cannot use 'in' operator to search for 'String' in false
(Session info: chrome=55.0.2883.87)
(Driver info: chromedriver=2.26.436362 (5476ec6bf7ccbada1734a0cdec7d570bb042aa30),platform=Windows NT 10.0.10240 x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 32 milliseconds
Build info: version: '2.53.1', revision: 'a36b8b1', time: '2016-06-30 17:37:03'
System info: host: 'mseykov', ip: '10.10.9.80', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_111'
Driver info: org.openqa.selenium.chrome.ChromeDriver
Capabilities [{applicationCacheEnabled=false, rotatable=false, mobileEmulationEnabled=false, networkConnectionEnabled=false, chrome={chromedriverVersion=2.26.436362 (5476ec6bf7ccbada1734a0cdec7d570bb042aa30), userDataDir=C:\Users\mseykov\AppData\Local\Temp\scoped_dir6988_30004}, takesHeapSnapshot=true, pageLoadStrategy=normal, databaseEnabled=false, handlesAlerts=true, hasTouchScreen=false, 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, unexpectedAlertBehaviour=}]
Session ID: 46d8538fb4a3edb4b58c8201bf8e4710
*** Element info: {Using=css selector, value=*[id="safeName"]}
at Object.checkLegacyResponse (C:\Users\mseykov\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\error.js:639:15)
at parseHttpResponse (C:\Users\mseykov\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\http\index.js:538:13)
at client_.send.then.response (C:\Users\mseykov\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\http\index.js:472:11)
at ManagedPromise.invokeCallback_ (C:\Users\mseykov\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\promise.js:1379:14)
at TaskQueue.execute_ (C:\Users\mseykov\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\promise.js:2913:14)
at TaskQueue.executeNext_ (C:\Users\mseykov\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\promise.js:2896:21)
at asyncRun (C:\Users\mseykov\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\promise.js:2820:25)
at C:\Users\mseykov\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\promise.js:639:7
at process._tickCallback (internal/process/next_tick.js:103:7)
From: Task: WebDriver.findElements(By(css selector, *[id="safeName"]))
at WebDriver.schedule (C:\Users\mseykov\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\webdriver.js:377:17)
at WebDriver.findElements (C:\Users\mseykov\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\webdriver.js:926:22)
at C:\Users\mseykov\AppData\Roaming\npm\node_modules\protractor\built\element.js:173:44
at ManagedPromise.invokeCallback_ (C:\Users\mseykov\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\promise.js:1379:14)
at TaskQueue.execute_ (C:\Users\mseykov\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\promise.js:2913:14)
at TaskQueue.executeNext_ (C:\Users\mseykov\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\promise.js:2896:21)
at asyncRun (C:\Users\mseykov\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\promise.js:2775:27)
at C:\Users\mseykov\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\promise.js:639:7
at process._tickCallback (internal/process/next_tick.js:103:7)Error
at ElementArrayFinder.applyAction_ (C:\Users\mseykov\AppData\Roaming\npm\node_modules\protractor\built\element.js:461:27)
at ElementArrayFinder._this.(anonymous function) [as sendKeys] (C:\Users\mseykov\AppData\Roaming\npm\node_modules\protractor\built\element.js:103:30)
at ElementFinder.(anonymous function) [as sendKeys] (C:\Users\mseykov\AppData\Roaming\npm\node_modules\protractor\built\element.js:829:22)
at LoginPage.setUsername (D:\Knab\KnabInternalPayments\InternalPayments_OwnPortfolio_NotRecurring_Today\Page\Login_Page\Login_Page.ts:8:36)
at Object.<anonymous> (D:\Knab\KnabInternalPayments\InternalPayments_OwnPortfolio_NotRecurring_Today\spec.ts:25:19)
at C:\Users\mseykov\AppData\Roaming\npm\node_modules\protractor\node_modules\jasminewd2\index.js:94:23
at new ManagedPromise (C:\Users\mseykov\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\promise.js:1082:7)
at controlFlowExecute (C:\Users\mseykov\AppData\Roaming\npm\node_modules\protractor\node_modules\jasminewd2\index.js:80:18)
at TaskQueue.execute_ (C:\Users\mseykov\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\promise.js:2913:14)
at TaskQueue.executeNext_ (C:\Users\mseykov\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\promise.js:2896:21)
From: Task: Run it("Should set username") in control flow
at Object.<anonymous> (C:\Users\mseykov\AppData\Roaming\npm\node_modules\protractor\node_modules\jasminewd2\index.js:79:14)
From asynchronous test:
Error
at Suite.<anonymous> (D:\Knab\KnabInternalPayments\InternalPayments_OwnPortfolio_NotRecurring_Today\spec.ts:23:5)
at Object.<anonymous> (D:\Knab\KnabInternalPayments\InternalPayments_OwnPortfolio_NotRecurring_Today\spec.ts:1:1)
at Module._compile (module.js:571:32)
at Object.Module._extensions..js (module.js:580:10)
at Module.load (module.js:488:32)
at tryModuleLoad (module.js:447:12)