If I keep two FileDownload (find code in below link) in Pause mode and if I start 3rd third instance of Filedownload, I am getting timeout error.
I am working on a WPF application where I need to download multiple .zip files from a CDN server. I am using following code to download file.
https://www.codeproject.com/Articles/35954/C-NET-Background-File-Downloader?msg=5402177#xx5402177xx
In my case I have to download multiple files simultaneously and to show progress for each file downloading. I am creating an instance of FileDownloader (find code in below link) class each time when user downloads a file.
I am facing operation timeout error, when I am keeping two instances of FileDownloader on Puase mode and when I start 3rd instance. The 3rd instance continuously waiting at webResp = (HttpWebResponse)webReq.GetResponse(); and after sometime it throws operation timeout error.
If I try to download same zip files through chrome browser, and if keep first to on pause still the 3rd file getting downloaded.
Any suggestions, how to resolve the issue?
Resolved the issue, by default the number of connection an application can open are 2 but with below line of code you can set it to higher number. It can also be done in app.config
https://msdn.microsoft.com/en-us/library/fb6y0fyc(v=vs.110).aspx
ServicePointManager.DefaultConnectionLimit = 65000;
Related
I am looking for any ideas on how best to handle file upload failures in selenium webdriver.
Recently I have been seeing a higher number of failures in my webdriver test suite, the error I am trying to fix is a failure in the Internet Explorer tests caused by a file upload failing.
In webdriver the only way I know to upload a file to an input element is to use the SendKeys() method and pass the file path to SendKeys() this works like a charm in chrome and firefox but periodically have had issues with it in Internet Explorer. What appears to happen is the file upload window gets opened but the path is not typed nor is the file uploaded. This leaves the node with a file upload window open, being this is a native window's window and not a webpage selenium cannot interact with the pop up.
The result is the HttpWebRequest does not get a response back triggering a WebdriverTimoutException. This results in the session getting cleaned up. This causes a cascade of failures for all other tests in the suite as the session has been terminated.
Environment Info:
Selenium.Webdriver & Seleneium.Support version 3.7.0
IEDriver 3.7.0
Testing in IE 11
I may be late to answer this question, but someone will benefit.
The file(s) in question should be available on the machine (be it local or remote server) that your program is running on, for example, in your /resources directory
On your local machine, this should work.
chooseFileElement.waitForVisible().type("/file/path/filename.jpg");
clickButton("Attach File");
On Remote Server however, you need to associate a new instance of LocalFileDetector to the <input type=file> element.
LocalFileDetector detector = new LocalFileDetector();
File localFile = detector.getLocalFile("/file/path/filename.jpg");
RemoteWebElement input = (RemoteWebElement) myDriver().findElement(By.id("fileUpload"));
input.setFileDetector(detector);
input.sendKeys(localFile.getAbsolutePath());
clickButton("Attach File");
It really depends on how you've written your code. What I would do is when you get down to the end and detect that you've gotten into a bad state, e.g. the File | Open dialog has been left open, close the dialog and start that part of the script over. I'm not sure what start over in your case would mean... maybe it means reload the page and start from there... maybe it means just .sendKeys() to the INPUT again.
You should be able to dismiss the dialog by sending an ESC to the page. You should be able to use .sendKeys() on the BODY tag or whatever.
You should be able to detect the bad state by catching certain exceptions.
I am writing a automation script using selenium web driver for downloading multiple files one by one from a web site in Mozilla fire fox. I have downloaded first file successfully and next time I need to wait for download to complete. Can anybody help how to identify an ongoing download is completed using c# selenium web driver.? Since I am not getting the download complete status, I am unable to continue downloading next file.
Assuming you are testing file downloading in Firefox as you mentioned. Here is an approach to achieve what you want.
Open new window/tab in Firefox and navigate to 'about:downloads' directly.
i.e. driver.Navigate().GoToUrl("about:downloads");
You will get the list of downloads (i.e. already downloaded files and the file which is being downloaded currently.)
You will have to switch between your site tab and downloads tab.
Now on downloads tab, looking at HTML, you can easily find out in progress download using state or status attributes.
For example, for the first file in the list, if state="0" and/or status
contains the text 'remaining', it means downloading is in progress
So you can wait till state becomes state = 1 and/or status does not contain >the text 'remaining'
Refer the attached screen shot.
The explanation I gave here looks very high level, but I am sure this approach will work. It is simple too.
Let me know if you have any queries on this.
I have a GAE module on IntelliJ and when I after I edit the jsp files in it I can just go to the web browser, hit refresh and the changes show up. The other day I needed to access this from a different computer so I added --address=0.0.0.0 to the server parameters and after that changes to the jsp stopped showing up on the browser until I did a server restart. I removed the option and it started working again. Added it again and it stopped working, repeated several times, always the same result.
So how I can access the server from another computer yet have the ability to make changes and have those changes show up on the web browser without a server restart?
I am using an exploded war, and I have "update classes and resources" on both "on update" and "on frame deactivation".
This is with IntelliJ 13 on OSX 10.9
Thanks.
There are two ways to make iDEA update the runtime project:
Automatic via on frame deactivation, which means that IDEA updates project when you switch to another app (usually browser), i.e. when IDEA looses window focus. This works "automagically" while you test on the same computer, because you usually switch between IDEA and browser (or mobile emulator).
Manually via on update, which requires you to manually click the update button (the green circular arrows) in IDEA inside the running project pane.
I am working on a WPF application. I have used two “tasks” inside a button click event for parallel execution.
One task calls “Method1” which downloads files from a server. The second task calls “Method2”.
Method2 contains the following operations:
Download 2 files from a server
Parse & read the files' contents
Scrape a site to fetch site details
In the scraping operation, we are creating a WebBrowser object to load the site's contents.
The issue is that - while executing the button_click event - I am getting the following error:
How can I solve this issue? Any help would be appreciated.
Thanks,
Ranish
WebBrowser is a control and can't be used in cross threading. My advice is using HttpWebRequest, HttpWebResponse and HTML Agility Pack library to scrap HTML instead
can somebody please show me how to return the file modified date from the Silverlight XAP file that the client has just opened. I'm adding a tooltip that shows this date so that I can verify which version of XAP the client is running.
Thanks.
Because this project is in a state of flux, I'm doing updates every few hours. Currently there are about 3-4 users/testers but they can leave their browser open for the day. I have a poll function and I need this to send the date/time of the local XAP file back to the WCF server so it can let it know if an update is available. If so, the user will see a popup msg and prompt them to hit refresh.
I believe the RunningAssembly version would need to be updated by myself and is not automatically incremented with each build? If it is, then RunningAssembly is the way to go...
Thanks for the response..