My application triggers an alert notification after submitting a request and I would like to capture the alert message in the notification using playwright. I have tried the following but still it does not work, Any help here would be appreciated:
My application: The alert captured is shown below
The alert message looks like this
The alert message is a sl-alert as shown here
I have tried the following code but it does not work:
page.onDialog(dialog -> System.out.println(dialog.defaultValue()));
page.click("zero-button:has-text(\'Submit\') >> visible=true");
page.onDialog(alert -> System.out.println(alert.defaultValue()));
page.click("zero-button:has-text(\'Submit\') >> visible=true");
page.onDialog(dialog -> System.out.println(dialog.message()));
page.click("zero-button:has-text(\'Submit\') >> visible=true");
page.onDialog(alert -> System.out.println(alert.message()));
page.click("zero-button:has-text(\'Submit\') >> visible=true");
page.onDialog will only intercept modal dialogs opened via alert, prompt etc. On your page you have a custom html overlay which won't trigger dialog events. You can do something like page.waitForSelector("sl-alert") to wait for the dialog to show up.
Related
Let see, I want to notify with alert on Dataflow pipeline using log based.But in log based alert , i cant see any option if i have to set alert on particular pattern matching like, if in log any message "Job failed due to ....", here i want to trigger an alert based on condition like "job failed *". . It should alert me if any message in log occur. Highly appreciated your help
I tried Dataflow-log entries option, but didnt get anything on pattern matching log.
jsonPayload.message=~"some pattern"
https://cloud.google.com/logging/docs/view/logging-query-language
Hi I'm a new user of selenium. I'm trying to take a screenshot of an alert using selenium webdriver in ruby.
#driver.find_element(:name, "updateButton").click
#driver.save_screenshot "./#{Time.now.strftime("Alert_Screenshot___%d_%m_%Y__%H_%M_%S")}.png"
Instead of taking a screenshot, this error is thown:
Selenium::WebDriver::Error::UnhandledAlertError
Of course I can accept the alert:
#driver.switch_to.alert.accept
and then take a screenshot. But I want to know is there way to take the screenshot while the alert is being prompted?
In your case you need to take screenshot for complete screen, not only the browser. So you can use xwd to take a screenshot of the root window:
xwd -display :0 -root|xwdtopnm |pnmtopng > $1
My customer has reported a problem that standard ''print'' button in Z-report which a developer wrote before is not working.
How can I enable the button?
MODULE user_command_0100 INPUT.
DATA: GS_STATUS TYPE SLIS_STATUS,
XS_STATUS LIKE GS_STATUS.
CASE sy-ucomm.
WHEN 'BACK' OR '%EX' OR 'RW'.
LEAVE TO SCREEN 0.
WHEN '&RNT'.
ENDCASE.
ENDMODULE.
Then button needs a usercommand assigned, which is then processed in pai. usually with a general form called get_ucomm (many developers call it similar). You also can issue /h in transaction field and then press the print-button. /h will trigger the debugger and You can inspect the report step by step.
That's all I can say without seeing the code. Hope this will help.
Which user command do you define in your GUI status?
If you have a standard list (what I expect when you write about a z-report), then you should define the command PRI to print the list:
If you define a screen (using the screen painter) or an ALV-Grid... then this solution will not help you.
If you don't know, what a GUI status is: Scan your source code for the command
SET PF-STATUS 'XXXX'.
Then double click on 'XXXX' and you should be directed to the status definition. There may by multiple status (and status with generic names).
I've seen your code and for the &RNT option there's no code to execute, so if the user wants to print the button will do nothing.
MODULE user_command_0100 INPUT.
DATA: GS_STATUS TYPE SLIS_STATUS,
XS_STATUS LIKE GS_STATUS.
CASE sy-ucomm.
WHEN 'BACK' OR '%EX' OR 'RW'.
LEAVE TO SCREEN 0.
WHEN '&RNT'.
" There's no code
ENDCASE.
ENDMODULE.
I've used the 'STANDARD' GUI Status from the function group 'KKBL' and '&RNT' is the code of the print button and that's why I think that is the print button you are refering in your program.
Can you post the GUI Status you are using please?
A total noob in Applescript, please bear with me…
We have a process where we use System Events to control the Print dialog in Acrobat X. This works fine; we can "click" the Print button.
Now, we have to wait until the document is printed. While the document prints, a dialog opens, with title "Print", a progress bar and a Cancel button. We can only continue when this window closes.
So far, I have not been successful with that wait; the Applescript continues and that messes up the process.
What I have currently is (note this is part of a bigger script, and variables are defined and appear to be valid.
We have Acrobat active, and the Print dialog is open:
tell application "System Events"
tell process "Acrobat"
-- now we set all the options in the Print dialog,
-- which is in the window Print
click button "OK" of window "Print
end tell
end tell
delay 5
-- this gives Acrobat time to get printing and to open that print dialog window
repeat while exists window "Print"
delay 1
end repeat
close active doc saving no
I also tried to put that code in a Timeout, but no chance.
Now, I am stuck, but I am sure it is a stupid beginner's error.
Another note: I was not able to get the name of this "Print" window using UIElementInspector.
Thanks a lot in advance for any advice.
Is your code enclosed in some tell application block that you haven't reported here?
It should work if you move the repeat loop into the tell process block:
tell application "System Events"
tell process "Acrobat"
-- now we set all the options in the Print dialog,
-- which is in the window Print
click button "OK" of window "Print"
delay 5
-- this gives Acrobat time to get printing and to open that print dialog window
repeat while exists window "Print"
delay 1
end repeat
end tell
end tell
close active doc saving no
I have a RPG program A and a CL program B. A accepts some user input from display file and use it as the entry parameter of B. b processes the entry parameter, and if there is an error the message will be received and resent by B so that it will be displayed on the bottom of the display file using message subfile. This message displaying mechanism works but not completely, as the message sent could only be glanced in a very short period of time, then it disappeared from the display file. What would be the cause of this problem? How to stop the message from disappearing?
Here is the sample code inside program B:
DCLF FILE(ECSWIFP1)
MONMSG MSGID(CPF0000) EXEC(GOTO CMDLBL(ERROR))
OVRDBF FILE(ECSWIFP1) TOFILE(ECSWIFP1) SHARE(*YES)
OPNQRYF FILE(ECSWIFP1) QRYSLT(&QRYSTR)
RCVF
CLOF FILE(ECSWIFP1)
DLTOVR FILE(ECSWIFP1)
RTVDTAARA DTAARA(&E4LIBN/&E4OBJN) RTNVAR(&DTARVAL)
GOTO CMDLBL(END)
ERROR:
CLOF FILE(ECSWIFP1)
MONMSG MSGID(CPF4520)
DLTOVR FILE(ECSWIFP1)
MONMSG MSGID(CPF9841)
MSG:
RCVMSG MSGTYPE(*ANY) MSGDTA(&MSGDTA) MSGID(&MSGID)
IF COMD(%SST(&MSGID 1 3)) *NE 'CPF') THEN(GOTO CMDLBL(MSG))
SNDPGMMSG MSGID(&MSGID) MSGF(QCPFMSG) MSGDTA(&MSGDTA) MSGTYPE(*STATUS) TOPGMQ(*EXT)
END:
ENDPGM
And here is part of the display file DDS for displaying message:
A R MSG SFL
A SFLMSGRCD(24)
A S0MSGK SFLMSGKEY
A S0PGMQ SFLPGMQ
A R MSGCTL SFLCTL(MSG)
A OVERLAY
A SFLDSP
A SFLINZ
A SFLSIZ(0005)
A SFLPAG(0001)
A S0PGMQ SFLPGMQ
Suppose there is no matching record based on the query string, then RCVF causes CPF0864 to be sent out, and this message can be displayed on the screen without problem.
But if a record is found and the field values are used in the RTVDTAARA command, and the failure of this command (e.g. data area not found) will causes the problem I described above, which is that the received message can only be glimpsed in a short period of time and then disappears. Why this happens?
The typical sequence is
write msgctl
write bottom
exfmt main
Make sure that any record format displayed after the message subfile has OVERLAY specified. Without OVERLAY, 'bottom' will erase the message subfile and 'main' will erase 'bottom'.
Application Display Programming is an old but useful reference.
EDIT After seeing the CL and DDS.
I believe the issue is due to SNDPGMMSG MSGTYPE(*STATUS). Status messages are special, and do not normally go into a subfile message queue. The Messages section in the Infocenter has more information on the different message types.
In CL PGMB, change the SNDPGMMSG to MSGTYPE(*DIAG) TOPGMQ(*PRV). This will throw the exception message to the caller (to PGMA) as a diagnostic message. Double check that you have OVERLAY in the DDS where you need it - my example above that would be bottom and main.
This sequence worked and display the message of message-subfile on the screen
The typical sequence is
write msgctl
write bottom
exfmt main
Make sure that any record format displayed after the message subfile has OVERLAY specified. Without OVERLAY, 'bottom' will erase the message subfile and 'main' will erase 'bottom'.
c