【发布时间】:2020-08-25 22:53:46
【问题描述】:
【问题讨论】:
【问题讨论】:
也许这可以帮助你:
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;
}
}
}
【讨论】:
【讨论】:
这是一个issue with chrome web driver,没有刷新。如果没有,则需要下载 chrome Web 驱动程序,否则您的环境 PATH 变量可能有问题。
【讨论】: