Can I upload files to remote server with this php-webdriver? How? #40

Closed
kalimero82 opened this Issue Nov 27, 2012 · 3 comments

Comments

Projects
None yet
4 participants
@kalimero82

It's easy upload files to local machines but I don't know how do it in remote servers

Thanks in advance!

@daluu

This comment has been minimized.

Show comment Hide comment
@daluu

daluu Mar 9, 2013

Probably yes, but not w/o additional code to write. It's not available out of the box. Read this Selenium discussion:

https://groups.google.com/forum/?fromgroups=#!topic/selenium-developers/kDSygyDfqD0

You'd need to zip up the file of interest (to upload), then base64 encode that file to string/text, then pass that as an argument to a call to an undocumented JSONWireProtocol command (see the discussion link), check/parse the returned result for the location of the file on remote server then make a call to "sendKeys" passing the location result as argument. That should then perform the upload.

That's the general theoretical approach and should work. But I've not yet tested it out. By the way, I started that discussion.

Would be cool if somebody implemented this for this PHP binding. I don't have the time to do it now.

daluu commented Mar 9, 2013

Probably yes, but not w/o additional code to write. It's not available out of the box. Read this Selenium discussion:

https://groups.google.com/forum/?fromgroups=#!topic/selenium-developers/kDSygyDfqD0

You'd need to zip up the file of interest (to upload), then base64 encode that file to string/text, then pass that as an argument to a call to an undocumented JSONWireProtocol command (see the discussion link), check/parse the returned result for the location of the file on remote server then make a call to "sendKeys" passing the location result as argument. That should then perform the upload.

That's the general theoretical approach and should work. But I've not yet tested it out. By the way, I started that discussion.

Would be cool if somebody implemented this for this PHP binding. I don't have the time to do it now.

@chr0n1x

This comment has been minimized.

Show comment Hide comment
@chr0n1x

chr0n1x Mar 13, 2013

@kalimero82 : As @daluu said, this isn't documented in the JSON Wire Protocol. But you can use

:sessionId/file

http://stackoverflow.com/questions/10559728/uploading-files-remotely-on-selenium-webdriver-via-php

chr0n1x commented Mar 13, 2013

@kalimero82 : As @daluu said, this isn't documented in the JSON Wire Protocol. But you can use

:sessionId/file

http://stackoverflow.com/questions/10559728/uploading-files-remotely-on-selenium-webdriver-via-php

@whhone whhone closed this Jun 14, 2013

@daluu

This comment has been minimized.

Show comment Hide comment
@daluu

daluu Jun 16, 2013

While this issue is closed, it might be helpful if someone wrote on this project's wiki an example of how to do file uploads utilizing the code from StackOverflow, etc. This would help novices out greatly, I'm sure, since this project won't include built in support for said functionality.

daluu commented Jun 16, 2013

While this issue is closed, it might be helpful if someone wrote on this project's wiki an example of how to do file uploads utilizing the code from StackOverflow, etc. This would help novices out greatly, I'm sure, since this project won't include built in support for said functionality.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment