robotframework / SeleniumLibrary

Web testing library for Robot Framework
Apache License 2.0
1.36k stars 752 forks source link

Request to set implicit wait as a basic parameter to a keyword #1897

Open vyvy3 opened 2 months ago

vyvy3 commented 2 months ago

Prerequisites

For issues

Steps to reproduce the issue

Our team uses 1.5 min as a basic implicit wait. Sometimes, we need to get results immediately (e.g., is there an element on the page). Since implicit wait is set globally we are failing to structurize scripts nicely and are forced to proceed with the following workaround where we change the global wait, run the keyword, and set it back:

${orig}=  Get Selenium Implicit Wait
Set Browser Implicit Wait    1s
${check_abc}=  Run Keyword And Return Status    Element Should Be Visible    xpath=%xpath%
Set Browser Implicit Wait    ${orig}

or

Set Browser Implicit Wait    1s
${status}=    Run Keyword And Return Status    Page Contains Text    IMAGE_1.png
Set Browser Implicit Wait    ${orig}

Can you please suggest ways to accomplish the same logic without waiting for 1.5 minutes and not playing with that "Set Browser Implicit Wait"? Or maybe there is a possibility to add an implicit wait for a specific keyword execution?

Thank you in advance!

Expected behavior and actual behavior

When I follow those steps, I see... keyword needs 1.5 min for execution

I was expecting... a way to execute a keyword and get result immediately

Environment

Browser: Google Chrome 124.0.6367.63 Browser driver: chromedriver 124.x.x Operating System: Windows 11 Libraries

This project is not funded by any organisation or company, I do this because I want to do this on my own free time. Therefore if you want feature be implemented, the easiest and usually fastest way usually is to provide pull request. See https://github.com/robotframework/SeleniumLibrary/blob/master/CONTRIBUTING.rst for mode details about project development.

emanlove commented 2 months ago

@vyvy3 A few questions..