Button Click Alert Javascript

Hello, may I ask?
Why does the Javascript Alert take so long to press?
I have tried various methods but it still takes a long time to click, even though the website displays the alert without any problems.
Please help

Hi @RQ_Official

you can try several solutions.
First, use the “Parallel” activity to attempt clicking the alert while the process continues running.
Second, add an “Element Exists” activity before interacting with the alert to ensure it is detected properly.

Third, use the “Send Hotkey” activity to press Enter, as this can sometimes be faster than clicking.

I have tried the second and third solution.
The result is still the same, it takes too much time up to 20 seconds when it will process the javascript alert button.

For the first solution I will try it now.

Thanks for the solution
@Prashant Kumar

Is there any other solution apart from sending hotkeys, injecting scripts, clicking buttons to click the OK button on the default Windows alert?

Hi @RQ_Official, you can use one of the activities Close Window can directly close standard message boxes by targeting the alert window in “Use Application/Browser” activity. If the alert is for a certain application, you can use the Terminate Process activity setting up name of the process such as “notepad” e.g. in case of alerts coming from Notepad or Excel. Parallel activity keeps checking pop-up using “Element Exists”, and close it with “Click” or “Close Window” if handling alerts dynamically with another run process. Alternatively, you may programmatically close these alerts via Invoke Code with VB.NET or C#, where a script gets running processes by name and closes the alert window using p.CloseMainWindow(). Let me know if I can help you with a specific way! :blush:

I’ve tried everything that Mr. @Christian_ISGS told me. But it still takes time to click the OK button.

The problem here is not that you can’t click, but that it takes a long time to just click the OK button.

@RQ_Official

are you using modern activities i assume your selectors are falling back like from strict → fuzzy → cv

can you check which selector is working and deselect the others

@muktadir greetings.
I tried using one by one from strict, fuzzy, cv still takes a long time to click the OK button.

please help

Hi @RQ_Official

  • Use Attach Window: If the alert is in a specific window, wrap your activities with an Attach Window to limit the scope and speed up the process.
  • Optimize Click Settings: In the Click activity, you can modify the ClickType*property to use CLICK_TYPE::CLICK_SINGLE or CLICK_TYPE::CLICK_DOUBLE**, depending on your requirement.

If it’s helpful , Mark as a solution. thanks

@RQ_Official

is it a browser alert or a windows pop-up? would you be able to share screenshot?


It looks like a browser alert.
But in inspect element it is not there.
This application uses ASP.NET
Please help

I just tried the solution that @prashant1203765 ​​sir gave but it still takes a long time to click the OK button

Greate @RQ_Official

Attach to the alert window with Attach Window and then perform the Click activity on the “OK” button.
Might be due application issue ,it’ll take time.

Hey @RQ_Official
Strange. I just checked the java script popup on my site and the robot immediately clicked the notification.
Just to be sure, are you using Studio or StudioX, because you marked the tag in the subject that StudioX but the screen shows Studio?
What browser are you using? Have you tried another one?

what was taught is not in my activities

1 Like

Sorry there is a typo in the subject. I am a Studio user.

Manually when you click the Un-Posting button and press enter, the alert is immediately ok and disappears.
I also tried all the ways that were told to me.

The problem is that it takes too long to wait up to 20 seconds to click the OK button.

While manually you can quickly click or enter

@RQ_Official

You can try also:

  • Click (with SimulateClick enabled)
  • Set DelayBefore and DelayAfter to 0

I’ve tried this too, and it still doesn’t work quickly enough to click the OK button.

@RQ_Official

Then you can update your browser or change the browser and try attach window separately for popup box.