Click Api not navigating to an element after loading the page. #2139
ravikiranhebbar88
started this conversation in
General
Replies: 1 comment
-
After using the evaluate api ( await evaluate($(ele),(elem) => elem.click());.) it is working as expected and scripts didn't fail even after running multiple times. Thank you taiko team for this amazing library. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
After clicking submit button on the login screen and on the next page click API is clicking on the element (present in carousel) after loading the page, but not navigating to that element. Sometimes it works.
If external waits are provided then the script works, but I'm trying to avoid external waits. And I have tried with waits for events option, but it didn't work
If the same script running in the debug mode most of the time's test scripts pass
o/p of debug mode:
2021-06-21T03:20:02.713Z taiko:event Response Recieved: Request id: 10204.224 2021-06-21T03:20:02.714Z taiko:event Request resolved: RequestId : 10204.224 2021-06-21T03:20:02.714Z taiko:event Request resolved: RequestId : 10204.188 2021-06-21T03:20:02.715Z taiko:event Response Recieved: Request id: 10204.189 2021-06-21T03:20:02.716Z taiko:event Request resolved: RequestId : 10204.189 2021-06-21T03:20:02.716Z taiko:event Lifecyle event: firstMeaningfulPaintCandidate 2021-06-21T03:20:02.717Z taiko:event Response Recieved: Request id: 10204.164 2021-06-21T03:20:02.722Z taiko:event Response Recieved: Request id: 10204.169 2021-06-21T03:20:02.723Z taiko:event Request resolved: RequestId : 10204.169 2021-06-21T03:20:02.733Z taiko:event Request resolved: RequestId : 10204.164 2021-06-21T03:20:02.765Z taiko:event Lifecyle event: networkAlmostIdle 2021-06-21T03:20:02.766Z taiko:event Lifecyle event: firstMeaningfulPaint 2021-06-21T03:20:02.910Z taiko:event LoadEventFired from NavigatedWithinPage 2021-06-21T03:20:03.391Z taiko:event Lifecyle event: networkIdle [PASS] Clicked customSelector with query .project-selector a[title="ITS-BEEKEEPER"] 1 times 2021-06-21T03:20:03.915Z taiko:event Request started: RequestId : 10204.225 Request Url : https://******************* 2021-06-21T03:20:03.915Z taiko:event Waiting for: RequestId : 10204.225 Request Url : https://******************** 2021-06-21T03:20:03.916Z taiko:event LoadEventFired from NavigatedWithinPage 2021-06-21T03:20:04.405Z taiko:event Response Recieved: Request id: 10204.225 2021-06-21T03:20:04.406Z taiko:event LoadEventFired from NavigatedWithinPage 2021-06-21T03:20:04.406Z taiko:event Request resolved: RequestId : 10204.225 [PASS] Clicked element matching text "AvalaraSG" 1 times [PASS] Browser closed
If the same script is running without debugging. Sometimes it is working.
`$ taiko questions_drag_and_drop.js
[PASS] Browser opened
[PASS] Navigated to URL https://**********
[PASS] Wrote @ into the customSelector with query #username
[PASS] Wrote ***** into the customSelector with query #password
"[PASS] Clicked customSelector with query //input[@name='login'] 1 times"
[PASS] Clicked customSelector with query .project-selector a[title="ITS-BEEKEEPER"] 1 times
[PASS] Clicked element matching text "AvalaraSG" 1 times
[PASS] Browser closed
$ taiko questions_drag_and_drop.js
[PASS] Browser opened
[PASS] Navigated to URL https://*****
[PASS] Wrote @***.com into the customSelector with query #username
[PASS] Wrote ***** into the customSelector with query #password
"[PASS] Clicked customSelector with query //input[@name='login'] 1 times"
[PASS] Clicked customSelector with query .project-selector a[title="ITS-BEEKEEPER"] 1 times
Error: Element with text AvalaraSG not found
at findElements (C:\Users\ravk0001\AppData\Roaming\npm\node_modules\taiko\lib\elementSearch.js:260:11)
at async waitAndGetActionableElement (C:\Users\ravk0001\AppData\Roaming\npm\node_modules\taiko\lib\actions\pageActionChecks.js:149:43)
at async click (C:\Users\ravk0001\AppData\Roaming\npm\node_modules\taiko\lib\actions\click.js:57:21)
at async module.exports.click (C:\Users\ravk0001\AppData\Roaming\npm\node_modules\taiko\lib\taiko.js:919:16)
at async module.exports. (C:\Users\ravk0001\AppData\Roaming\npm\node_modules\taiko\lib\taiko.js:2612:14)
at async global. (C:\Users\ravk0001\AppData\Roaming\npm\node_modules\taiko\bin\runFile.js:38:15)
at async C:\honeybee\taiko\questions_drag_and_drop.js:11:3
[PASS] Browser closed
`
Code Written:
const { openBrowser, goto, $, write, click, text, hover, into, dragAndDrop, closeBrowser } = require('taiko'); (async () => { try { setConfig( { highlightOnAction: "false"}); await openBrowser({args: ["--start-fullscreen", '--disable-gpu'],headless: false, highlight: false}); await goto("https://*****************"); await write("*****************", $('#username')); await write("***************", $('#password')); await click($("//input[@name='login']")); await click($('.project-selector a[title="ITS-BEEKEEPER"]'),{waitForEvents: ['networkIdle'],waitForNavigation: true, waitForStart: 500, navigationTimeout: 60000}); await click("AvalaraSG",{waitForNavigation: true, waitForStart: 500, navigationTimeout: 60000}); } catch (error) { console.error(error); } finally { await closeBrowser(); } })();
What options I have to add in click API which doesn't fail?? Any help would be grateful
Beta Was this translation helpful? Give feedback.
All reactions