Skip to content

Commit

Permalink
Don't fail element command in IE (webdriverio#3874)
Browse files Browse the repository at this point in the history
  • Loading branch information
christian-bromann committed Apr 23, 2019
1 parent 11e5408 commit e8bfd25
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
15 changes: 10 additions & 5 deletions packages/webdriver/src/utils.js
Expand Up @@ -28,11 +28,16 @@ export function isSuccessfulResponse (statusCode, body) {
/**
* ignore failing element request to enable lazy loading capability
*/
if (body.status && body.status === 7 && body.value && body.value.message &&
(body.value.message.toLowerCase().startsWith('no such element') ||
//Appium
body.value.message ===
'An element could not be located on the page using the given search parameters.')) {
if (
body.status === 7 && body.value && body.value.message &&
(
body.value.message.toLowerCase().startsWith('no such element') ||
// Appium
body.value.message === 'An element could not be located on the page using the given search parameters.' ||
// Internet Explorter
body.value.message.toLowerCase().startsWith('unable to find element')
)
) {
return true
}

Expand Down
4 changes: 4 additions & 0 deletions packages/webdriver/tests/utils.test.js
Expand Up @@ -27,6 +27,10 @@ describe('utils', () => {
undefined,
{ status: 7, value: { message: 'no such element: foobar' } }
)).toBe(true)
expect(isSuccessfulResponse(
200,
{ value: { message: 'Unable to find element with xpath == //foobar' } }
)).toBe(true)
})

it('isValidParameter', () => {
Expand Down

0 comments on commit e8bfd25

Please sign in to comment.