我使用selenium for / .NET 4.0和C#/。
我通过输入日期范围并单击导出来下载文件:
这会自动将CSV下载到我的浏览器上设置的默认下载位置:
public static void Downloadreport()
{
selenium.Open("https://mlis.millenniumlabs.com/Admin/Reports/SpecimenVolume.aspx");
//selenium.Click("link=Specimen Volume Report - Drugs");
selenium.WaitForPageToLoad("30000");
selenium.Click("id=ctl00_cphBody_dtpFrom");
selenium.Type("id=ctl00_cphBody_dtpFrom", DateTime.Now.ToString("MM/dd/yyyy"));
selenium.Type("id=ctl00_cphBody_dtpTo", DateTime.Now.ToString("MM/dd/yyyy"));
selenium.Click("id=ctl00_cphBody_btnExport");
selenium.SetSpeed("6000");
Console.WriteLine("Waiting for result complete");
selenium.IsTextPresent("Specimen Volume Report");
selenium.IsTextPresent("Display Specimen Detail");
}
我无法控制文件名,我想知道我是否有可能:
文件名类似于:Export23498238974.csv