-
Notifications
You must be signed in to change notification settings - Fork 108
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
RFB can not handle two consecutives alerts #3785
Comments
@allcontributors please add @wojtekwp for bugs. |
I've put up a pull request to add @wojtekwp! 🎉 |
Playwright does not allow to register two dialog handlers and therefore it crashes. I think that is by design. But I can also see a problem, because if you do only this: ${promise} = Promise To Wait For Alert action=accept timeout=5
Click id=alert
${text} = Wait For ${promise}
Log ${text} You get only text from first alter and not from the second on. The second on is automatically dismissed by Playwright. The problem can be solved by changing the code to of the page to call multiple times waitForEvent, but problem is that current keyword does not allow one to define different actions or expect different text for the alert. Like your example, you are excepting alerts to have different texts. To solve problem correctly, we would need new keyword which would allow handling one or more alerts. Also that keyword should allow handling each alert differently, meaning have different values for One option could be to kwargs and suffix each alert handling with number. ${promise} Promise To Wait For Alerts action1=accecpt text1=Text One Here action2=dismiss text2=Two is here
Click id=alert
${text} = Wait For ${promise} # ${text} would be list of two string But there could better ways to define handling of multiple alerts and I am open to ideas? Would you idea for keyword syntax? |
I tried to add below snippet to Browser\keywords\interaction.py and prep next rfb example code with declared list variable & promise but it not always works as expected - don't know why but sometimes still failing to catch and retrieve response from dialog within expected 5s timeout. If this "Wait For Alerts" keyword fails please try several times - it's not stable - works as expected usually 4/10 tries, sometimes more.
|
There is also changes needed in the node side. In any case, your way to declare keyword syntax is valid one, because then automatic argument conversion should work. The downside might be that if there are many alerts, seeing what arguments belongs to which alert may come hard. But I think that is pretty rare case, because handling many alerts is not that common. I think if better ideas don’t arrive, I will go with this approach. |
Describe the bug
RFB not able to handle two consecutives alerts. It fails with below message:
To Reproduce
I prep 2 simple files to easily reproduce an issue. Create new folder and copy 2 files content ex. to c:/alert_demo, then run start CMDs
Please notice on line 8 it needs to be correct index.html path to open sample page with 2 alerts :
Expected behavior
Two alerts should be handled correctly
Desktop :
chromium
Win 11 E
Python 3.11.9
NodeJS v20.15.1
Browser library 18.6.3
Robot Framework version: 7.0.1
Playwright 1.45.0
Additional context
More details: https://forum.robotframework.org/t/can-not-handle-two-consecutives-alerts/3347
The text was updated successfully, but these errors were encountered: