JavaScript:如何在抛出异常时退出webdriver?

时间:2016-10-14 13:09:33

标签: javascript node.js selenium selenium-webdriver

以下是selenium网站中的并行流js文件示例:

webdriver - Google Search

如果在等待标题为driver.quit()时抛出超时异常,则程序只是控制台记录错误信息并且不关闭窗口。

如何在抛出异常时关闭窗口,即。致电 public static IForm<Order> BuildOrderForm() { return new FormBuilder<Order>() .Field(nameof(RecipientFirstName)) .Field(nameof(RecipientLastName)) .Field(nameof(RecipientPhoneNumber)) .Field(nameof(Note)) .Field(new FieldReflector<Order>(nameof(UseSavedSenderInfo)) .SetActive(state => state.AskToUseSavedSenderInfo) .SetNext((value, state) => { var selection = (UseSaveInfoResponse)value; if (selection == UseSaveInfoResponse.Edit) { state.SenderEmail = null; state.SenderPhoneNumber = null; return new NextStep(new[] { nameof(SenderEmail) }); } else { return new NextStep(); } })) .Field(new FieldReflector<Order>(nameof(SenderEmail)) .SetActive(state => !state.UseSavedSenderInfo.HasValue || state.UseSavedSenderInfo.Value == UseSaveInfoResponse.Edit) .SetNext( (value, state) => (state.UseSavedSenderInfo == UseSaveInfoResponse.Edit) ? new NextStep(new[] { nameof(SenderPhoneNumber) }) : new NextStep())) .Field(nameof(SenderPhoneNumber), state => !state.UseSavedSenderInfo.HasValue || state.UseSavedSenderInfo.Value == UseSaveInfoResponse.Edit) .Field(nameof(SaveSenderInfo), state => !state.UseSavedSenderInfo.HasValue || state.UseSavedSenderInfo.Value == UseSaveInfoResponse.Edit) .Build(); } } }

0 个答案:

没有答案