简体   繁体   中英

How to Read the wait time value from dictionary (Excel)

driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(100);

I need to change the above code for selecting the time (100) from dictionary. I need to set the value in the excel as high medium and low. How to change the above code on my requirement. Please help me on this request.

To select the time from a dictionary you can use the following code:

Dictionary<string, int> dictionaryFromExcel = new Dictionary<string, int>
        {
            {"High", 400},
            {"Medium", 100},
            {"Low", 50}
        };

driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(dictionaryFromExcel["Medium"]);

To read values from an Excel file look at this : C# and read values from an Excel file

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM