locked
Usage of Regular expressions RRS feed

  • Question

  • Hi,

    Using regular expressions, I'm trying to customize the properties of a WebPane whose value is changing dynamically during runtime. The recorded value of the pane is: "style=\"WIDTH: 123px\" id=ext-gen986 class"

    I've customized like this: Regex exp = new Regex("style=\"WIDTH: 123px\" id=ext-gen*")

    this.UITempWindow.UITempDocument.UIExtgen175Pane.SearchProperties.Add("ControlDefinition", exp);

    Passing the exp as argument, error is returned since the value must be string. But if I use exp.ToString(), the value is not taken as regular expression, it is performing string comparison which obviously fails.

    Can we resolve this? Is there any other way of using regular expressions in customizing the control properties?

    Regards,

    Vijaya

     

    I've customized like this:

    Regex

    Wednesday, March 24, 2010 3:08 PM

Answers

  • We don't have full support for Regex but do have Contains operator.  You can use something like -

    this.UITempWindow.UITempDocument.UIExtgen175Pane.SearchProperties.Add("ControlDefinition", "id=ext-gen

     

    , PropertyExpressionOperator.Contains);

    Thanks


    http://blogs.msdn.com/gautamg
    Wednesday, March 24, 2010 5:06 PM

All replies

  • We don't have full support for Regex but do have Contains operator.  You can use something like -

    this.UITempWindow.UITempDocument.UIExtgen175Pane.SearchProperties.Add("ControlDefinition", "id=ext-gen

     

    , PropertyExpressionOperator.Contains);

    Thanks


    http://blogs.msdn.com/gautamg
    Wednesday, March 24, 2010 5:06 PM
  • Thanks for the info. Using the PropertyExpressionOperator, problem is resolved.

     

    Thursday, March 25, 2010 5:46 AM
  • Hi Gautam,

    Is this 'Contains' operator works only for controls and not for top level windows?

    I am using CodedUI for automation on Dynamics AX (ERP from MS) WinClient. I havebeen using Contains operator in finding top level windows (as titles keep chaning) . But lately, I realized that 'Contains' opearator is NOT at all working (when we started running tests on a differnt machine, than the one recorded...test started to fail!)

    I double checked this behaviour. Playback engine was completely dependant on titles and not the 'Name' property of the window. When I added the new title (on which tests were failing), playback engien started finding the controls.

    But adding titles should not be an ideal solution here. We want to make a generic library which can be used accross diffent machines using differnt data (titles dependant on data).

    Is there any setting or configuration to tell the engine to 'respect' the 'Contains' operator?

    Thanks, Praveen

    Wednesday, December 19, 2012 7:44 AM