- Trending Categories
- Data Structure
- Operating System
- C Programming
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Understanding execute async script in Selenium
The callback is always added as the last argument within the executed function. The first argument passed is used to get the script result.If the script consists of a return statement, then the below rules are followed −
A webelement is returned for an HTML element.
A double is returned for a decimal number.
A long is returned for a non-decimal number.
A Boolean is returned for a Boolean number.
A string is returned for all the other cases.
A list of objects is returned following the above rules for an array.
If the value is null or there is nothing to return, a null is returned.
We can perform the below tasks with the executeAsyncScript method −
To set the browser timeout.
To synchronize a test with an AJAX application.
To inject an XMLHttpRequest and wait for the result.
The arguments of executeAsyncScript method can be Boolean, string, webelement, list or a number. An exception is raised, if the arguments are not of these types. The arguments shall be available using the arguments keyword.
- How to execute Async task repeatedly after fixed time intervals in Android?
- Execute a script when an error occurs in HTML?
- How to execute Python CGI Script on Apache Server?
- Execute a script when media data is loaded in HTML?
- Execute a script when a page has unloaded in HTML?
- Execute a script when the file is unavailable in HTML?
- Execute a script when the element is invalid in HTML?
- Execute a script when the element loses focus in HTML?
- Execute a script before the document is printed in HTML?
- Execute a script after the document is printed in HTML?
- Execute a script when the element gets focus in HTML?
- How to execute an Async task repeatedly after fixed time intervals in Android using Kotlin?
- Execute a script when a user releases a key in HTML?
- Execute a script when the element is finished loading in HTML?
- Execute a script when the element gets user input in HTML?