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

  • Home
  • SEARCH
  • 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 8574813
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T19:33:29+00:00 2026-06-11T19:33:29+00:00

I’m using JSF 1.2. We want to write some selenium tests (based on xpath)

  • 0

I’m using JSF 1.2. We want to write some selenium tests (based on xpath) but xpath does not seem to have wildcard matching on element id’s.

We cannot turn off prefix ids as we are running as a portlet within IBM Portal Server 6.1 and our application breaks in that environment with the prefix turned off.

Currently we are using xpaths of the form

//*[substring(@id, 54)='id_distributorName']

which will match:
<select size="1" class="firstName" name="viewns_7_8000CB1A0GUIE0IJF799CR10O2_:commonEntryForm:id_distributorName" id="viewns_7_8000CB1A0GUIE0IJF799CR10O2_:commonEntryForm:id_distributorName" >

but it strikes me that assuming JSF will always generate a viewId of the same length is dangerous.

Is there a better way to do this?

We’ve tried using the name attribute for our input controls but of course JSF ignores the attribute and writes it’s own name attribute whose value matches the id presumably for evant handling scripting reasons)

  • 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-11T19:33:31+00:00Added an answer on June 11, 2026 at 7:33 pm

    If you’re using XPath 2.0, just use ends-with() function:

    //*[ends-with(@id, ':id_distributorName')]
    

    If you’re using XPath 1.0, use string-length() to calculate the begin of substring():

    //*[substring(@id, string-length(@id) - 18) = ':id_distributorName']
    

    Here, 18 is the length of id_distributorName (without the : prefix!).

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

Sidebar

Related Questions

I have a French site that I want to parse, but am running into
I want to count how many characters a certain string has in PHP, but
I have just tried to save a simple *.rtf file with some websites and
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
This could be a duplicate question, but I have no idea what search terms
I want to construct a data frame in an Rcpp function, but when I
I have thousands of HTML files to process using Groovy/Java and I need to
I have a .ini file as follows: [playlist] numberofentries=2 File1=http://87.230.82.17:80 Title1=(#1 - 365/1400) Example
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
That's pretty much it. I'm using Nokogiri to scrape a web page what has

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.