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 7090063
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T07:59:55+00:00 2026-05-28T07:59:55+00:00

I am able to log on and access my account page, here is a

  • 0

I am able to log on and access my account page, here is a sample of the HTML (modified for brevity and to not exceed the URL limit):

    <div class='table m_t_4'>
<table class='data' border=0 width=100% cellpadding=0 cellspacing=0>
    <tr class='title'>
        <td align='center' width='15'><a></a></td>
        <td align='center' width='60'></td>
    </tr>
    <TR bgcolor=>

        <td valign='top' align='center'>1</TD>
        <td valign='top' align='left'><img src='/images/sale_small.png' alt='bogo sale' />Garden Escape Planters</TD>
        <td valign='top' align='right'>13225</TD>
        <td valign='top' align='center'>2012-01-17 11:34:32</TD>
        <td valign='top' align='center'>FILLED</TD>
        <td valign='top' align='center'><A HREF='https://www.daz3d.com/i/account/orderdetail?order=7886745'>7886745</A></TD>
        <td valign='top' align='center'><A HREF='https://www.daz3d.com/i/account/req_dlreset?oi=18087292'>Reset</A>
    </TR>

Note that the only item I really need is the first HREF with the “order=7886745’>7886745<“…

And there are several of the TR blocks that I need to read.

I am using the following xpath coding:

    browser.get('https://www.daz3d.com/i/account/orderitem_hist?')

account_history = browser.find_element_by_xpath("//div[@class='table m_t_4']");
print account_history

product_block = account_history.find_element_by_xpath("//TR[contains(@bgcolor, '')]");
print product_block

product_link = product_block.find_element_by_xpath("//TR/td/A@HREF")
print product_link

I am using the Python FireFox version of webdriver.

When I run this, the account_history and product_block xpath’s seem to work fine (they print as “none” so I assume they worked), but I get a “the expession is not a legal expression” error on the product_link.

I have 2 questions:

1: Why doesn’t the “//TR/td/A@HREF” xpath work? It is supposed to be using the product_block – which it (should be) just the TR segment, so it should start with the TR, then look for the first td that has the HREF…correct?

I tried using the exact case used in the HTML, but I think it shouldn’t matter…

2: What coding do I need to use to see the content (HTML/text) of the elements?

I need to be able to do this to get the URL I need for the next page to call.

I would also like to see for sure that the correct HTML is being read here…that should be a normal part of debugging, IMHO.

How is the element data stored? Is it in an array or table that I can read using Python? It has to be available somewhere, in order to be of any use in testing – doesn’t it?

I apologize for being so confused, but I see a lot of info on this on the web, and yet much of it either doesn’t do anything, or it causes an error.

There do not seem to be any “standard” coding rules available…and so I am a bit desperate here…

I really like what I have seen in Selenium up to this point, but I need to get past it in order to make this work!

Edited!

OK, after getting some sleep the first answer provided the clue – find_elements_by_xpath creates a list…so I used that to find all of the xpath(“//a[contains(@href,’https://www.daz3d.com/i/account/orderdetail?order=&#8217;)]”); elements in the entire history, then accessed the list it created…and write it to a file to be sure of what I was seeing.

The revised code:

    links = open("listlinks.txt", "w")
browser.get('https://www.daz3d.com/i/account/orderitem_hist?')

account_history = browser.find_element_by_xpath("//div[@class='table m_t_4']");
print account_history.get_attribute("div")

product_links = []
product_links = account_history.find_elements_by_xpath("//a[contains(@href,'https://www.daz3d.com/i/account/orderdetail?order=')]");
print str(len(product_links)) + ' elements'
for index, item in enumerate(product_links):
    link = item.get_attribute("href")
    links.write(str(index) + '\t' + str(link) + '\n')

And this gives me the file with the links I need…

    0   https://www.daz3d.com/i/account/orderdetail?order=7905687
1   https://www.daz3d.com/i/account/orderdetail?order=7886745
2   https://www.daz3d.com/i/account/orderdetail?order=7854456
3   https://www.daz3d.com/i/account/orderdetail?order=7812189

So simple I couldn’t see it for tripping over it…

Thanks!

  • 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-05-28T07:59:56+00:00Added an answer on May 28, 2026 at 7:59 am

    1: Why doesn’t the “//TR/td/A@HREF” xpath work? It is supposed to be
    using the product_block – which it (should be) just the TR segment, so
    it should start with the TR, then look for the first td that has the
    HREF…correct?

    WebDriver only returns elements, not attributes of said elements, thus:

    "//TR/td/A" 
    

    works, but

    "//TR/td/A@HREF"
    

    or

    "//TR/td/A@ANYTHING"
    

    does not.

    2: What coding do I need to use to see the content (HTML/text) of the
    elements?

    To retrieve the innertext:

    string innerValue = element.Text;
    

    To retrieve the innerhtml:

    • This is a little harder, you would need to iterate through each of the child elements and reconstruct the html based on that – or you could process the html with a scraping tool.

    To retrieve an attribute:

    string hrefValue = element.GetAttribute("href");
    

    (C#, hopefully you can make the translation to Python)

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

Sidebar

Related Questions

I want to grep a HTTP access log, but I'm not able to write
Users have been able to log into my website using their Facebook account, but
I want to be able to log in to a site automatically. For that
I want to be able to log all JMX data accessible via jconsole. Is
I want to be able to log users out of my app built in
I have a situation where ideally I want to be able to log-in to
I am having a problem with my crawler. I was able to log in
Not able to download artifacts from central maven repository. <mirrors> <!-- mirror | Specifies
Not able to store all binary data values into sqlite3 table using QT. For
not able to get this, can someone help for this LINQ query? select col1,

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.