Skip to content

wait plugin is not retrying to find element if the locator is not there on screen #118

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
sankethsunkad opened this issue Jun 20, 2024 · 2 comments

Comments

@sankethsunkad
Copy link

sankethsunkad commented Jun 20, 2024

configurations : [email protected] [installed (npm)]

element wait plugin doesnt retry to find element, it tries once and if the element is not present it doesnt retry to find the element

server config 👇
"server": {
"keep-alive-timeout": 800,
"use-plugins": ["device-farm","element-wait"],
"port": 4444,
"plugin": {
"element-wait": {
"timeout": 20000,
"intervalBetweenAttempts": 500
},
"device-farm": {
"platform": "both"
},
"appium-dashboard": {
"dashboard:enableLiveVideo": false,
"dashboard:enableVideoRecording": false
}
},

error log 👇
Plugin element-wait is now handling cmd 'findElement'

  • Waiting to find element with id strategy for incomeCheckbox selector
    [AxiosError: Request failed with status code 404] {
    code: 'ERR_BAD_REQUEST',
    config: {
    transitional: {
    silentJSONParsing: true,
    forcedJSONParsing: true,
    clarifyTimeoutError: false
    },
    adapter: [Function: httpAdapter],
    transformRequest: [ [Function: transformRequest] ],
    transformResponse: [ [Function: transformResponse] ],
    timeout: 0,
    xsrfCookieName: 'XSRF-TOKEN',
    xsrfHeaderName: 'X-XSRF-TOKEN',
    maxContentLength: -1,
    maxBodyLength: -1,
    env: { FormData: [Function] },
    validateStatus: [Function: validateStatus],
    headers: {
    Accept: 'application/json, text/plain, /',
    'Content-Type': 'application/json',
    'User-Agent': 'axios/0.27.2',
    'Content-Length': 75
    },
    method: 'post',
    url: 'http://127.0.0.1:57415/session/0f19ae31-e3d8-4f24-a1c9-76a1ffaa0281/element',
    data: '{"strategy":"id","selector":"incomeCheckbox","context":"","multiple":false}'
    },
    request: <ref *1> ClientRequest {
    _events: [Object: null prototype] {
    abort: [Function (anonymous)],
    aborted: [Function (anonymous)],
    connect: [Function (anonymous)],
    error: [Function (anonymous)],
    socket: [Function (anonymous)],
    timeout: [Function (anonymous)],
    finish: [Function: requestOnFinish]
    },
    _eventsCount: 7,
    _maxListeners: undefined,
    outputData: [],
    outputSize: 0,
    writable: true,
    destroyed: true,
    _last: false,
    chunkedEncoding: false,
    shouldKeepAlive: true,
    maxRequestsOnConnectionReached: false,
    _defaultKeepAlive: true,
    useChunkedEncodingByDefault: true,
    sendDate: false,
    _removedConnection: false,
    _removedContLen: false,
    _removedTE: false,
    strictContentLength: false,
    _contentLength: 75,
    _hasBody: true,
    _trailer: '',
    finished: true,
    _headerSent: true,
    _closed: true,
    socket: Socket {
    connecting: false,
    _hadError: false,
    _parent: null,
    _host: null,
    _closeAfterHandlingError: false,
    _events: [Object],
    _readableState: [ReadableState],
    _writableState: [WritableState],
    allowHalfOpen: false,
    _maxListeners: undefined,
    _eventsCount: 6,
    _sockname: null,
    _pendingData: null,
    _pendingEncoding: '',
    server: null,
    _server: null,
    timeout: 5000,
    parser: null,
    _httpMessage: null,
    [Symbol(async_id_symbol)]: -1,
    [Symbol(kHandle)]: [TCP],
    [Symbol(lastWriteQueueSize)]: 0,
    [Symbol(timeout)]: Timeout {
    _idleTimeout: 5000,
    _idlePrev: [TimersList],
    _idleNext: [TimersList],
    _idleStart: 104480,
    _onTimeout: [Function: bound ],
    _timerArgs: undefined,
    _repeat: null,
    _destroyed: false,
    [Symbol(refed)]: false,
    [Symbol(kHasPrimitive)]: false,
    [Symbol(asyncId)]: 38566,
    [Symbol(triggerId)]: 38564
    },
    [Symbol(kBuffer)]: null,
    [Symbol(kBufferCb)]: null,
    [Symbol(kBufferGen)]: null,
    [Symbol(shapeMode)]: true,
    [Symbol(kCapture)]: false,
    [Symbol(kSetNoDelay)]: true,
    [Symbol(kSetKeepAlive)]: true,
    [Symbol(kSetKeepAliveInitialDelay)]: 1,
    [Symbol(kBytesRead)]: 0,
    [Symbol(kBytesWritten)]: 0
    },
    _header: 'POST /session/0f19ae31-e3d8-4f24-a1c9-76a1ffaa0281/element HTTP/1.1\r\n' +
    'Accept: application/json, text/plain, /\r\n' +
    'Content-Type: application/json\r\n' +
    'User-Agent: axios/0.27.2\r\n' +
    'Content-Length: 75\r\n' +
    'Host: 127.0.0.1:57415\r\n' +
    'Connection: keep-alive\r\n' +
    '\r\n',
    _keepAliveTimeout: 0,
    _onPendingData: [Function: nop],
    agent: Agent {
    _events: [Object: null prototype],
    _eventsCount: 2,
    _maxListeners: undefined,
    defaultPort: 80,
    protocol: 'http:',
    options: [Object: null prototype],
    requests: [Object: null prototype] {},
    sockets: [Object: null prototype] {},
    freeSockets: [Object: null prototype],
    keepAliveMsecs: 1000,
    keepAlive: true,
    maxSockets: Infinity,
    maxFreeSockets: 256,
    scheduling: 'lifo',
    maxTotalSockets: Infinity,
    totalSocketCount: 1,
    [Symbol(shapeMode)]: false,
    [Symbol(kCapture)]: false
    },
    socketPath: undefined,
    method: 'POST',
    maxHeaderSize: undefined,
    insecureHTTPParser: undefined,
    joinDuplicateHeaders: undefined,
    path: '/session/0f19ae31-e3d8-4f24-a1c9-76a1ffaa0281/element',
    _ended: true,
    res: IncomingMessage {
    _events: [Object],
    _readableState: [ReadableState],
    _maxListeners: undefined,
    socket: null,
    httpVersionMajor: 1,
    httpVersionMinor: 1,
    httpVersion: '1.1',
    complete: true,
    rawHeaders: [Array],
    rawTrailers: [],
    joinDuplicateHeaders: undefined,
    aborted: false,
    upgrade: false,
    url: '',
    method: null,
    statusCode: 404,
    statusMessage: 'Not Found',
    client: [Socket],
    _consuming: false,
    _dumped: false,
    req: [Circular *1],
    _eventsCount: 4,
    responseUrl: 'http://127.0.0.1:57415/session/0f19ae31-e3d8-4f24-a1c9-76a1ffaa0281/element',
    redirects: [],
    [Symbol(shapeMode)]: true,
    [Symbol(kCapture)]: false,
    [Symbol(kHeaders)]: [Object],
    [Symbol(kHeadersCount)]: 12,
    [Symbol(kTrailers)]: null,
    [Symbol(kTrailersCount)]: 0
    },
    aborted: false,
    timeoutCb: null,
    upgradeOrConnect: false,
    parser: null,
    maxHeadersCount: null,
    reusedSocket: true,
    host: '127.0.0.1',
    protocol: 'http:',
    _redirectable: Writable {
    _events: [Object],
    _writableState: [WritableState],
    _maxListeners: undefined,
    _options: [Object],
    _ended: true,
    _ending: true,
    _redirectCount: 0,
    _redirects: [],
    _requestBodyLength: 75,
    _requestBodyBuffers: [],
    _eventsCount: 3,
    _onNativeResponse: [Function (anonymous)],
    _currentRequest: [Circular *1],
    _currentUrl: 'http://127.0.0.1:57415/session/0f19ae31-e3d8-4f24-a1c9-76a1ffaa0281/element',
    [Symbol(shapeMode)]: true,
    [Symbol(kCapture)]: false
    },
    [Symbol(shapeMode)]: false,
    [Symbol(kCapture)]: false,
    [Symbol(kBytesWritten)]: 0,
    [Symbol(kNeedDrain)]: false,
    [Symbol(corked)]: 0,
    [Symbol(kOutHeaders)]: [Object: null prototype] {
    accept: [Array],
    'content-type': [Array],
    'user-agent': [Array],
    'content-length': [Array],
    host: [Array]
    },
    [Symbol(errored)]: null,
    [Symbol(kHighWaterMark)]: 16384,
    [Symbol(kRejectNonStandardBodyWrites)]: false,
    [Symbol(kUniqueHeaders)]: null
    },
    response: {
    status: 404,
    statusText: 'Not Found',
    headers: {
    connection: 'keep-alive',
    pragma: 'no-cache',
    'cache-control': 'no-store',
    'content-encoding': 'identity',
    'content-type': 'application/json',
    'content-length': '3828'
    },
    config: {
    transitional: [Object],
    adapter: [Function: httpAdapter],
    transformRequest: [Array],
    transformResponse: [Array],
    timeout: 0,
    xsrfCookieName: 'XSRF-TOKEN',
    xsrfHeaderName: 'X-XSRF-TOKEN',
    maxContentLength: -1,
    maxBodyLength: -1,
    env: [Object],
    validateStatus: [Function: validateStatus],
    headers: [Object],
    method: 'post',
    url: 'http://127.0.0.1:57415/session/0f19ae31-e3d8-4f24-a1c9-76a1ffaa0281/element',
    data: '{"strategy":"id","selector":"incomeCheckbox","context":"","multiple":false}'
    },
    request: <ref *1> ClientRequest {
    _events: [Object: null prototype],
    _eventsCount: 7,
    _maxListeners: undefined,
    outputData: [],
    outputSize: 0,
    writable: true,
    destroyed: true,
    _last: false,
    chunkedEncoding: false,
    shouldKeepAlive: true,
    maxRequestsOnConnectionReached: false,
    _defaultKeepAlive: true,
    useChunkedEncodingByDefault: true,
    sendDate: false,
    _removedConnection: false,
    _removedContLen: false,
    _removedTE: false,
    strictContentLength: false,
    _contentLength: 75,
    _hasBody: true,
    _trailer: '',
    finished: true,
    _headerSent: true,
    _closed: true,
    socket: [Socket],
    _header: 'POST /session/0f19ae31-e3d8-4f24-a1c9-76a1ffaa0281/element HTTP/1.1\r\n' +
    'Accept: application/json, text/plain, /\r\n' +
    'Content-Type: application/json\r\n' +
    'User-Agent: axios/0.27.2\r\n' +
    'Content-Length: 75\r\n' +
    'Host: 127.0.0.1:57415\r\n' +
    'Connection: keep-alive\r\n' +
    '\r\n',
    _keepAliveTimeout: 0,
    _onPendingData: [Function: nop],
    agent: [Agent],
    socketPath: undefined,
    method: 'POST',
    maxHeaderSize: undefined,
    insecureHTTPParser: undefined,
    joinDuplicateHeaders: undefined,
    path: '/session/0f19ae31-e3d8-4f24-a1c9-76a1ffaa0281/element',
    _ended: true,
    res: [IncomingMessage],
    aborted: false,
    timeoutCb: null,
    upgradeOrConnect: false,
    parser: null,
    maxHeadersCount: null,
    reusedSocket: true,
    host: '127.0.0.1',
    protocol: 'http:',
    _redirectable: [Writable],
    [Symbol(shapeMode)]: false,
    [Symbol(kCapture)]: false,
    [Symbol(kBytesWritten)]: 0,
    [Symbol(kNeedDrain)]: false,
    [Symbol(corked)]: 0,
    [Symbol(kOutHeaders)]: [Object: null prototype],
    [Symbol(errored)]: null,
    [Symbol(kHighWaterMark)]: 16384,
    [Symbol(kRejectNonStandardBodyWrites)]: false,
    [Symbol(kUniqueHeaders)]: null
    },
    data: {
    sessionId: '0f19ae31-e3d8-4f24-a1c9-76a1ffaa0281',
    value: [Object]
    }
    }
    }
    �[38;5;48m[AppiumDriver@17b9]�[0m Plugin device-farm is now handling cmd 'findElement'
    �[38;5;48m[AppiumDriver@17b9]�[0m Executing default handling behavior for command 'findElement'
    �[38;5;64m[AndroidUiautomator2Driver@87b6 (88292602)]�[0m Valid locator strategies for this request: xpath, id, class name, accessibility id, css selector, -android uiautomator
    �[38;5;64m[AndroidUiautomator2Driver@87b6 (88292602)]�[0m Waiting up to 10000 ms for condition
    �[38;5;0m[device-farm-/Users/sankethcs/.appium]�[0m Updating lastCmdExecutedAt for device emulator-5554 in session 88292602-1636-43cc-96bf-54f3e763f8c3
    �[38;5;64m[AndroidUiautomator2Driver@87b6 (88292602)]�[0m Matched '/element' to command name 'findElement'
    �[38;5;64m[AndroidUiautomator2Driver@87b6 (88292602)]�[0m Proxying [POST /element] to [POST http://127.0.0.1:57415/session/0f19ae31-e3d8-4f24-a1c9-76a1ffaa0281/element] with body: {"strategy":"id","selector":"incomeCheckbox","context":"","multiple":false}
    �[38;5;64m[AndroidUiautomator2Driver@87b6 (88292602)]�[0m Got response with status 404: {"sessionId":"0f19ae31-e3d8-4f24-a1c9-76a1ffaa0281","value":{"error":"no such element","message":"An element could not be located on the page using the given search parameters","stacktrace":"io.appium.uiautomator2.common.exceptions.ElementNotFoundException: An element could not be located on the page using the given search parameters\n\tat io.appium.uiautomator2.handler.FindElement.safeHandle(FindElement.java:63)\n\tat io.appium.uiautomator2.handler.request.SafeRequestHandler.handle(SafeRequestHandler.java:59)\n\tat io.appium.uiautomator2.server.AppiumServlet.handleRequest(AppiumServlet.java:277)\n\tat io.appium.uiautomator2.server.AppiumServlet.handleHttpRequest(AppiumServlet.java:271)\n\tat io.appium.uiautomator2.http.ServerHandler.channelRead(ServerHandler.java:68)\n\tat io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:366)\n\tat io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:352)\n\tat io.netty.chann...
@sankethsunkad
Copy link
Author

device_farm.log

@rakeshghandham07
Copy link

Applium-Element-Wait.json
Hi @saikrishna321 I see the same error , let me know if you need further details here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants