【发布时间】:2015-09-23 14:03:35
【问题描述】:
我们正在使用带有 Eclipse SWT 的 RAP 在浏览器中呈现我们的应用程序 UI。 我们希望使用 selenium 自动化应用程序测试,这需要每个 HTML 组件的 ID。 但问题是小部件(在这种情况下为文本)没有“id”作为浏览器中可见的属性。
我们已经尝试使用 Text 小部件的以下 setData 方法,但 id 属性在浏览器中仍然不可见。
tf_offerId.setData(SWT.SKIN_ID, "myId1");
tf_offerId.setData(SWT.SKIN_CLASS, "myClass");
这是我们的示例代码。
class A {
private Text tf_offerId;
void method1() {
Composite comp_left = new Composite(this, SWT.NONE);
Composite comp = new Composite(comp_left, SWT.NONE);
GridLayout gl_comp = new GridLayout(3, false);
gl_comp.marginWidth = 0;
comp.setLayout(gl_comp);
comp.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false,1, 1));
Label lbl = new Label(comp, SWT.NONE);
lbl.setText("Offer Id / Cluster Id");
lbl.setBackground(new Color(getDisplay(),220,220,220));
lbl.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1));
tf_offerId = new Text(comp, SWT.BORDER);
tf_offerId.setLayoutData(new GridData(SWT.FILL, SWT.CENTER,true, false, 1, 1));
tf_offerId.setToolTipText("Usage:\nsss_pricing/se_configuration-OfferId\nse_calculation-OfferId\nsss_build/sss_validation-ClusterId");
}
}
请提出可能的解决方案。
【问题讨论】:
-
如果您认为某个答案解决了问题,请单击绿色复选标记将其标记为“已接受”。这有助于将注意力集中在仍然没有答案的旧帖子上。
标签: eclipse swt eclipse-rap