views:

55

answers:

3

Is there a way to extract the field id's of SAP's webdynpro components ? I need them to set up a stable automatic testing environment.

A: 

Hello
slightly off-topic, but could be useful : there is a set of article on sdn about testing webdynpro ui

regards
Guillaume

PATRY
A: 

Hi

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

Tobias
Hi Tobias,I already tried firebug, but for those specific components the fieldId is not directly readable through it. There is just a dynamic alphanumeric string which is just in internal calls to the webdynprobackend to gather the real field id.
tmax_dev
Hi tmx_dev, I tested it with InputFields. They are converted into <input> tags with an id that is generated in the following way:IDNDEHLFMJED.<view name>.<user defined id>Can't you use those ids for testing? They seem to be stable. I did a few tests and they did not change between different program versions or servers. I use Web Dynpro 7.11. Maybe it is different in earlier versions.
Tobias
A: 

Hi,

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
Arnaud Leymet