yaks icon indicating copy to clipboard operation
yaks copied to clipboard

Feature Request: Retry Logic for Selenium Steps

Open StefanFellinger opened this issue 3 years ago • 4 comments

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

StefanFellinger avatar May 10 '22 12:05 StefanFellinger

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?

christophd avatar May 10 '22 14:05 christophd

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

StefanFellinger avatar May 12 '22 09:05 StefanFellinger

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)

christophd avatar May 30 '22 08:05 christophd

That would be fine for Our use case. Our Observation Was That e.g clicking a Button and validating a second Element than requires a retry since most Browser interactions are slower than our steps execution

Christoph Deppisch @.***> schrieb am Mo., 30. Mai 2022, 10:48:

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: 10Given 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)

— Reply to this email directly, view it on GitHub https://github.com/citrusframework/yaks/issues/407#issuecomment-1140880891, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABMAAQOTHUQFONAUBFOPRSLVMR6F7ANCNFSM5VRP7WTQ . You are receiving this because you authored the thread.Message ID: @.***>

StefanFellinger avatar May 30 '22 13:05 StefanFellinger