-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Upload files #223
Comments
no, there isn't I'm afraid. LocalFileDetector webdriver is not available for node.js yet, as far as I know. |
|
I've attemped to use setValue, however I'm unable to get that to work. I've reopened the question on stackoverflow here. |
@snipes76 Is your input field using the |
No, I am not. I just tried it with that attribute, but no dice. I just added an .assert.valueContains to make sure the value is set, also. |
What browser are you using? Are you sure you are passing the file in correctly? |
BTW the multiple attribute won't work with GhostDriver/PhantomJS |
Firefox and Chrome. Manually, I'm able to enter "http://localhost:3000/testfile.txt" into the file upload window, and correctly upload the file. |
I'm using a file path like this: Make sure that you are resolving that path correctly to a file that exists with something like: |
I just tested it the way you provided. My current directory is basically under a /nw/tests folder that I defined for my test. I made sure to move the testfile.txt there. I verified it using the following code I stated in my stackoverflow question how I manually went into chrome dev tools and set the value of the input to my path, which still did not work. setValue actually works for you in nightwatch? I can't even get setting value in the browser to manually work. |
Yes, I am using PhantomJS as my browser, I haven't tried with other browsers, but we have tests that upload images all day long. The only caveat that I'm aware of is that input fields with the |
It's working! Wow. I'll have to dig through everything I did to see why it is working now and wasn't before. Basically, I decided I'd try using phantomjs instead of just the default with Firefox. My drivers weren't loading correctly, so I fixed that. I also removed multiple from the input tag. I started using --verbose and it was stating "cannot find input[type="file"]" for the .setValue even though it found it for .waitForElementVisible. I changed that to .setValue(input#fileUpload,require('path').resolve(__dirname + '/testfile.txt'). It worked on phantomJS! Then I tried it on IE10, and firefox, and it works fine. Now that it is working, I tried using "http://localhost:3000/testfile.txt" as the path. That does not work. My suspicision is that changing the path to use the current working directory fixed one issue. Using the ID tag instead of input[type="file"] fixed a different issue. |
Great! Save your code! 👍 |
@richard-flosi - Hi dude. Working on Nighwatch and phantomjs here. Everything is visible. Would be really grateful to get some help to see how u got it working/ thanks |
@timaw how did u get the phantomjs to work? This is what the html element looks like: Any help would be Much appreciated. Thanks |
How do I detect when the upload is finished to continue the test? |
@chickenwing I would imagine your UI would change to indicate something to the user, so I would just look for that change. |
With regards to this, if I'm using a File reader |
@RongxinZhang Im also testing with phantomjs, had the issue where the upload just hangs. Resolution was to remove the style attribute
|
Is filedetector available now for nodejs to upload file on browserstack? |
Hello, is there any possibility or undocumented feature to upload a file with nightwatch or selenium protocol?
For example here is realisation on java https://saucelabs.com/resources/selenium-file-upload
The text was updated successfully, but these errors were encountered: