Skip to content
New issue

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

blog for file upload example for V5 #3365

Closed
wants to merge 1 commit into from
Closed

blog for file upload example for V5 #3365

wants to merge 1 commit into from

Conversation

caoxu2000
Copy link
Contributor

Proposed changes

Types of changes

  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

Checklist

  • I have read the CONTRIBUTING doc
  • I have added tests that prove my fix is effective or that my feature works
  • I have added necessary documentation (if appropriate)

Further comments

Reviewers: @webdriverio/technical-committee

@jsf-clabot
Copy link

jsf-clabot commented Jan 17, 2019

CLA assistant check
All committers have signed the CLA.

@codecov
Copy link

codecov bot commented Jan 17, 2019

Codecov Report

Merging #3365 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #3365   +/-   ##
=======================================
  Coverage   97.77%   97.77%           
=======================================
  Files         140      140           
  Lines        3010     3010           
  Branches      660      660           
=======================================
  Hits         2943     2943           
  Misses         63       63           
  Partials        4        4

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 6d7bda5...ff64ade. Read the comment docs.

@wswebcreation
Copy link
Member

Hi @caoxu2000

This might also help, I did an investigation for a customer of us and created this project.

Currently I can't migrate it to V5 because there is a bug in the @wdio/firefox-profile-service, but the rest wouldn't change.

Copy link
Member

@christian-bromann christian-bromann left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some wording and formatting changes I would suggest.

Additionally I would love to add a section where the file command is used to upload a file to a remote Selenium standalone server (in case you don't run your test on the local machine).

@wswebcreation can you create an issue so we can get it fixed and extend this blog post with an example running on Sauce Labs?

website/blog/file-upload-example.md Outdated Show resolved Hide resolved
website/blog/file-upload-example.md Outdated Show resolved Hide resolved

```js
// normal Nodejs stuff to create a variable pointing to the file

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change

website/blog/file-upload-example.md Outdated Show resolved Hide resolved
website/blog/file-upload-example.md Outdated Show resolved Hide resolved
website/blog/file-upload-example.md Outdated Show resolved Hide resolved
website/blog/file-upload-example.md Show resolved Hide resolved
@wswebcreation
Copy link
Member

@christian-bromann

This link in my comment is already linking to the issue I created a few days ago, but here it is again #3297

@diachedelic
Copy link
Contributor

Perhaps a more elegant solution than manually displaying a hidden <input type="file"> is to use elementSendKeys? I had success with this custom command:

browser.addCommand('chooseFile', function(filePath) {
  this.elementSendKeys(this.elementId, filePath.split(''))
}, true)

const filePath = path.join(__dirname, 'path/to/your/file');

// The css class name "upload-data-file-input hidden" is just an example and you can replace with your app.
browser.execute('document.getElementsByClassName("upload-data-file-input hidden")[0].style.display = "block"');
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a reason you aren't passing in the located web element as an argument?

@christian-bromann
Copy link
Member

Closing in favor of #3632

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants