首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何在swtbot中处理不可预测的shell

如何在swtbot中处理不可预测的shell
EN

Stack Overflow用户
提问于 2014-09-01 14:40:50
回答 1查看 201关注 0票数 0

在我的RCP应用程序中,有时某些shell在某些条件下打开,而我想要处理它们。例如:如果文件夹中已存在文件,则覆盖shell将打开。如果文件将打开,我希望覆盖shell。

我已经尝试过了,如果shell的条件是活动的,请参见代码。但是如果条件在swtbot中不起作用。即使覆盖外壳没有打开,它也会尝试点击覆盖外壳上的确定按钮。

请参见代码:

代码语言:javascript
复制
if (swtBot.shell("Overwrite").isActive) {   
    swtBot.Button("Ok").click(); //This code is every time executing even if Overwrite shell is not opened.
} else {   
    //doing some other operation
}
EN

回答 1

Stack Overflow用户

发布于 2015-03-06 00:34:26

代码语言:javascript
复制
try {   
swtBot.Button("Ok").click(); // it will click the button if the appropriate shell is active
} catch(WidgetNotFoundException e) {   
//doing some other operation
}
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/25600140

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档