Skip to content
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

Feature Request: Retry Logic for Selenium Steps #407

Open
StefanFellinger opened this issue May 10, 2022 · 4 comments
Open

Feature Request: Retry Logic for Selenium Steps #407

StefanFellinger opened this issue May 10, 2022 · 4 comments
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@StefanFellinger
Copy link

It would be nice to have a retry logic for SeleniumSteps. We've implemented our own Workaround like so:

runner.run(RepeatOnErrorUntilTrueTemplate.builder()
.indexName(indexName)
.maxRepeats(maxRepeatsOnError)
.autoSleep(autoSleep)
.actions(Arrays.asList(actionBuilders))
.build());

We've also added an own wrapper for RepeatOnErrorUntilTrue using the Catch Action too. This was necessary since SeleniumSteps may throw Selenium exceptions, but RepeatOnErrorUntilTrue only catches the CitrusRuntimeException. By using the CatchAction without expected exception list we get the desired behaviour since the CatchAction will throw our required CitrusRuntimeException in that case.

Kind regards,

Stefan

@christophd christophd added enhancement New feature or request good first issue Good for newcomers labels May 10, 2022
@christophd
Copy link
Member

Awesome thanks!

I guess this is only for a subset of Selenium actions, isn't it? Could you please share a list of actions/steps where you think the retry logic makes sense?

@StefanFellinger
Copy link
Author

We've added it for each step since a previous selenium step may be ongoing on some selenium node.

@christophd
Copy link
Member

We could introduce a common retry attempt setting just like JDBC steps are doing (https://github.com/citrusframework/yaks/blob/main/java/steps/yaks-jdbc/src/main/java/org/citrusframework/yaks/jdbc/JdbcSettings.java) so users can enable/disable retry with these settings:

Given Selenium max retry attempts: 10
Given Selenium retry delay: 500ms

Also a env setting is available to set the retry globally:

YAKS_SELENIUM_MAX_RETRY_ATTEMPTS=10
YAKS_SELENIUM_DELAY_BETWEEN_RETRY_ATTEMPTS=1000

I would vote for having retry logic disabled by default (YAKS_SELENIUM_MAX_RETRY_ATTEMPTS=0)

@StefanFellinger
Copy link
Author

StefanFellinger commented May 30, 2022 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants