Is it possible to validate the current selected option with Parasoft (xpath)

SaskiaPegaSaskiaPega Posts: 5
edited May 13 in SOAtest

In the code I cannot see which is currently selected and I know that what is selected is send to the server. But I am hoping that there still is a way.

Comments

  • benken_parasoftbenken_parasoft Posts: 895 ✭✭✭

    Any tools that extract (Data Bank), transform (Transformer), and validate (Assertor), have an "Evaluate XPath" button to help you verify what the XPath expression is doing, in case you think the XPath was incorrect or needs to be changed. The XPath expression that you configure is shown in the UI and you can trust that SOAtest will evaluate it correctly.

    If you are asking specifically about the XML Assertor, you can also see my answer to this other thread: in response (or anywhere) - see values that were asserted

  • jakubiakjakubiak Posts: 669 admin

    In HTML, when an option is selected the option tag has a "selected" attribute with no value. You can attempt to validate that the correct option has the "selected" attribute. If no option has a selected attribute, the first one is the one shown by the browser.

  • tonytony Posts: 23
    edited May 13

    To add to what people have said so far, you will probably need to use a CSS selector to find and validate the selected option. In your Browser Validation Tool, for the "Element Locator" choose "XPath" and use the special "css=" prefix to enter a CSS selector. In this case you can use something like: "css=.Example1b option:checked." This will work in more cases than looking for the "selected" attribute, including when there is no "selected" attribute or when the selected option has changed after the page first loaded.

    This assumes you are using the WebDriver engine for playback. The css= prefix will not work in the legacy engine.

  • SaskiaPegaSaskiaPega Posts: 5

    Thanks everyone. Unfortunately none of these seem to be it for us.

Sign In or Register to comment.