SAP NetWeaver Web Dynpro 组件中的字段 ID

发布于 2024-08-11 23:05:03 字数 66 浏览 5 评论 0原文

有没有办法提取 SAP Web Dynpro 组件的字段 ID?

我需要他们建立一个稳定的自动测试环境。

Is there a way to extract the field IDs of SAP Web Dynpro components?

I need them to set up a stable automatic testing environment.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

断桥再见 2024-08-18 23:05:03

使用 Firebug,您可以查看 html 页面 DOM 的当前状态。这意味着您还可以在加载页面后看到通过 AJAX 添加的内容(在 Web Dynpro 的情况下几乎所有内容)。

甚至还有一个功能,您可以单击 HTML 元素(例如表单字段)并跳转到其源,包括 id。

此致,
托比亚斯

With Firebug you can see the current state of the DOM of a html page. This means you can also see stuff which has been added via AJAX after loading the page (in the case of Web Dynpro pretty much everything).

There is even a feature where you can click on a HTML element, e.g. a form field, and jump to its source, including the id.

Best regards,
Tobias

您可能对使用组件标签而不是 ID 感兴趣。

因为,如前所述,您不能依赖 ID:它们是生成的。

这是一个类似 CSS 的选择器,可用于访问元素(在 Ruby 中,使用

def find_element_id_by_label_name(name)
  label_regexp = Regexp.new(name + "\s?\:?")
  l = @browser.label(:text, label_regexp)
  id = l.attribute_value('f')
  id
end

def find_textfield_by_name(name)
  @browser.text_field(:id, find_element_id_by_label_name(name))
end

You may be interested on using components labels instead of IDs.

Because, as previously mentioned, you can't rely on IDs: they are generated.

Here is a CSS-like selector that can be used to access an element (in Ruby, using Watir):

def find_element_id_by_label_name(name)
  label_regexp = Regexp.new(name + "\s?\:?")
  l = @browser.label(:text, label_regexp)
  id = l.attribute_value('f')
  id
end

def find_textfield_by_name(name)
  @browser.text_field(:id, find_element_id_by_label_name(name))
end
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文