1

I don't know how to fix the error, can somebody help?

3 Answers3

2

Maybe this can help you:

using OpenQA.Selenium;
using OpenQA.Selenium.Chrome;
using Serilog;
using System.IO;
using System.Reflection;

namespace StackOverFlow.Answer.Selenium.RefreshPage
{
    class RefreshPage
    {
        public static IWebDriver driver;      

        [Test]
        [Category("RefreshPage")]
        public void RefreshPageTest()
        {
            Log.Information("Get instance Chrome Browser");
            driver = new ChromeDriver(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), OptionsChrome());

            Log.Information("Acess your url site");
            driver.Navigate().GoToUrl("http://YourUrlSite/index.aspx");

            Log.Information("Refresh page command");
            driver.Navigate().Refresh();
        }      

        private ChromeOptions OptionsChrome()
        {
            ChromeOptions chromeOptions = new ChromeOptions();
            chromeOptions.AddArgument("--start-maximized");
            chromeOptions.AddArguments("--disable-infobars");
            chromeOptions.AddArguments("--disable-notifications");
            return chromeOptions;
        }
    }
}
1

If i'm not wrong it should be, it's been some time since i touched selenium.

driver.Navigate().Refresh();

I searched a bit & this post from StackOverflow seem to back this up.

mrdnk
  • 656
  • 9
  • 24
matthey
  • 39
  • 7
0

It's an issue with chrome web driver, not with refreshing. If you didn't, you need to download chrome web driver or something might be wrong with your environment PATH variable.

Afraid
  • 1
  • 2