I am trying to scrape all the history information for some results in a table online. To do this, I need to click the “History” button on each row, which redirects to another page, then scrape the info, back up to the original page, and continue.
Unfortunately this is not a public-facing website so I can’t share a link.
To get the history links, I have used two different XPATHs. Here is the HTML and XPATH methods I used:
HTML: <div class="dojoxGridRow dojoxGridRowOdd" role="row" aria-selected="false" style="">
XPATH: rows = driver.find_elements(By.XPATH, '//*[@title="History"]')
I also tried
HTML: <a id="action_941191_4" href="LINK"><img src="/gs/images/icons/history.png" alt="History" title="History" style="height:16px;width:16px;border:0;"></a>
XPATH: rows = driver.find_elements(By.XPATH, '//*[@role="row"]')
Both will get me the list of elements that I can print out to see something like:
<selenium.webdriver.remote.webelement.WebElement (session="03c17cd135653f5a2f1a4ad7b4289a28", element="f.4B9AEBF8E681E9699017C96452E2A99B.d.F379C938C6224C18B35326ECE77FCE06.e.18060")>
I’m just not sure where to go from here. How can I use this to actually click what I need to click?
Using the history XPATH gets me just the images, which are all the same. I’m not sure how I can go up one level to get the id, which seems to be unique for each row and could be used to click what I need (I think).
Alternatively, if I get the whole row using the role, I can’t seem to get any of this information, just the actual text from the row.