field IDs in SAP NetWeaver Web Dynpro components

747 views Asked by At

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.

2

There are 2 answers

0
Arnaud Leymet On

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
2
AudioBubble On

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