DMBrowser.FileUpload Method
Definition
Supports handling file upload to a server. Accepts from 1 to 3 Xpath string values.
public virtual void FileUpload (string xpath1, TimeSpan timeout)
public virtual void FileUpload (string xpath1, TimeSpan timeout)
public virtual void FileUpload (string xpath1, TimeSpan timeout)
Parameters
xpath1 string timeout TimeSpanExamples
// script_version=3.0; everystep_version=4.0.7970.26878; date=11/15/2021; Chrome=91.0.4472.77
Tabs.SetSize (1690, 816);
DMBrowser tab0 = null;
DMBrowser tab1 = null;
Step (1, "Sample File Upload Form - https://cgi-lib.berkeley.edu/ex/fup.html");
tab0 = Tabs.NewTab ();
tab0.GoTo ("https://cgi-lib.berkeley.edu/ex/fup.html");
OpenFileDialogHandler (OpenFileDialogButton.Cancel);
tab0.FileUpload ("//INPUT[@TYPE=\"file\"]", "//INPUT[@NAME=\"upfile\"]", "//INPUT[@VALUE=\"Press\"]/preceding-sibling::INPUT[2]").Click ();
OpenFileDialogHandler (OpenFileDialogButton.Cancel);
tab0.FileUpload ("//INPUT[@TYPE=\"file\"]", "//INPUT[@NAME=\"upfile\"]", "//INPUT[@VALUE=\"Press\"]/preceding-sibling::INPUT[2]").Click ();
Step (2, "Download Task-based Asynchronous Pattern from Official Microsoft Download Center - https://www.microsoft.com/en-gb/download/details.aspx?id=19957");
tab1 = Tabs.NewTab ();
tab1.GoTo ("https://www.microsoft.com/en-gb/download/details.aspx?id=19957");
tab1.Link ("//A[normalize-space()=\"DownloadDirectX End-User Runtime Web Installer\"]", "/HTML/BODY/MAIN/DIV/DIV/FORM/DIV/DIV[2]/DIV/DIV/DIV[1]/DIV[2]/DIV/DIV/DIV/DIV[1]/DIV[2]/DIV[3]/DIV/DIV/DIV/A").Click ();
Step (3, "Download Task-based Asynchronous Pattern from Official Microsoft Download Center - https://www.microsoft.com/en-gb/download/confirmation.aspx?id=19957");
tab1.Navigating ("https://www.microsoft.com/en-gb/download/confirmation.aspx?id=19957");
tab1.Downloading ("TAP.docx", "https://download.microsoft.com/download/5/B/9/5B924336-AA5D-4903-95A0-56C6336E32C9/TAP.docx");
OpenFileDialogHandler (OpenFileDialogButton.Ok, new string[1] {"TAP.docx"});
tab0.FileUpload ("//INPUT[@TYPE=\"file\"]", "//INPUT[@NAME=\"upfile\"]", "//INPUT[@VALUE=\"Press\"]/preceding-sibling::INPUT[2]").Click ();
Tabs.SetSize (1690, 599);
// script_version=3.0; everystep_version=4.0.7970.26878; date=11/15/2021; Chrome=91.0.4472.77
Tabs.SetSize (1690, 816);
DMBrowser tab0 = null;
DMBrowser tab1 = null;
Step (1, "Sample File Upload Form - https://cgi-lib.berkeley.edu/ex/fup.html");
tab0 = Tabs.NewTab ();
tab0.GoTo ("https://cgi-lib.berkeley.edu/ex/fup.html");
OpenFileDialogHandler (OpenFileDialogButton.Cancel);
tab0.FileUpload ("//INPUT[@TYPE=\"file\"]", "//INPUT[@NAME=\"upfile\"]", "//INPUT[@VALUE=\"Press\"]/preceding-sibling::INPUT[2]").Click ();
OpenFileDialogHandler (OpenFileDialogButton.Cancel);
tab0.FileUpload ("//INPUT[@TYPE=\"file\"]", "//INPUT[@NAME=\"upfile\"]", "//INPUT[@VALUE=\"Press\"]/preceding-sibling::INPUT[2]").Click ();
Step (2, "Download Task-based Asynchronous Pattern from Official Microsoft Download Center - https://www.microsoft.com/en-gb/download/details.aspx?id=19957");
tab1 = Tabs.NewTab ();
tab1.GoTo ("https://www.microsoft.com/en-gb/download/details.aspx?id=19957");
tab1.Link ("//A[normalize-space()=\"DownloadDirectX End-User Runtime Web Installer\"]", "/HTML/BODY/MAIN/DIV/DIV/FORM/DIV/DIV[2]/DIV/DIV/DIV[1]/DIV[2]/DIV/DIV/DIV/DIV[1]/DIV[2]/DIV[3]/DIV/DIV/DIV/A").Click ();
Step (3, "Download Task-based Asynchronous Pattern from Official Microsoft Download Center - https://www.microsoft.com/en-gb/download/confirmation.aspx?id=19957");
tab1.Navigating ("https://www.microsoft.com/en-gb/download/confirmation.aspx?id=19957");
tab1.Downloading ("TAP.docx", "https://download.microsoft.com/download/5/B/9/5B924336-AA5D-4903-95A0-56C6336E32C9/TAP.docx");
OpenFileDialogHandler (OpenFileDialogButton.Ok, new string[1] {"TAP.docx"});
tab0.FileUpload ("//INPUT[@TYPE=\"file\"]", "//INPUT[@NAME=\"upfile\"]", "//INPUT[@VALUE=\"Press\"]/preceding-sibling::INPUT[2]").Click ();
Tabs.SetSize (1690, 599);
// script_version=3.0; everystep_version=4.0.7970.26878; date=11/15/2021; Chrome=91.0.4472.77 Tabs.SetSize (1690, 816); DMBrowser tab0 = null; DMBrowser tab1 = null; Step (1, "Sample File Upload Form - https://cgi-lib.berkeley.edu/ex/fup.html"); tab0 = Tabs.NewTab (); tab0.GoTo ("https://cgi-lib.berkeley.edu/ex/fup.html"); OpenFileDialogHandler (OpenFileDialogButton.Cancel); tab0.FileUpload ("//INPUT[@TYPE=\"file\"]", "//INPUT[@NAME=\"upfile\"]", "//INPUT[@VALUE=\"Press\"]/preceding-sibling::INPUT[2]").Click (); OpenFileDialogHandler (OpenFileDialogButton.Cancel); tab0.FileUpload ("//INPUT[@TYPE=\"file\"]", "//INPUT[@NAME=\"upfile\"]", "//INPUT[@VALUE=\"Press\"]/preceding-sibling::INPUT[2]").Click (); Step (2, "Download Task-based Asynchronous Pattern from Official Microsoft Download Center - https://www.microsoft.com/en-gb/download/details.aspx?id=19957"); tab1 = Tabs.NewTab (); tab1.GoTo ("https://www.microsoft.com/en-gb/download/details.aspx?id=19957"); tab1.Link ("//A[normalize-space()=\"DownloadDirectX End-User Runtime Web Installer\"]", "/HTML/BODY/MAIN/DIV/DIV/FORM/DIV/DIV[2]/DIV/DIV/DIV[1]/DIV[2]/DIV/DIV/DIV/DIV[1]/DIV[2]/DIV[3]/DIV/DIV/DIV/A").Click (); Step (3, "Download Task-based Asynchronous Pattern from Official Microsoft Download Center - https://www.microsoft.com/en-gb/download/confirmation.aspx?id=19957"); tab1.Navigating ("https://www.microsoft.com/en-gb/download/confirmation.aspx?id=19957"); tab1.Downloading ("TAP.docx", "https://download.microsoft.com/download/5/B/9/5B924336-AA5D-4903-95A0-56C6336E32C9/TAP.docx"); OpenFileDialogHandler (OpenFileDialogButton.Ok, new string[1] {"TAP.docx"}); tab0.FileUpload ("//INPUT[@TYPE=\"file\"]", "//INPUT[@NAME=\"upfile\"]", "//INPUT[@VALUE=\"Press\"]/preceding-sibling::INPUT[2]").Click (); Tabs.SetSize (1690, 599);