Note that there are some explanatory texts on larger screens.

plurals
  1. POWhat are the inner workings of the Selenium waitFor mechanism?
    primarykey
    data
    text
    <p>I am trying to customize the behavior of Selenium's click command, (via user-extentions.js), by intercepting calls to doClick(locator). Basically I need to delay click actions whenever our application's "busy indicator" is being displayed.</p> <p>(Now the standard answer for this kind of thing is to insert a waitFor into the script for those situations. Indeed, we currently have zillions of them throughout our scripts. I'm trying to eliminate those.)</p> <p>Detecting the page element is the trivial part. The tricky part is getting the script to actually wait. My promising looking, but failed attempt looks like this:</p> <pre><code>var nativeClick = Selenium.prototype.doClick; Selenium.prototype.doClick = function(locator) { this.doWaitForCondition("!selenium.browserbot.findElementOrNull('busy-indicator')", 5000); return nativeClick.call(this, locator); } </code></pre> <p>The doWaitForCondition gets called before every click, but it does <strong>not</strong> wait when the condition evaluates to false. nativeClick always gets called immediately, and so no delay is introduced. I suspect that the doWaitForCondition function doesn't actually do any waiting per se, but rather establishes the conditions for it within the command execution loop. And in this case the click command is already in play, and I'm trying to run a command within a command.</p> <p>Can somebody shed some light on how Selenium command execution and waitFor works, or offer suggestions on how this might be done?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload