mirror of
https://github.com/appium/appium.git
synced 2026-01-28 13:18:55 -06:00
Let's go ahead and execute async js in frames too.
This commit is contained in:
@@ -270,7 +270,7 @@ RemoteDebugger.prototype.executeAtomAsync = function(atom, args, frames, respons
|
||||
for (var i = 0; i < frames.length; i++) {
|
||||
script = this.wrapScriptForFrame(script, frames[i]);
|
||||
}
|
||||
script += "(" + args.join(',') + ")";
|
||||
script += "(" + args.join(',') + ", " + asyncCallBack + ", true )";
|
||||
} else {
|
||||
logger.info("Executing atom in default context");
|
||||
script += "(" + atomSrc + ")(" + args.join(',') + ", " + asyncCallBack + ", true )";
|
||||
|
||||
@@ -608,13 +608,24 @@ module.exports.buildTests = function(webviewType) {
|
||||
});
|
||||
it('should be able to return multiple elements from javascript', function(done) {
|
||||
loadWebView(h.driver, function() {
|
||||
h.driver.execute('return document.getElementsByTagName("a")', function(err, res) {
|
||||
h.driver.execute('return document.getElementsByTagName("a");', function(err, res) {
|
||||
should.not.exist(err);
|
||||
res[0].ELEMENT.should.equal('5000');
|
||||
done();
|
||||
});
|
||||
});
|
||||
});
|
||||
it('should execute javascript in frame', function(done) {
|
||||
loadWebView(h.driver, function() {
|
||||
h.driver.frame("first", function(err) {
|
||||
should.not.exist(err);
|
||||
h.driver.execute("return document.title;", function(err, res) {
|
||||
res.should.equal("Sub frame 1");
|
||||
done()
|
||||
});
|
||||
});
|
||||
}, testEndpoint + 'frameset.html', "Frameset guinea pig");
|
||||
});
|
||||
});
|
||||
|
||||
desc("executeAsync", function(h) {
|
||||
@@ -649,6 +660,17 @@ module.exports.buildTests = function(webviewType) {
|
||||
});
|
||||
});
|
||||
});
|
||||
it.only('should execute async javascript in frame', function(done) {
|
||||
loadWebView(h.driver, function() {
|
||||
h.driver.frame("first", function(err) {
|
||||
should.not.exist(err);
|
||||
h.driver.executeAsync("arguments[arguments.length - 1](document.title);", function(err, res) {
|
||||
res.should.equal("Sub frame 1");
|
||||
done()
|
||||
});
|
||||
});
|
||||
}, testEndpoint + 'frameset.html', "Frameset guinea pig");
|
||||
});
|
||||
});
|
||||
|
||||
desc('alerts', function(h) {
|
||||
|
||||
Reference in New Issue
Block a user