We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hi,
According to your commands like waitForElementVisible , I tried to do a waitForJavascript command
My problem is that I can't find a way to do the same as you (call the function back in order to check the value)
Here is what I did This is simple test to wait for a true return after 2 seconds
Command
CommandAction.prototype.command = function(browserFunction, milliseconds, callback) { this.startDate = Date.now(); this.callback = callback || function() {}; this.browserFunction = browserFunction; this.milliseconds = milliseconds; this._check() return this; } CommandAction.prototype._check = function() { console.log('check') var self = this; this.client.execute(this.browserFunction, [], function(result){ console.log('result', result) if( result.value === true && result.status === 0 ){ console.log('suceeed!!!') self.callback(true) return self.emit('complete'); } else if( Date.now() - this.startDate < this.milliseconds ){ console.log('looping') setTimeout(function() { self._check() }, 500); } else { console.log('failed!!!') self.callback(false) return self.emit('complete'); } }) }
Bash output
Running: test javascript execution check result { status: 0, sessionId: '478c717e-a3b4-44eb-9f44-a4fab7fdb63b', value: false, state: null, class: 'org.openqa.selenium.remote.Response', hCode: 764998737 } failed!!! false No assertions ran.
My client test
<body> <h1>Test waitForJs</h1> <script> window.value = false; console.log('current value', window.value); setTimeout(function() { window.value = true; console.log('current value', window.value); }, 2000); </script> </body>
The text was updated successfully, but these errors were encountered:
Find a solution
Sorry, something went wrong.
No branches or pull requests
Hi,
According to your commands like waitForElementVisible , I tried to do a waitForJavascript command
My problem is that I can't find a way to do the same as you (call the function back in order to check the value)
Here is what I did
This is simple test to wait for a true return after 2 seconds
Command
Bash output
My client test
The text was updated successfully, but these errors were encountered: