我已将Endpoint设置为Local Selenium WebDriver,其连接已经过测试为"已连接"。
WebDriver,WebDriver.Support已添加到参考文献中。
代码段如下所示:
namespace HoT
{
class Program
{
[STAThread]
public static int Main(string[] args)
{
// Uncomment the following 2 lines if you want to automate Windows apps
// by starting the test executable directly
//if (Util.IsRestartRequiredForWinAppAccess)
// return Util.RestartWithUiAccess();
Keyboard.AbortKey = System.Windows.Forms.Keys.Pause;
int error = 0;
var webDriver = new ChromeDriver(@"C:\Users\myName\Documents\Ranorex\RanorexStudio Projects\HoT\HoT\ExternalModules\chromedriver");
webDriver.Navigate().GoToUrl("http://www.google.com");
try
{
error = TestSuiteRunner.Run(typeof(Program), Environment.CommandLine);
}
catch (Exception e)
{
Report.Error("Unexpected exception occurred: " + e.ToString());
error = -1;
}
return error;
}
}
}
我得到的只是一个控制台窗口和一个弹出窗口,没有Chrome浏览器实例或警告或错误。谁知道为什么?
答案 0 :(得分:1)
您需要使用
启动浏览器export class Helper {
static add(x: number, y: number): number {
return x + y;
}
}
Helper.add(1,2)