问题描述
我正在尝试使用 WinAppDriver、Inspect.exe、c# 单元测试来提取单选按钮值。
我在 youtube 上发现了这个非常有趣的视频来打开 excel 文件:
https://www.youtube.com/watch?v=J0O-FCeLEqg
它正在将数据提取到表格中,但带有单选按钮的单元格没有值,仅提取带有文本或数值的单元格。
有没有办法获取单选按钮的值?
这是视频中的代码:
using ExcelDataReader;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using OpenQA.Selenium.Appium;
using OpenQA.Selenium.Appium.Windows;
using System;
using System.Data;
using System.IO;
namespace TestAutomationTVOnYouTube
{
[TestClass]
public class ExcelTests
{
static DataSet mTestData;
[ClassInitialize]
public static void BeforeAllTests(TestContext testContext)
{
using (var stream = File.Open(@"fullpath filename",FileMode.Open,FileAccess.Read))
{
// Auto-detect format,supports:
// - Binary Excel files (2.0-2003 format; *.xls)
// - OpenXml Excel files (2007 format; *.xlsx,*.xlsb)
using (var reader = ExcelReaderFactory.CreateReader(stream))
{
mTestData = reader.AsDataSet
(
new ExcelDataSetConfiguration()
{
ConfigureDataTable = (tableReader) => new ExcelDataTableConfiguration()
{
UseHeaderRow = false
}
}
);
}
}
}
[TestMethod]
public void LaunchExcel()
{
WindowsDriver<WindowsElement> myDriver = null;
AppiumOptions appOptions = new AppiumOptions();
appOptions.AddAdditionalCapability("app","Excel");
appOptions.AddAdditionalCapability("appArguments",@"/e fullpath filename");//"/e" : launch without splashscreen
myDriver = new WindowsDriver<WindowsElement>(
new Uri("http://127.0.0.1:4723"),appOptions
);
}
}
}
当我单击单选按钮时,我也使用 Inspect.exe 来识别单元格,但它无法识别单选按钮值,其相关单元格名称为“矩形”
[1]:https://i.stack.imgur.com/ePmKq.png预先感谢您的回复。
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)