I'd like to find the product ID (ProductID1111111) given the product name (Product 1) using Python. My thoughts would be to use the find function to return the character position of Product1 then back up a few characters, but I am sure there is a better way to do this.
HTML CODE:
<HTML>
<Table>
<TR>
<TD>
<a id="ProductID1111111" class="Products" href="some url">
<span id="ProductID1111111">Product 1</span></a>
<BR>
<a id="ProductID2222222" class="Products" href="some url">
<span id="ProductID2222222">Product 2</span></a>
</TD>
<TR>
</TABLE>
</HTML>
PYTHON:
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
driver = webdriver.Firefox()
driver.get('someurl.com')
html = driver.page_source