Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8771285
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T17:44:47+00:00 2026-06-13T17:44:47+00:00

I am trying to use a software name Selenium (web rat) to simulate user

  • 0

I am trying to use a software name Selenium (web rat) to simulate user interact with browser

For example , I trying to put the username field with name ‘john

However the ‘id’ of ‘username textbox’ is username_947232, username_8237

The format which username_[random numbers]

My syntax is following:

//*[contains(@id="username_(/\d+/)")]

but it’s not working , anyone have any idea??

Thank you for any suggestions!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T17:44:48+00:00Added an answer on June 13, 2026 at 5:44 pm

    Use:

    //*[starts-with(@id, 'username_')
      and 
       floor(substring-after(@id, 'username_')) = substring-after(@id, 'username_')
        ]
    

    Explanation:

    This expression selects any element the string value of whose id attribute starts with the string "username_" and the remainder of this string (after the starting "username_") is an integer.

    Here we use the fact that the following expression is true if and only if $string represents an integer:

    floor($string) = $string
    

    XSLT – based verification:

    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
     <xsl:output omit-xml-declaration="yes" indent="yes"/>
    
     <xsl:template match="/">
         <xsl:copy-of select=
          "//*[starts-with(@id, 'username_')
      and
       floor(substring-after(@id, 'username_')) = substring-after(@id, 'username_')
        ]
        "/>
     </xsl:template>
    </xsl:stylesheet>
    

    When this transformation is applied on this XML document:

    <t>
     <user id="username_Xyz"/>
     <user id="username_Xyz123"/>
     <user id="username_123Xyz"/>
     <user id="username_123Xyz456"/>
     <user id="username_2015"/>
    </t>
    

    the Xpath expression is evaluated and the selected node from this evaluation is copied to the output:

    <user id="username_2015"/>
    

    Do note: The other two answers to this question would select all 5 user elements from the above document — which, of course, is incorrect.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to use this http://www.rcsb.org/pdb/software/rest.do REST services with Qt. I did some get
I'm trying to plug tcmalloc into a suite of software that we currently use
Hi I'm trying use a datepicker on a field I have. I'm trying to
I am trying to use some software which has been written in C++ in
i'm trying use facebook API to upload photo in my fan page. I downloaded
I am trying use gem tire to search in my application. I have tables
I was trying use a set of filter functions to run the appropriate routine,
I'm trying use self-signed certificate (c#): X509Certificate2 cert = new X509Certificate2( Server.MapPath(~/App_Data/myhost.pfx), pass); on
I'm trying use mod_rewrite to rewrite URLs from the following: http://www.site.com/one-two-file.php to http://www.site.com/one/two/file.php The
I am trying use a Java Uploader in a ROR app (for its ease

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.