Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

added commands.phantomUploadFile :sunrise_over_mountains: #264

Closed
wants to merge 2 commits into from

2 participants

@sebv
Collaborator

What does it add to the standard upload file mechanism, looks like a doublon with uploadFile?

@Whoaa512
@sebv
Collaborator

Yeah I mean the ghostdriver/phantomjs pull requests probably does it wrong.

@sebv sebv added the new feature label
@sebv
Collaborator

This should be a custom method.

@sebv sebv closed this
@Whoaa512

@sebv, I'm trying to make this a custom method. I'm curious how would I go about accessing callbackWithData() from within a method added via wd.addAsyncMethod?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
Showing with 16 additions and 0 deletions.
  1. +16 −0 lib/commands.js
View
16 lib/commands.js
@@ -1947,6 +1947,22 @@ commands.uploadFile = function(filepath) {
});
};
+/**
+ * Uploads a local file using Phantom's `page.uploadFile`
+ * POST /session/:sessionId/file
+ * uploadFile(phantomUploadFile, filepath, cb) -> cb(err)
+ */
+commands.phantomUploadFile = function(selector, filepath) {
+ var cb = findCallback(arguments);
+ var _this = this;
+ _this._jsonWireCall({
+ method: 'POST'
+ , relPath: '/file'
+ , data: { filepath: filepath, selector: selector },
+ cb: callbackWithData(cb, _this)
+ });
+};
+
commands.waitForJsCondition = function(){
deprecator.warn('waitForJsCondition',
'waitForJsCondition has been deprecated, use waitFor + jsCondition asserter instead.');
Something went wrong with that request. Please try again.