Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
518 views
in Technique[技术] by (71.8m points)

testing - How to grab text that is present in alerts using robot framework

I am unable to fetch text that is present in alerts using robot framework. Could someone please help here.

  • handle alert accept ---> for accepting the alert
  • handle alert dismiss ---> for rejecting/dismissing the alert

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Typically the documentation is really worth to read. Lets start with https://robotframework.org/SeleniumLibrary/SeleniumLibrary.html#Handle%20Alert.

Actions are defined to be "DISMISS", "ACCEPT" and "LEAVE". Then, there are examples:

Examples:
Handle Alert            # Accept alert.
Handle Alert    action=DISMISS      # Dismiss alert.
Handle Alert    timeout=10 s        # Use custom timeout and accept alert.
Handle Alert    DISMISS     1 min   # Use custom timeout and dismiss alert.
${message} =    Handle Alert        # Accept alert and get its message.
${message} =    Handle Alert    LEAVE   # Leave alert open and get its message.

Last example in the official documentation.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...