在浏览器中生成元素后,有一个块Ui覆盖所有元素几秒钟,因为我面临一个问题,因为元素已经存在,web驱动程序尝试单击元素但是单击是Block UI收到.我曾尝试使用wait Until但我没有帮助,因为我可以在C#webdriver中找到isClickAble
var example = _wait.Until<IWebElement>((d) => d.FindElement(By.XPath("Example")));
var example2 = _wait.Until<IWebElement>(ExpectedConditions.ElementIsVisible(By.XPath("Example")));
example.click();
example2.click();
Run Code Online (Sandbox Code Playgroud)
isClickAble是否有C#等价物,提前谢谢
嗨,我想记录测试失败的消息,我知道可以检查状态
TearDown
Run Code Online (Sandbox Code Playgroud)
使用以下
TestContext.CurrentContext.Result.Status.ToString();
Run Code Online (Sandbox Code Playgroud)
可以在 TearDown 中获取测试失败的原因。像下面这样的东西
Expected: True
But was: False
at NUnit.Framework.Assert.That(Object actual, IResolveConstraint expression, String message, Object[] args)
at NUnit.Framework.Assert.IsTrue(Boolean condition)
at Test.FileSystemTests.QuoteFiles() in ExampleTests.cs: line 57
Run Code Online (Sandbox Code Playgroud) 我想在创建之前检查表格是否存在.谢谢你提前
using Excel = Microsoft.Office.Interop.Excel;
Excel.Application excel = new Excel.Application();
excel.Visible = true;
Excel.Workbook wb = excel.Workbooks.Open(@"C:\"Example".xlsx");
Excel.Worksheet sh = wb.Sheets.Add();
int count = wb.Sheets.Count;
sh.Name = "Example";
sh.Cells[1, "A"].Value2 = "Example";
sh.Cells[1, "B"].Value2 = "Example"
wb.Close(true);
excel.Quit();
Run Code Online (Sandbox Code Playgroud) 我已经尝试了这两个代码,但是却没有执行,有人可以告诉我为什么吗?
//Type one approach
Actions action = new Actions(Browser.Driver);
IWebElement sourceElement = Browser.Driver.FindElement(By.XPath(Filexpath));
IWebElement targetElement = Browser.Driver.FindElement(By.XPath(NewXpath));
//Type two approach
Actions Sourcebuilder = new Actions(Browser.Driver);
Actions SourceAction = Sourcebuilder.ClickAndHold(sourceElement);
Sourcebuilder.Build();
SourceAction.Perform();
/// move and drop
Actions builder = new Actions(Browser.Driver);
Actions action = builder.MoveToElement(targetElement);
builder.Release(targetElement);
builder.Build();
action.Perform();
Run Code Online (Sandbox Code Playgroud)
提前致谢
我试图为此指定IE驱动程序日志路径,我使用Command-Line.Code,如下所示
var optionsIe32 = new InternetExplorerOptions
{
IntroduceInstabilityByIgnoringProtectedModeSettings = true,
EnsureCleanSession = true,
BrowserCommandLineArguments = "--log-file=\"C:\\IE.log\"
};
var _webDriver = new InternetExplorerDriver(pathContainingIE32DriverServer, optionsIe32);
Run Code Online (Sandbox Code Playgroud)
但是发生错误时日志文件不会更新.
我在这做错了什么?提前致谢