I'm running front-end tests using nightwatch.js using the Chrome Driver. I need to test that image uploading works properly, presumably through the provided file input since there are callbacks that run on a successful post.
I'm aware that this can be done using sendKeys method of the Selenium Web Driver.
How can you accomplish this using javascript and nightwatch.js? Can you access the Selenium webdriver or an interface with it?
html file through a browser, the client will be able to upload a file to the server using Ajax and pure JavaScript. A pure JavaScript file uploader simplifies Ajax based interactions with the server.
Nightwatch. js framework is a Selenium-based test automation framework, written in Node. js and uses the W3C WebDriver API (formerly Selenium WebDriver). It works by communicating over a restful HTTP API with a WebDriver server (such as ChromeDriver or Selenium Server).
Nightwatch. js is an automated testing framework for web applications and websites, written in Node. js and using the W3C WebDriver API (formerly Selenium WebDriver).
Use this for uploading image from local desktop
.setValue('input[type="file"]', require('path').resolve('/home/My-PC/Desktop/img.png'))
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With