What is executeAsyncScript good for?

I found a way where executeAsyncScript helping me in a Selenium Project.

I am adding an eventlistener to driver and I am alerting the (title/class/id) available attributes of the clicked element by the user.

This happens for me only when I am using executeAsyncScript. If I do it with executeScript the driver won’t wait until the alert occurs.

Interesting info, thanks.

Is this a first real-life use case for executeAsyncScript?. Because I am super excited to get UI.Vision RPA Pro license there by any luck.

Thanks again for posting it, but your example is for Selenium Web Driver not with the Selenium IDE :wink:

As we wrote on executeAsyncScript:
…While asynchronous code in Javascript in general has plenty good uses, we have yet to find any good use case within any Selenium IDE. The executeScript command is an essential Selenium IDE command. But the async version adds no additional benefits in our opinion. If you use execute Async Script in a Selenium IDE project, please let us know how you use it. Maybe we overlook something here. (We offer a free UI.Vision RPA PRO license for the first real life use case report).

Hello!

I have an use case real life… I need to access a website and then, execute a script using noBackend arquitecture do get data from the site… the function is a promise, send request to server and back to client using callback and data as parameter. I can’t do this if ui.vision! I need to solve this problem to show a solution problem to my customer. I’m trying to use executeAsyncScript, but never work, returns csPostMessage timeout 5000 ms error.

@biernaweb. I think if callback not returned properly, executeAsyncScript will wait for callback and we may face timeout error.

@biernaweb Do you have a test case for us?

Or, if this is on an internal website, can you test if the “execute Async Script” in the original Selenium IDE works for you? If yes, that would mean that our Selenium IDE++ implementation has a bug, and we would fix it ASAP.

1 Like

Hello. The callback of my site is ok, and returning results properly.

Hello! I have a real use case, but I can’t show you because is private site. But I got it to work :smiley:

Using this code:

return new Promise(® => { dpd.sales.get({ idStateEx: 1, $fields: { idsInvoicePays: 1, customerDocument: 1, addresss: 1 } }, function(salesToMonitoring) { r(salesToMonitoring); }); })

Work’s Fine!

Then, I get this result and access another website, I do the forEach passing all objects of my collects and getting of status :smiley:

Now… Where is my gift? (Licence rsss)

@biernaweb: Very interesting! We really would love to have a test case with public website, so that we can add it to our execute Async Script tutorial page :slight_smile:

Hello. Okay, I’ll analise an example on public site to write a test case sample to documentation :slight_smile: