I'm encountering a peculiar problem while running a functional test with Selenium (using the Intern.io framework) where only the first element is being recognized; any subsequent element I try to access throws an error:
Error: Error response status: 7
The error message translates to:
{summary:'NoSuchElement',
detail:'An element could not be located on the page using the given search parameters.'}
This issue is quite frustrating as I am certain that the element is present on the page.
Below is my simple failing functional test:
define([
'intern!object',
'intern/chai!assert',
'require'
], function (registerSuite, assert, require) {
registerSuite({
name: 'search',
'geocode search test': function () {
return this.remote
.get('http://localhost:8181')
.elementByCssSelector('.modal-close').clickElement()
.elementByCssSelector('#location_search_field').clickElement().type('San Francisco, CA')
}
});
});
The test successfully finds and clicks the .modal-close
element, but encounters an error while trying to locate the #location_search_field
element (resulting in the aforementioned error).
If I remove the
.elementByCssSelector('.modal-close').clickElement()
line, Selenium can easily find the location input field and populate it with the specified string.
I have also attempted using the
elementById('location_search_field')
method.
For your reference, here is a snippet of my environments array:
environments: [
{
browserName: 'firefox',
platform: 'MAC',
cssSelectorsEnabled: true,
javascriptEnabled: true,
applicationCacheEnabled: true,
webStorageEnabled: true
}
]
Any assistance would be highly appreciated.