I am automating with browser stack. I am downloading the file in browser stack using selenium, but I want verify the downloaded file. Can I do this using selenium.(Upon downloading the file, file will be browser stack server's folders, i need to verify that file has downloaded or not).
Asked
Active
Viewed 1,055 times
1 Answers
0
In selenium you can have a problem with this. I'm using java script command where I'm checking the file is empty or not. It's checking response header when you clicking
object response = ((IJavaScriptExecutor)Driver.WebDriver).ExecuteAsyncScript(
"var url = arguments[0];" +
"var callback = arguments[arguments.length - 1];" +
"var xhr = new XMLHttpRequest();" +
"xhr.open('GET', url, true);" +
"xhr.onreadystatechange = function() {" +
" if (xhr.readyState == 4) {" +
" callback(xhr.getAllResponseHeaders());" +
" }" +
"};" +
"xhr.send();", url);
string json = new JavaScriptSerializer().Serialize(response);
In response header is information about "Content-Length:" and I'm looking for this key and I'm checking there is enough length.

tomasz.myszka
- 101
- 1
- 5