Results 1 to 2 of 2
  1. #1

    Selenium IDE XPath IDRegular Expression Assistance

    Many of the controls I am accessing in our AUT have a dynamic id. In other words, every time I re-visit a page the id of the control has changed slightly. I am trying to write regular expressions so Selenium IDE can find these objects, but so far I haven't had any luck. I've followed the regular expression rules I've found online for Selenium, but I've tried several different formats and when I click the Find button I get an error that the locator isn't found.

    Below is the XPath for one of the target controls that I am trying to access. I visited the page twice and captured the XPath so you can see what changes each time you visit the page the object is located on.



    Does anyone know how to form the regular expression so this object can be found? I've been working on this on my own for a while, using the Internets trying to find a solution, but so far I haven't been able to get this to work.

  2. #2

    Re: Selenium IDE XPath IDRegular Expression Assistance

    Try this
    <font class="small">Code:</font><hr /><pre>
    //*[contains(@id,"StaticText1") and contains(@id,"StaticText2")]
    </pre><hr />
    If the element is not unique you may use
    <font class="small">Code:</font><hr /><pre>
    //*[contains(@id,"StaticText1") and contains(@id,"StaticText2")][i]
    </pre><hr />
    where i the number of the element of this type
    Press any key to continue, or any other key to cancel.



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
BetaSoft Inc.
All times are GMT -8. The time now is 07:22 PM.

Copyright BetaSoft Inc.